// ÄíÅ° ¹Þ±â ÇÔ¼ö
function getCookie(strname)
{
	var nameOfCookie = strname + "=";
	var x = 0;
	while ( x <= document.cookie.length )
	{
		var y = (x+nameOfCookie.length);
		if ( document.cookie.substring( x, y ) == nameOfCookie )
		{
			if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
			endOfCookie = document.cookie.length;
			return unescape( document.cookie.substring( y, endOfCookie ) );
		}
		x = document.cookie.indexOf( " ", x ) + 1;
		if ( x == 0 )
		break;
	}
	return "";
}

// ÄíÅ° ¼³Á¤ ÇÔ¼ö
function setCookie(name, value, expire)
{
	var tDate = new Date();
	tDate.setDate(tDate.getDate() + expire);
	document.cookie = name + "=" + escape(value) + ";path=/;expires="+tDate.toGMTString()+";"
}

// Æ÷Ä¿½ºµÈ ÀÔ·Â¹Ú½º »öÇ¥½Ã
function sendfocuscolor(objname)
{
	objname.style.backgroundColor = "#F5F5F5";
}

// ºí·¯µÈ ÀÔ·Â¹Ú½º »öÇ¥½Ã
function sendblurcolor(objname)
{
	objname.style.backgroundColor = "#FFFFFF";
}

//¸ñ·Ï Æ÷Ä¿½º »öÇ¥½Ã
function sendlistfocuscolor(objname)
{
	objname.style.background = "#F5F5F5";
}

//¸ñ·Ï ºí·¯ »ö Ç¥½Ã
function sendlistblurcolor(objname)
{
	objname.style.background = "#FFFFFF";
}

//ÇÑ±ÛÀÔ·Â°Ë»ç
function checkkorean(strvalue)
{
	var i = 0;
	var str = /[°¡-È÷]/;
	while(i < strvalue.length)
	{
		if(!str.test(strvalue.charAt(i)))
			return true;
		i++;
	}
	return false;
}

//¾ÆÀÌµð°Ë»ç
function checkid(strvalue)
{
	var str = /[A-Za-z0-9_]/;
	var i = 0
	while(i < strvalue.length)
	{
		if(!str.test(strvalue.charAt(i)))
		{
			return true;
			break;
		}
		i++;
	}
	if(strvalue.length < 6)
		return true;
	return false;
}

//¿µ¹®ÀÌ¸§°Ë»ç
function checkenglish(strvalue)
{
	var str = /[A-Za-z]/;
	var i = 0
	while(i < strvalue.length)
	{
		if(!str.test(strvalue.charAt(i)))
		{
			return true;
			break;
		}
		i++;
	}
	return false;
}

// ºñ¹Ð¹øÈ£ °Ë»ç (¿µ¹®´ë¼Ò¹®ÀÚ, ¼ýÀÚ È¥ÇÕ)
function checkpwd(strvalue)
{
	var alphacnt = 0;
	var digitcnt = 0;
	var i = 0;
	var str = /[A-Za-z]/;
	var str1 = /[0-9]/;
	while(i < strvalue.length)
	{
		if(str.test(strvalue.charAt(i)))
			alphacnt++;
		if(str1.test(strvalue.charAt(i)))
			digitcnt++;
		i++;
	}
	if(alphacnt > 0 && digitcnt > 0 && (alphacnt + digitcnt == strvalue.length))
		return false;
	else
		return true;
	if(strvalue.length < 6)
		return true;
	return false;
}

//ÁÖ¹Îµî·Ï¹øÈ£°Ë»ç
function checkresidentno(strvalue)
{
	var str = /\d{6}[1-4]\d{6}/;
	if(str.test(strvalue))
	{
		var check = new Array(13);
		var key = new Array(2,3,4,5,6,7,8,9,2,3,4,5);
		var sum = 0;
		for(var i=0; i<13; i++)
			check[i] = parseInt(strvalue.charAt(i),10);
		for(var i=0; i<12; i++)
			sum += check[i] * key[i];
		var rs = (11-(sum%11)) % 10
		if(rs != check[12])
			return true;
		return false;
	}
	return true;
}

//°ø¹éÀÔ·Â°Ë»ç
function checkspace(strvalue)
{
	var str = /[ \n\r]/;
	var i = 0;
	var count = 0;
	while(i < strvalue.length)
	{
		if(str.test(strvalue.charAt(i)))
			count++;
		i++;
	}
	if(count == strvalue.length)
		return true;
	else
		return false;
}

//¼ýÀÚÀÔ·Â°Ë»ç
function checkdigit(strvalue, size)
{
	var str = /[0-9]/;
	for(var i=0; i<strvalue.length; i++)
	{
		if(!str.test(strvalue.charAt(i)))
			return true;
	}
	if(strvalue.length < size)
		return true;
	return false;
}

//¼ýÀÚÀÔ·Â°Ë»ç
function checkdigit1(strvalue)
{
	var str = /[0-9]/;
	for(var i=0; i<strvalue.length; i++)
	{
		if(!str.test(strvalue.charAt(i)))
			return true;
	}
	return false;
}

//¸ÞÀÏÁÖ¼Ò°Ë»ç
function checkmail(strvalue)
{
	var str = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
	if(!str.test(strvalue))
		return true;
	return false;
}

//ÀüÈ­¹øÈ£°Ë»ç
function checkphoneddd(strvalue)
{
	var str = /02|031|032|033|041|042|043|051|052|053|054|055|061|062|063|064/;
	if(str.test(strvalue))
		return false;
	else
		return true;
}

//ÇÚµåÆù°Ë»ç
function checkmobileddd(strvalue)
{
	var str = /010|011|012|015|016|017|018|019/;
	if(str.test(strvalue))
		return false;
	else
		return true;
}

//URL °Ë»ç
function checkurl(strvalue)
{
	var str = /http:\/\/([\w-]+\.)+[\w-]+(\/[\w- ./?%&=]*)?/;
	if(str.test(strvalue))
		return false;
	else
		return true;
}

//ÀÌ¹ÌÁö ÆÄÀÏ °Ë»ç
function checkimage(strvalue)
{
	var str = /gif|jpg|jpeg|png/;
	if(strvalue.lastIndexOf(".") > -1)
	{
		strvalue = strvalue.substr(strvalue.lastIndexOf(".") + 1,strvalue.length - strvalue.lastIndexOf(".") - 1).toLowerCase();
		if(str.test(strvalue))
			return false;
		else
			return true;
	}
	else
		return true;
}

//ÅëÈ­ÀÚ¸®¼öÇ¥½Ã ÇÔ¼ö
function checkcurrency(intvalue)
{
	var strvalue = intvalue.toString();
	var commalocation = strvalue.length % 3;
	if(commalocation > 0)
	{
		var returnvalue = strvalue.substring(0,commalocation);
		if(strvalue.length > 3)
			returnvalue += ",";
	}
	else
		returnvalue = "";
	for(var i=commalocation; i < strvalue.length; i+=3)
	{
		returnvalue += strvalue.substring(i, i+3);
		if(i < strvalue.length - 3)
			returnvalue += ",";
	}
	return returnvalue;
}

//ÆË¾÷Ã¢ ´Ý±â ÇÔ¼ö
function sendclose()
{
	window.close(this);
}

//ÀÎ¼ö ÀÖ´Â ÆË¾÷Ã¢ ´Ý±â ÇÔ¼ö
function sendpopupclose(strname,strdays)
{ 
    setCookie( strname, "done" , strdays); // 1=ÇÏ·íµ¿¾È °øÁöÃ¢ ¿­Áö ¾ÊÀ½
    window.close();
}

//µÚ·Î ÀÌµ¿ ÇÔ¼ö
function sendback()
{
	window.history.back();
}

//Ãë¼Ò ÇÔ¼ö
function sendcancel(strmsg, strlocation)
{
	if(confirm(strmsg))
		window.location.href = strlocation;
}

//ÆË¾÷Ã¢ ¿ÀÇÂ ÇÔ¼ö - °¡¿îµ¥ Á¤·Ä
function sendopen(strurl, strid, intwidth, intheight, strresizable, strscrollbars, boolreplace)
{
	var top = window.screen.availHeight / 2 - intheight / 2;
	var left = window.screen.availWidth / 2 - intwidth / 2;
	var objwin = window.open(strurl,strid,"top=" + top + ",left=" + left + ",width=" + intwidth + ",height=" + intheight + ",location=no,menubar=no,resizable=" + strresizable + ",scrollbars=" + strscrollbars + ",status=no,titlebar=no,toolbar=no",boolreplace);
	objwin.focus();
}

//ÆË¾÷Ã¢ ¿ÀÇÂ ÇÔ¼ö - ¿ÞÂÊ Á¤·Ä
function sendpopupopen(strurl, strid, intleft, inttop, intwidth, intheight, strresizable, strscrollbars, boolreplace)
{
	var objwin = window.open(strurl,strid,"top=" + inttop + ",left=" + intleft + ",width=" + intwidth + ",height=" + intheight + ",location=no,menubar=no,resizable=" + strresizable + ",scrollbars=" + strscrollbars + ",status=no,titlebar=no,toolbar=no",boolreplace);
}

//ÀÌ¿ë¾à°ü
function sendagreement()
{
	sendopen("/popup/pop_agreement.asp","pop_agreement",660,712,"no","no",false);
}

//°³ÀÎº¸È£Á¤Ã¥
function sendprivatepolicy()
{
	sendopen("/popup/pop_private_policy.asp","pop_agreement",660,712,"no","no",false);
}

//ÇÁ·±Æ®ÆäÀÌÁö ÀÚµ¿»ý¼º ÇÔ¼ö
function FP_preloadImgs() {//v1.0
 var d=document,a=arguments; if(!d.FP_imgs) d.FP_imgs=new Array();
 for(var i=0; i<a.length; i++) { d.FP_imgs[i]=new Image; d.FP_imgs[i].src=a[i]; }
}

function FP_swapImg() {//v1.0
 var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length;
 n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm;
 elm.$src=elm.src; elm.src=args[n+1]; } }
}

function FP_getObjectByID(id,o) {//v1.0
 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
 else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
 if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
 for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }
 f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
 for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
 return null;
}

function FP_swapImgRestore() {//v1.0
 var doc=document,i; if(doc.$imgSwaps) { for(i=0;i<doc.$imgSwaps.length;i++) {
  var elm=doc.$imgSwaps[i]; if(elm) { elm.src=elm.$src; elm.$src=null; } } 
  doc.$imgSwaps=null; }
}