var main_dirname="/";
var main_html=main_dirname+"html/";
var main_image=main_dirname+"image/";
var main_modules="/modules/";
var admin_dirname=main_dirname+"admin/";
var admin_html=admin_dirname+"html/";
var admin_imgSrc=admin_dirname+"image/";

function bluring(){ 
if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus(); 
} 
document.onfocusin=bluring; 

function winOpen(url,winname,features)
{
	features = features.toLowerCase();
	len = features.length;
	sumchar= "";
	for (i=1; i <= len; i++) // ºóÄ­ Á¦°Å
	{ 
		onechar = features.substr(i-1, 1);
		if (onechar != " ") sumchar += onechar;
	}

	features = sumchar; 
	sp = new Array();
	sp = features.split(',', 10); // ¹è¿­¿¡ ¿É¼ÇÀ» ºÐ¸®ÇØ¼­ ÀÔ·Â
	splen = sp.length; // ¹è¿­ °¹¼ö
	for (i=0; i < splen; i++) // width, height °ªÀ» ±¸ÇÏ±â À§ÇÑ ºÎºÐ
	{ 		
		if (sp[i].indexOf("width=") == 0)		width = Number(sp[i].substring(6));	// width °ªÀÏ¶§ 
		else if(sp[i].indexOf("height=") == 0)	height = Number(sp[i].substring(7));	// height °ªÀÏ¶§
	}
	sleft = (screen.width - width) / 2;
	stop = (screen.height - height) / 2 - 40;
	features = features + ",status=no,channelmode=0,address=no,left=" + sleft + ",top=" + stop;
	popwin = window.open(url,winname,features);
}
function dialogWinOpen(url,winname,features)
{
	features = features.toLowerCase();
	len = features.length;
	sumchar= "";
	for (i=1; i <= len; i++) // ºóÄ­ Á¦°Å
	{ 
		onechar = features.substr(i-1, 1);
		if (onechar != " ") sumchar += onechar;
	}

	sp = new Array();
	sp = features.split(',', 10); // ¹è¿­¿¡ ¿É¼ÇÀ» ºÐ¸®ÇØ¼­ ÀÔ·Â
	splen = sp.length; // ¹è¿­ °¹¼ö
	for (i=0; i < splen; i++) // width, height °ªÀ» ±¸ÇÏ±â À§ÇÑ ºÎºÐ
	{ 		
		if (sp[i].indexOf("width=") == 0)		width = Number(sp[i].substring(6));	// width °ªÀÏ¶§ 
		else if(sp[i].indexOf("height=") == 0)	height = Number(sp[i].substring(7));	// height °ªÀÏ¶§
	}
	sleft = (screen.width - width) / 2;
	stop = (screen.height - height) / 2 - 40;
	var newOpenWin = showModalDialog(url, winname, "dialogWidth:"+width+"px; dialogHeight:"+height+"px;resizable: no; help: no; status: no; scroll: no; address: no; left:"+sleft+";,top:"+stop+"; ");
}

//¿ìÆí¹øÈ£ Ã£±â
function zipcode_search(f,p,a,a1,strSido,strGugun,strDong)
{
	if( !strSido ) strSido="";
	if( !strGugun ) strGugun="";
	if( !strDong ) strDong="";
	winOpen(main_dirname+'modules/zipcode/zipcode.php?retForm='+f+'&retZipcode='+p+'&retAddress='+a+'&retForcus='+a1+'&retSido='+strSido+'&retGugun='+strGugun+'&retDong='+strDong,'zipcodeForm','width=478,height=456');
	//popupLayer(main_dirname+'modules/zipcode/zipcode.php?retForm='+f+'&retZipcode='+p+'&retAddress='+a+'&retForcus='+a1+'&retSido='+strSido+'&retGugun='+strGugun+'&retDong='+strDong,470,500);
}

//°Ë»ö ºÎºÐ¿¡¼­ÀÇ EnterKey ÀÔ·Â½Ã °Ë»ö
function enterKeySearch(obj)
{
	var k;
	k=event.keyCode;
	if(k==13) obj.submit();
	else return;
}

// °¢ ÀÔ·Â ÇÊµå¿¡ ´ëÇÑ ÀÔ·Â°ªÀÌ ÀÖ´ÂÁö °Ë»ç
function _emptyFieldCheck(fieldName,returnFieldName,msg)
{
	if(!fieldName.value)
	{
		alert(msg);
		returnFieldName.focus();
		return false;
	}
	return true;
}

// ·Î±×ÀÎ ¸Þ½ÃÁö
function loginMsg()
{
	alert("·Î±×ÀÎÈÄ ÀÌ¿ëÇØ ÁÖ½Ã±æ ¹Ù¶ø´Ï´Ù.");
}

//°¢ ÇÊµåÀÇ Á¦ÇÑµÈ ±Û¼ö¸¸ ÀÔ·Â
function _limitFieldCheck(str,limitNum1,limitNum2,returnFieldName,msg)
{
	//#################################################
	// È¤½Ã³ª ¼ýÀÚÇüÅÂ°¡ ¾Æ´Ò°æ¿ì ¼ýÀÚ ÇüÅÂ·Î º¯È¯ÇÑ´Ù.
	limitNum1=parseInt(limitNum1);
	limitNum2=parseInt(limitNum2);	
	//#################################################

	if(str)
	{
		if(limitNum1>0)
		{
			if(str.length < limitNum1 || str.length > limitNum2)
			{
				alert(msg);
				returnFieldName.focus();
				returnFieldName.select();
				return false;
			}
		}
	}
	return true;
}

function simpleImgPopupView(img_obj) {
	if (typeof(img_obj) == 'string') {
		var img_name = img_obj;
	} else if (img_obj.height > 400) {
		var win_scrollbars = 'yes';
		var width_plus = 40;
		var img_name = img_obj.src;
	} else {
		var win_scrollbars = 'no';
		var width_plus = 20;
		var img_name = img_obj.src;
	}
	popup = window.open('about:blank','imgView','width=10,height=10, toolbar=0,menubar=0,resizable=yes,scrollbars='+win_scrollbars+', top=50, left=50');
	popup.document.writeln('<html><title>ÀÌ¹ÌÁö »ó¼¼º¸±â</title>'
		+ '<body topmargin="0" rightmargin="0" leftmargin="0" bgcolor="#FFFFFF">'
		+ '<sc'+'ript>function reSize() {if(document.all("pre_img").width > 0) resizeTo(((document.all("pre_img").width > 800)?800:document.all("pre_img").width) + 10 + '+width_plus+',((document.all("pre_img").height > 600)?600:document.all("pre_img").height) + 60);}</scr'+'ipt>'
		+ '<img src=' + encodeURI(img_name) + ' border=0 onclick=self.close() style="cursor:hand" name=pre_img id=pre_img onload=reSize()>');
//		+ '');
} // ÀÌ¹ÌÁö ÆË¾÷Ã¢À¸·Î º¸±â encodeURI(img_name)

// ¸®½ºÆ®¿¡¼­ÀÇ TRÀ» Å¬¸¯½Ã ÇØ´ç Ã¼Å©¹Ú½º¿¡ Ã¼Å©
function checkboxCheck(id)
{	
	var checkboxName=eval("document.all."+id);
	if(checkboxName.checked==true) checkboxName.checked=false;
	else checkboxName.checked=true;
}

//°¡°Ý(¼ýÀÚ) ºÎºÐÀ» Ä¡È¯ÇÑ ÈÄ °á°ú¸¦ µ¹·ÁÁØ´Ù.
function numberReplace(str)
{
	var numberValue=parseInt(str.replace(/,/g,""));
	numberValue=isNaN(numberValue) ? 0 : numberValue;
	return numberValue;
}

// Àü¹ÝÀûÀÎ pngÆÄÀÏ Ç¥½Ã : IE ÀÏ¶§ Ã³¸®, FF¿¡¼­´Â ¾ÈÇØµµ Àßº¸ÀÓ cssÀÇ .png24 ¿Í ÇÔ²² »ç¿ë
function setPng24(obj) {
    obj.width=obj.height=1;
    obj.className=obj.className.replace(/\bpng24\b/i,'');
    obj.style.filter =
    "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
    obj.src='';
    return '';
}

//*******************************************************************************************************//
//·¹ÀÌ¾î ÇüÅÂ·Î ÆË¾÷À» ¶ç¿î´Ù
function _ID(obj){return document.getElementById(obj)}
function popupLayer(s,w,h)
{
	if (!w) w = 600;
	if (!h) h = 400;

	var pixelBorder = 3;
	var titleHeight = 0;
	w += pixelBorder * 2;
	h += pixelBorder * 2 + titleHeight;

	var bodyW = document.body.clientWidth;
	var bodyH = document.body.clientHeight;

	var posX = (bodyW - w) / 2;
	var posY = (bodyH - h) / 2;

	hiddenSelectBox('hidden');

	var obj = document.createElement("div");
	with (obj.style){
		position = "absolute";
		left = 0;
		top = 0;
		width = "100%";
		height = document.body.scrollHeight;
		backgroundColor = "#000000";
		filter = "Alpha(Opacity=50)";
		opacity = "0.5";
	}
	obj.id = "objPopupLayerBg";
	document.body.appendChild(obj);

	var obj = document.createElement("div");
	with (obj.style){
		position = "absolute";
		left = posX + document.body.scrollLeft;
		top = posY + document.body.scrollTop;
		width = w;
		height = h;
		backgroundColor = "#FFFFFF";
		border = "3px solid #cd5c5c";
	}
	obj.id = "objPopupLayer";
	document.body.appendChild(obj);
/*
	var bottom = document.createElement("div");
	with (bottom.style){
		position = "absolute";
		width = w - pixelBorder * 2;
		height = titleHeight;
		left = 0;
		top = h - titleHeight - pixelBorder * 3;
		padding = "2px 0 0 0";
		textAlign = "right";
		backgroundColor = "#cd5c5c";
		color = "#ffffff";
		font = "bold 11px tahoma";
	}
	//bottom.innerHTML = "<a href='javascript:closeLayer()'><span style='color: #FFFFFF; font-weight: bold; letter-spacing:-1px;'>X Ã¢´Ý±â</span></a>&nbsp;&nbsp;&nbsp;";
	//obj.appendChild(bottom);
*/
	var ifrm = document.createElement("iframe");
	with (ifrm.style){
		width = w - 6;
		height = h - pixelBorder * 2 - titleHeight - 3;
	}
	ifrm.frameBorder = 0;
	ifrm.src = s;
	obj.appendChild(ifrm);
}

function closeLayer(){
	hiddenSelectBox('visible');
	_ID('objPopupLayer').parentNode.removeChild( _ID('objPopupLayer') );
	_ID('objPopupLayerBg').parentNode.removeChild( _ID('objPopupLayerBg') );
}
//*******************************************************************************************************//

function _getClose()
{
	if(opener) { 
		window.close(); 
	}	else { 
		parent.closeLayer(); 
	}
}
function hiddenSelectBox(mode)
{
	var obj = document.getElementsByTagName('select');
	for (i=0;i<obj.length;i++){
		obj[i].style.visibility = mode;
	}
}

function _getFocus_lengthCheck(focusFiled,len)
{
	var str=event.srcElement.value;
	if (str.length >= len) {
		event.srcElement.blur();
		if( focusFiled )
		{
			focusFiled.focus();
			focusFiled.select();
		}
	} else {
		return;
	}
}

//*******************************************************************************************************//
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

MM_reloadPage(true);
//*******************************************************************************************************//

/*** Cookie »ý¼º ***/
function setCookie( name, value, expires, path, domain, secure ){

	var curCookie = name + "=" + escape( value ) +
		( ( expires ) ? "; expires=" + expires.toGMTString() : "" ) +
		( ( path ) ? "; path=" + path : "" ) +
		( ( domain ) ? "; domain=" + domain : "" ) +
		( ( secure ) ? "; secure" : "" );

	document.cookie = curCookie;
}

/*** Cookie Á¦°Å ***/
function clearCookie( name ){

    var today = new Date();
    var expire_date = new Date(today.getTime() - 60*60*24*1000);
    document.cookie = name + "= " + "; expires=" + expire_date.toGMTString();
}

/*** Cookie Ã¼Å© ***/
function getCookie( name ){

	var dc = document.cookie;

	var prefix = name + "="

	var begin = dc.indexOf("; " + prefix);

	if ( begin == -1 ){

		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	}
	else begin += 2

	var end = document.cookie.indexOf(";", begin);

	if (end == -1) end = dc.length;

	return unescape(dc.substring(begin + prefix.length, end));
}

/*** Cookie ÄÁÆ®·Ñ ***/
function controlCookie( name, elemnt ){

	if ( elemnt.checked ){

	    var today = new Date()
	    var expire_date = new Date(today.getTime() + 60*60*6*1000)

		setCookie( name=name, value='true', expires=expire_date, path='/' );
		if (_ID(name) == null) setTimeout( "self.close()" );
		else setTimeout( "_ID('" + name + "').style.display='none'" );
	}
	else clearCookie( name );

	return
}