/**
 * ±â´É°ü·Ã °øÅëÇÔ¼ö
 *
 */
/////////////////////////////////////////////////////////
// onLoad ÀÌº¥Æ®¸¦ Ãß°¡ÇÑ´Ù.
// ex) addOnLoad(test);
//     function test(){
//     }
//
// @funcName ÇÔ¼ö¸í
function addOnLoad(funcName){
	if(window.attachEvent){
		window.attachEvent('onload', funcName);
	}
}


///////////////////////////////////////////////////////////
// ÆË¾÷ ±â´É°ü·Ã
// @url URL
// @w Æø
// @h ³Êºñ
// @s ½ºÅ©·Ñ¹Ù ¿©ºÎ 1, 'Y'ÀÌ¸é º¸¿©ÁÜ, 0, '', 'N'ÀÌ¸é ¼û±è
function popup(url,w,h,s){
	var l, t, objPopup
	l = (screen.width-w)/2;
	t = (screen.height-h)/2;
	if(s==1 || s=="Y")
		objPopup  = window.open(url,'','width='+w+',height='+h+',left='+l+',top='+t+',resizable=0,scrollbars=1');
	else if (s=="" || s==0 || s=="N" || !s)
		objPopup = window.open(url,'','width='+w+',height='+h+',left='+l+',top='+t+',resizable=0,scrollbars=0,status=0');
	else
		objPopup = window.open(url,'','width='+w+',height='+h+',left='+l+',top='+t+',resizable=1,menubar=1,toolbar=1,scrollbars=1,status=1');
	if (objPopup == null) {
		alert("Popup is not allowed.");
	}
	return objPopup;

}


function popupEx(url,w,h,s){
	var objPopup;

	if(s==1 || s=="Y")
		objPopup  = window.open(url,'','width='+w+',height='+h+',resizable=0,scrollbars=1');
	else if (s=="" || s==0 || s=="N" || !s)
		objPopup = window.open(url,'','width='+w+',height='+h+',resizable=0,scrollbars=0,status=0');
	else
		objPopup = window.open(url,'','width='+w+',height='+h+',resizable=1,menubar=1,toolbar=1,scrollbars=1,status=1');
	if (objPopup == null) {
		alert("Popup is not allowed.");
	}
	return objPopup;

}

function openWin(url,w,h){
	window.open(url,"",'width='+w+',height='+h+',resizable=0,scrollbars=0,status=0');
}

function openWin2(url,w,h){
	window.open(url,"",'width='+w+',height='+h+',resizable=0,scrollbars=1,status=0');
}

/**
 * flash Ãâ·Â
 */
function psFlash(url, w, h){
	var ws;
	var hs;
	if(w){
		ws = " width='"+w+"' ";
	}
	if(h){
		hs = " height='"+h+"' ";
	}
	var flashStr=
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' "+
	" "+ws+" "+hs+" id='flash00' align='middle'>"+
	"<param name='allowScriptAccess' value='always' />"+
	"<param name='movie' value='"+url+"' />"+
	"<param name='menu' value='false' />"+
	"<param name='quality' value='high' />"+
	"<embed src='"+url+"' menu='false' quality='high' "+ws+" "+hs+" name='flash00' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>";

	document.write(flashStr);
}

function mainFlash(url, w, h){
	var ws;
	var hs;
	if(w){
		ws = " width='"+w+"' ";
	}
	if(h){
		hs = " height='"+h+"' ";
	}
	var flashStr=
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' "+
	" "+ws+" "+hs+" id='flash00' align='middle'>"+
	"<param name='allowScriptAccess' value='always' />"+
	"<param name='movie' value='"+url+"' />"+
	"<param name='menu' value='false' />"+
	"<param name='quality' value='high' />"+
	"<embed src='"+url+"' menu='false' quality='high' "+ws+" "+hs+" name='flash00' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>";

	document.write(flashStr);
}

///////////////////////////////////////////////////////////
// Æ¯Á¤ url·Î ÀÌµ¿
function goSite(url){
	if(url != ''){
		if(url.indexOf("http")<0)
			url = "http://"+url;
		popup(url,1024,768,9);
	}else
		alert('no URL');
}


///////////////////////////////////////////////////////////
// 0À¸·Î Ã¼¿ì±â

function getZeroFill(n,str) {
 		var ret="";
 		i=0;
 		len=0;
 		if(str == ""){
 			ret = "0";
 			len = 1;
 		}else{
 			ret = str;
 			len = str.length;
 		}

 		if(len < n){
 			for(i=0;i<n-len;i++){
 				ret = "0" + ret;
 			}
 		}
	return ret;
}


///////////////////////////////////////////////////////////
// ÆäÀÌÁö À§Ä¡ º¯°æ Ã³¸®
function goUrl(url,target){
	if(!target) target = window;
	target.location.href=url;
}


///////////////////////////////////////////////////////////
// ÄíÅ°¼ÂÆÃ
function setCookie( name, value, expiredays )
{
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}


function getCookie( name )
{
	var nameOfCookie = name + "=";
	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 "";
}

///////////////////////////////////////////////////////////
// String ¹®ÀÚ¿­ Ã³¸®
function LTrim(strValue){
    while (strValue.length>0){
       if(strValue.charAt(0)==' '){
           strValue=strValue.substring(1,strValue.length);
   }
       else
          return strValue;
    }
return strValue;
}


function RTrim(strValue){
    while (strValue.length>0){
       if(strValue.charAt(strValue.length-1)==' '){
           strValue=strValue.substring(0,strValue.length-1);
   }
       else
           return strValue;
   }
   return strValue;
}

function Trim(str) {
	var search = 0
	while ( str.charAt(search) == " ") search = search + 1
	str = str.substring(search, (str.length))
	search = str.length - 1
	while (str.charAt(search) ==" ") search = search - 1
	return str.substring(0, search + 1)
}

function Trim2(str){
	var reg = /\s+/g;
	return str.replace(reg,'');
}
//¹®ÀÚ¿­ º¯È¯
function strReplace(szFind, szReplace, szAll) {
	var i;
	var length;

	length = szReplace.length - szFind.length;

	for (i=0; i < szAll.length; i++) {
		if (szAll.substr(i,szFind.length) == szFind) {
			if ( i > 0 ) {
				if (szFind == "\n") {
					szAll = szAll.substr(0, i-1) + szReplace + szAll.substr(i+szFind.length,szAll.length - (i+szFind.length));
				} else {
					szAll = szAll.substr(0, i) + szReplace + szAll.substr(i+szFind.length,szAll.length - (i+szFind.length));
				}
			} else {
				szAll = szReplace + szAll.substr(i+szFind.length,szAll.length - (i+szFind.length));
			}
			i = i + length;
		}
	}
	return szAll;
}
// ´ë¹®ÀÚ·Î º¯°æ
function toUpperCase(val){
	return val.toUpperCase();
}
//***************************
// *** 123,456 Çü ¼ýÀÚ·Î ¸®ÅÏ
// **************************
function numberFormat(num)
{
	var str=''+num;
	var len=str.length;
	var no =len/3;
	var remain=len%3;
	var rv='';
	var str1='';
	var blank=0;
	var Bstr='                                   ';

	for (var i=1;i<=no;i++)
	{
		rv=str.substring(len-i*3,len-(i*3)+3)+rv;
		if (i!=no ) rv=','+rv;
	}
	if (remain) rv=str.substring(0,remain)+rv;

	if (navigator.appName=="Microsoft Internet Explorer")
	{
		rv=Bstr.substring(0,14-rv.length)+rv;
	}
	else
	{
		rv=Bstr.substring(0,14-rv.length)+rv;
	}
	return rv;
}

//*******************************
// *** ¼¿·ºÆ®¹Ú½º ¼±ÅÃ µÇ¾ú´ÂÁö
// ******************************
function isSelect(sel) {
	if(sel.selectedIndex==0){
		return false;
	}else{
		return true;
	}
}

//*******************************
// *** ¶óµð¿À¹öÆ° Ã¼Å© µÇ¾ú´ÂÁö
// ******************************
function isRadio(sel) {
	var n=0;
	if(sel.length==undefined){
		if(sel.value) n++;
	}else{
		for(i=0; i<sel.length; i++){
			if(sel[i].checked){
				n++;
			}
		}
	}
	if(n==0){
		return false;
	}else{
		return true;
	}
}

//*******************************
// *** È÷µçÆû¿¡ °ªÀÌ ÀÖ´ÂÁö
// ******************************
function isHidden(sel) {
	if(!sel.value){
		return false;
	}else{
		return true;
	}
}

//***************************
// *** ÀÔ·ÂÀÌ µÇ¾ú´ÂÁö Ã¼Å©
// **************************
function isInput(obj)
{

	if(obj.type=="select-one"){
		if(!isSelect(obj))
		return false;
	}else if(obj.type=="radio" || obj.type==undefined){

		if(!isRadio(obj))
		return false;
	}else if(obj.type=="hidden"){
		if(!isHidden(obj))
		return false;
	}else{
		if(obj.value.length==0 || obj.value=="")
		return false;
	}
	return true;
}

//*******************************************
//*** °ªÀÌ °°ÀºÁö Ã¼Å© (pwd1/pwd2)
//*******************************************
function isEqual(obj1,obj2)
{
	if(obj1.value != obj2.value) return false;
	return true;
}

//************************************
//*** ÀÔ·ÂµÈ ¹®ÀÚÀÇ ±æÀÌ°¡ °°ÀºÁö Ã¼Å©
//************************************
function isChkLen(obj,len)
{
	if(obj.value.length != len)  return false;
	return true
}

//***********************************
// *** ÀÔ·ÂµÈ ¹®ÀÚÀÇ ±æÀÌ ¹üÀ§¸¦ Ã¼Å©
//***********************************
function isBtnLen(obj,len1,len2)
{
	if(obj.value.length <len1 && obj.value.length > len2) return false;
	return true ;
}

//***********************************
// *** ÀÔ·ÂµÈ ¹®ÀÚÀÇ ±æÀÌ ¹üÀ§¸¦ errÃ¼Å©
//***********************************
function isBtnLens(obj,len1,len2)
{
	if(obj.value.length <len1 || obj.value.length > len2) return false;
	return true ;

}


//*****************************//
//*** ¼ýÀÚ¸¸ ÀÔ·Â °¡´É
//*****************************//
function isNum(obj)
{
	if(obj.value.search(/\D/) != -1 ) return false;
	return true ;
}

//*****************************//
//***Æ¯¼ö¹®ÀÚ Á¦¾î ±â´É (¿µ¹®°ú ¼ýÀÚ¸¸)
//*****************************//
function isOnlyEng(obj) {
	var inText = obj.value;
	var ret;
	for (var i = 0; i < inText.length; i++) {
		ret = inText.charCodeAt(i);
		if ((ret > 122) || (ret < 48) || (ret > 57 && ret < 65) || (ret > 90 && ret < 97)) {
			return false;
		}
	}
	return true;
}



//****************************************
//*** ÀÔ·ÂµÈ ¹®ÀÚ¿­ÀÌ ÁÖ¹Îµî·Ï¹øÈ£ÀÎÁö Ã¼Å©
//****************************************
function isJuminNum(aNum1, aNum2)
{
	var tot=0, result=0, re=0, se_arg=0;
	var chk_num="";
	var aNum = aNum1 + aNum2;

	if (aNum.length != 13)
	{
		return false;
	}
	else
	{
		for (var i=0; i <12; i++)
		{
			if (isNaN(aNum.substr(i, 1)))
			return false;
			se_arg = i;

			//¿Ü±¹ÀÎ ÀÎ °æ¿ì
			if(i==6) {
				if (aNum.substr(i, 1) == 7 || aNum.substr(i, 1) == 8 )
				return true
			}

			if (i >= 8)
			se_arg = i - 8;
			tot = tot + Number(aNum.substr(i, 1)) * (se_arg + 2)
		}

		if (chk_num != "err")
		{
			re = tot % 11;
			result = 11 - re;
			if (result >= 10) result = result - 10;
			if (result != Number(aNum.substr(12, 1))) return false;
			if ((Number(aNum.substr(6, 1)) < 1) || (Number(aNum.substr(6, 1)) > 4)) return false;
		}
	}
	return true;
}


//*****************************//
//***ÀÌ¸ÞÀÏÀÌ ¿Ã¹Ù¸¥Áö Ã¼Å© ***//
//*****************************//
function emailCheck (emailStr) {
	// Email check ÇÔ¼ö
	var emailPat=/^(.+)@(.+)$/
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars="\[^\\s" + specialChars + "\]"
	var firstChars=validChars
	var quotedUser="(\"[^\"]*\")"
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom="(" + firstChars + validChars + "*" + ")"
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")


	var matchArray=emailStr.match(emailPat)
	if (matchArray==null) {
		alert("e-mail address is not valid.")
		return false
	}
	var user=matchArray[1]
	var domain=matchArray[2]

	if (user.match(userPat)==null) {
		alert("mail id is not valid.")
		return false
	}

	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) {
		for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) {
				alert("IP is not valid.")
				return false
			}
		}
		return true
	}

	var domainArray=domain.match(domainPat)

	if (domainArray==null) {
		alert("domain name is not valied.")
		return false
	}
	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length
	/*
	if (domArr[domArr.length-1].length<2 ||
		domArr[domArr.length-1].length>3) {
		alert("domain name is not valied.")
		return false
	}
	*/

	if (domArr[domArr.length-1].length==2 && len<3) {
		var errStr="This address ends in two characters, which is a country"
		errStr+=" code. Country codes must be preceded by "
		errStr+="a hostname and category (like com, co, pub, pu, etc.)"
		alert(errStr)
		return false
	}

	if (domArr[domArr.length-1].length==3 && len<2) {
		var errStr="hostname is not valid."
		alert(errStr)
		return false
	}
	return true;
}




/*
2005.08.12 Ãß°¡
*/

///////////////////////////////////////////////////////////
// ÇÑ±ÛÀÎÁö Ã¼Å©
function isHangul (obj)
{
	if (obj.type == object) {
		var str = obj.value;
        var retCode=0;
        for(i=0; i<str.length; i++)
        {
                var code = str.charCodeAt(i)
                var ch = str.substr(i,1).toUpperCase()
                code = parseInt(code)

                if((ch<"0" || ch>"9") && (ch<"A" || ch>"Z") && ((code>255) || (code<0)))
                {
                        return true;
                }
        }
        return false;

	} else {
		return isHangul2(obj);
	}
}

// ÇÑ±ÛÀÎÁö ¾Æ´ÑÁö ±¸º°
function isHangul2(s)
{
     var len;

     len = s.length;

     for (var i = 0; i < len; i++)  {
         if (s.charCodeAt(i) != 32 && (s.charCodeAt(i) < 44032 || s.charCodeAt(i) > 55203))
             return false;
     }
     return true;
}

///////////////////////////////////////////////////////////
// °ø¹éÃ¼Å©
function isEmpty( str ) {
   for ( var i = 0 ; i < str.length ; i++ )    {
      if ( str.substring( i, i+1 ) == " " )
         return true;
   }
   return false;
}

///////////////////////////////////////////////////////////
// Æû Ç×¸ñµé ÀÔ·Â°ª Ã¼Å©
function chkInput(obj, msg){
	if(!isInput(obj)){
		alert(msg);
		if(obj.type !="radio" && obj.type != undefined && obj.type != "hidden"){
			obj.value="";
			obj.focus();
		}
		return false;
	}
	return true;
}

///////////////////////////////////////////////////////////
// Æû Ç×¸ñÀÇ ¼ýÀÚ Ã¼Å©
function chkNum(obj,msg)
{
	if(!chkInput(obj,msg)) return false;
	if(!isNum(obj)){
		alert(msg);
		obj.value="";
		obj.focus();
		return false;
	}
	return true;
}

///////////////////////////////////////////////////////////
// Æû Ç×¸ñ ¿µ¹®/¼öÀÚ Ã¼Å©
function chkOnlyEng(obj, msg){
	if(!isInput(obj) || !isOnlyEng(obj)){
		alert(msg);
		obj.value="";
		obj.focus();
		return false;
	}
	return true;
}

function chkBtnLen(obj,len1,len2,msg){
	if(!isBtnLen(obj,len1,len)){
		alert(msg);
		obj.value="";
		obj.focus();
	}
}

//////////////////////////////////////////////////////////////
// ¸ÖÆ¼ Ã¼Å©¹Ú½º
/**
 * Æ¯Á¤ÀÌ¸§ÀÇ ¸ÖÆ¼Ã¼Å©¹Ú½º¸¦ Ã¼Å© ¶Ç´Â Ã¼Å©ÇØÁ¦ÇÑ´Ù.
 * ex) <input type=checkbox name=IDS value='...'>
 *     <script language='javascript'>
 *		toggleMultiChk(true, 'IDS')
 *	   </script>
 *
 * @param bCheck    true|false(Ã¼Å©ÇÒ »óÅÂ)
 * @param itemName  Ã¼Å©´ë»ó Ã¼Å©¹Ú½ºÀÌ¸§
 */
function toggleMultiChk(bCheck, itemName){
	var obj = document.getElementsByName(itemName);
	if(typeof(obj) == 'undefined'){
		return;
	}

	for(var i=0; i<obj.length; i++){
		obj[i].checked = bCheck;
	}
}
/**
 * Ã¼Å©µÈ °³¼ö
 * @param itemName Ã¼Å©¹Ú½º¸í
 */
function getMultiCheckedNum(itemName){
	var obj = document.getElementsByName(itemName);
	if(typeof(obj) == 'undefined'){
		return 0;
	}
	var chkedCnt=0;

	for(var i=0; i<obj.length; i++){
		if(obj[i].checked)
			chkedCnt++;
	}
	return chkedCnt;
}
/**
 * Ã¼Å©µÈ Ç×¸ñµé °ªÀ» ÃëÇÕÇØ¼­ ¸®ÅÏ
 * @param itemName Ã¼Å©¹Ú½º¸í
 * @param delim    ±¸ºÐÀÚ
 */
function getMultiCheckedString(itemName, delim){
	var obj = document.getElementsByName(itemName);
	var div = delim;
	if(div=="")
		div="|";
	var chkCnt=0;
	if(typeof(obj) == 'undefined'){
		return "";
	}
	var s="";
	var n=0;
	for(var i=0; i<obj.length; i++){
		if(obj[i].checked){
			if(n>0)
				s += div;
			s += obj[i].value;
			n++;
		}
	}
	return s;
}

///////////////////////////////////////////////////////////
// Æ÷Ä¿½ºÀÌµ¿
function moveFocus(obj1,obj2,movLen){
	movLen = (!movLen) ? 6 : movLen; //  = 6 //Æ÷Ä¿½ºÀÌµ¿   ;
	if(obj1.value.length == movLen ) obj2.focus();
}
//´ë¹®ÀÚ·Î º¯°æ
function upperCase(str) {
	if (str.length = 0 ) return "";
	else return str.toUpperCase();
}
//¼Ò¹®ÀÚ·Î º¯°æ
function lowerCase(str) {
	if (str.length = 0 ) return "";
	else return str.toLowerCase();
}

// ¼ýÀÚ¸¸ ÀÔ·ÂÇÏ°Ô ÇÑ´Ù.
// onkeydown="return onlyNumber();"
function onlyNumber() {
	 if ((window.event.keyCode == 8) || (window.event.keyCode == 9) || (window.event.keyCode == 46)) { //¹é½ºÆäÀÌ½ºÅ°¿Í  tab, delÅ°´Â ¸Ô°ÔÇÑ´Ù.
      window.event.returnValue=true;
	 } else if ((window.event.keyCode >= 96) && (window.event.keyCode <= 105)) { //¼ýÀÚÆÐµå´Â ¸Ô°Ô ÇÑ´Ù.
	 		window.event.returnValue=true;
   } else if( (window.event.keyCode<48) || (window.event.keyCode>57) ) {
      window.event.returnValue=false;
  }
}
// ¼ýÀÚ ¹× '.' ¸¸ ÀÔ·Â
function onlyNumberAndDot() {
	 if ((window.event.keyCode == 8) || (window.event.keyCode == 190) || (window.event.keyCode == 9) || (window.event.keyCode == 46)) { //¹é½ºÆäÀÌ½ºÅ°¿Í  '.', tab, delÅ°´Â ¸Ô°ÔÇÑ´Ù.
      window.event.returnValue=true;
	 } else if (((window.event.keyCode >= 96) && (window.event.keyCode <= 105)) || (window.event.keyCode == 110)) { //¼ýÀÚÆÐµå´Â ¸Ô°Ô ÇÑ´Ù.
	 		window.event.returnValue=true;
   } else if( (window.event.keyCode<48) || (window.event.keyCode>57) ) {
      window.event.returnValue=false;
  }
}
// ÀÌ¹ÌÁö ÆÄÀÏ ¿©ºÎ
function isImageFile(fn) {
	var ext = fn.value;
	ext = ext.substring(ext.length-3,ext.length);
	ext = ext.toLowerCase();
	if(ext == "jpg" || ext == "jpeg" || ext == "gif" || ext == "bmp") {
		return true;
	} else {
		alert("Only image file(jpg, gif, bmp) is allowed.");
		return false;
	}
}

// ÁÖ¹Îµî·Ï¹øÈ£ Ã¼Å©
function checkNationalId(nationalId1, nationalId2)
	{

	if(isNaN(nationalId1) || isNaN(nationalId2))
	{
		return 'N';
	}

	var nationalId = nationalId1 + nationalId2;

	var nationalIdStr = nationalId.toString();
	a = nationalIdStr.substring(0, 1);
	b = nationalIdStr.substring(1, 2);
	c = nationalIdStr.substring(2, 3);
	d = nationalIdStr.substring(3, 4);
	e = nationalIdStr.substring(4, 5);
	f = nationalIdStr.substring(5, 6);
	g = nationalIdStr.substring(6, 7);
	h = nationalIdStr.substring(7, 8);
	i = nationalIdStr.substring(8, 9);
	j = nationalIdStr.substring(9, 10);
	k = nationalIdStr.substring(10, 11);
	l = nationalIdStr.substring(11, 12);
	m = nationalIdStr.substring(12, 13);

	month = nationalIdStr.substring(2,4);
	day = nationalIdStr.substring(4,6);

	if(month <= 0 || month > 12) return 'N';
	if(day <= 0 || day > 31) return 'N';



	// ÁÖ¹Îµî·ÏµÞÀÚ¸® Ã¹¹øÂ° ¹øÈ£ À¯È¿¼º Ã¼Å© (1,2,3,4) are only valid
	if(g > 4 || g == 0) return 'N';

	temp=a*2+b*3+c*4+d*5+e*6+f*7+g*8+h*9+i*2+j*3+k*4+l*5;
	temp=temp%11;
	temp=11-temp;
	temp=temp%10;

	if(temp == m)
		return 'Y';
	else
		return 'N';

}


// °ø¹éÀÌ ÀÖ´ÂÁö Ã¼Å©
function checkSpace( str )
{
	return (str.search(/\s/) != -1);
}


	// Æ¯¼ö¹®ÀÚ Ã¼Å©
function Check_nonChar(id_text)
{
		//var nonchar = '~`!@#$%^&*()-_=+\|<>?,./;:"';
		var nonchar = '`@#$%&\|<>;"';

		var i ;
		for ( i=0; i < id_text.length; i++ )  {
			if( nonchar.indexOf(id_text.substring(i,i+1)) > 0) {
				break ;
			}
		}
		if ( i != id_text.length ) {
			return false ;
		}
		else{
			return true ;
		}

		return false;
}

//¹®ÀÚ¿­ °³¼ö
function LengthCheck(message) {
	var nbytes = 0;

	for (i=0; i<message.length; i++) {
		var ch = message.charAt(i);
		if (escape(ch).length > 4) {
			nbytes += 2;
		} else if (ch != '\r') {
			nbytes++;
		}
	}

	return nbytes;
}

function strCutByte(message, maximum){
	var inc = 0;
	var nbytes = 0;
	var msg = "";
	var msglen = message.length;

	for (i=0; i<msglen; i++) {
		var ch = message.charAt(i);
		if (escape(ch).length > 4) {
			inc = 2;
		} else if (ch != '\r') {
			inc = 1;
		}
		if ((nbytes + inc) > maximum) {
			break;
		}
		nbytes += inc;
		msg += ch;
	}

	return msg;
}


function next(str, size){     // ÁÖ¹Î¹øÈ£ valid check , ÀÚµ¿ ´ÙÀ½ Æû ÀÌµ¿
   num = str.socialId1.value;
   siz = num.length;
   if(siz == size){
      str.socialId2.focus();
   }
   return true;
}

function next2(str, size){     // ÁÖ¹Î¹øÈ£ valid check , ÀÚµ¿ ´ÙÀ½ Æû ÀÌµ¿
   num = str.jumin1.value;
   siz = num.length;
   if(siz == size){
      str.jumin2.focus();
   }
   return true;
}


function chkEmail(obj1,obj2){
	if(!chkInput(obj1,"Enter e-mail address.")) return false;
	if(obj2){
		if(!chkInput(obj2,"Enter e-mail address.")) return false;
		if(!emailCheck(obj1.value+"@"+obj2.value)){ obj1.focus(); return false; }
	}else{
		if(!emailCheck(obj1.value)){ obj1.focus(); return false; }
	}
	return true;
}




function doResize(){
	container.height = myframe.document.body.scrollHeight;
	container.width = myframe.document.body.scrollWidth;
}


///////////////////////////////////////////////////////////////
// ÀÌ¹ÌÁö popup ÇÔ¼ö
function jsOpenImage(imageRef)
{
    var x,y,w,h,loadingMsg;
    //ÆË¾÷µÉ Ã¢ÀÇ ÃÊ±â Å©±â
    w=300;h=100;
    //È­¸é ÇÑ°¡¿îµ¥·Î ÆË¾÷Ã¢ ¶ç¿ì±â À§ÇÑ ÁÂÇ¥ °è»ê
    x=Math.floor( (screen.availWidth-(w+12))/2 );y=Math.floor( (screen.availHeight-(h+30))/2 );

    //ÀÌÁö¹Ì°¡ ·ÎµùÁß¿¡ ³»º¸³¾ ¸Þ½ÃÁö
    loadingMsg="<table width=100% height=100%><tr><td valign=center align=center><font size='2' color='#ff6600' face='termanal'>NOW LODDING...</font></td></tr></table>";

    with( window.open("","",'height='+h+',width='+w+',top='+y+',left='+x+',scrollbars=no,resizable=no,status=no') )
    {
        document.write(
        "<body topmargin=0 rightmargin=0 bottommargin=0 leftmargin=0>",
        loadingMsg,
        "<img src=\""+imageRef+"\" hspace=0 vspace=0 border=0 onmousedown=\"window.close();\" onload=\"document.title='¿øº» ÀÌ¹ÌÁö';document.body.removeChild(document.body.children[0]);window.resizeTo(this.width+12,this.height+30);window.moveTo(Math.floor( (screen.availWidth-(this.width+12))/2),Math.floor( (screen.availHeight-(this.height+30))/2 ));\">",
        "</body>");
        focus();
    }

    return false;
}

///////////////////////////////////////////////////////////////
// ÀÌ¹ÌÁö resize
function imageResize(img, maxWidth, maxHeight)
{
	var width, height;

	width	= parseInt(img.width);
	if(width == 0) {
		return false;
	}

	height	= parseInt(img.height);
	if(height > maxHeight) {
		img.style.width		= Math.ceil(width * maxHeight / height);
		img.style.height	= maxHeight;
	}
	if(width > maxWidth) {
		img.style.height	= Math.ceil(height * maxWidth / width);
		img.style.width		= maxWidth;
	}

	return true;
}

///////////////////////////////////////////////////////////////
// ³â¿ù yyyyMMÇüÅÂ·Î ¸®ÅÏ
function mergeToYM(year, month){
	var yymm = year;
	if(month.length < 2){
		yymm += "0"+month;
	}else{
		yymm += month;
	}
	return yymm;
}

///////////////////////////////////////////////////////////////
/**
 * ÀÔ·Â¹Ú½ºÀÇ ÀÔ·ÂµÇ´Â ±ÛÀÚbyte¼ö¸¦ Ã¼Å©ÇÏ°í Á¦ÇÑÇÑ´Ù.
 * @param item   ÀÔ·Â¹Ú½º ÀÌ¸§
 * @param viewId ÇöÀç ÀÔ·ÂµÈ ±ÛÀÚ¼ö¸¦ º¸¿©ÁÙ spanÅÂ±× ¾ÆÀÌµð
 * ex)
 *         ÇöÀç <span id='cmntlen' style=''>0</span>byte
 *         <textarea onKeyUp='inputCheckLen(this, "cmntLen", 100)'></textarea>
 */
function inputCheckLen(item, viewId, limit){
	var len = LengthCheck(item.value);
	if(len>limit){
		alert(limit+'byte only.');
		item.value = strCutByte(item.value, limit);
	}
	len = LengthCheck(item.value);
	var obj = document.getElementById(viewId);
	obj.innerHTML = len;
}

/**
 * Ajax call
 */
function getHttprequest(URL) {
	var xmlhttp = null;
	if(window.XMLHttpRequest) {
		xmlhttp = new XMLHttpRequest();
	} else {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.open('GET', URL,false);
	xmlhttp.onreadystatechange = function() {
		if(xmlhttp.readyState==4 && xmlhttp.status == 200 && xmlhttp.statusText=='OK') {
			responseText = xmlhttp.responseText;
		}
	}
	xmlhttp.send('');

	return responseText = xmlhttp.responseText;
}

/**
 * ¼±ÅÃ¹Ú½º °ªÀ» µðÆúÆ® ¼­ÅÃ
 */
function setSelBoxSelectedByValue(tbox, val){
	for(var i=0; i<tbox.options.length; i++){
		if(tbox.options[i].value == val){
			tbox.selectedIndex = i;
			return;
		}
	}
}
function setSelBoxSelectedByText(tbox, val){
	for(var i=0; i<tbox.options.length; i++){
		if(tbox.options[i].text == val){
			tbox.selectedIndex = i;
			return;
		}
	}
}



/** ÄÚ´õ ÀÌ°æ¹Î Ãß°¡ 1205
 * 4depth menu icon change
 * 0104 »ç¿ëÁßÁöÇÔ
 */
pic0 = new Image();
pic0.src = "/images/blank.gif";
pic1 = new Image();
pic1.src = "/images/leftmenu/LFmenu_icon.gif";

/** ÄÚ´õ ÃÖÁØÈ£ Ãß°¡ 1221
 * bottom banner
 */
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_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; }
}
var int_menu_show = 0;
function menu_show(num)
{
    if(int_menu_show == num) return;
    for (i=1;i<=menucount;i++){
        menu=eval("document.all.block"+i+".style");
        ch_menu=eval("document.all.ch_menu"+i);
        if (num!=i){
        if (menu.display=="block"){
            menu.display="none";
            ch_menu.src="/images/common/ng_ltitle_closed.gif";
            }
        }
        if (num==i){
        if (menu.display=="block") {
            menu.display="none";
            ch_menu.src="/images/common/ng_ltitle_closed.gif";
            }
             else {
                     menu.display="block";
                     ch_menu.src="/images/common/ng_ltitle_open.gif";
                    }
        }
    }
    int_menu_show = num;
}
var menucount = 1;
var menucount = 2;

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;
}