function chkField(field, name)
{
	if(trim(field.value).length < 1)
	{
		alert(name + " Ç×¸ñÀº ¹Ýµå½Ã ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		field.focus();
		return false;
	}
	return true;
}
      
function chkPatten(val,patten){      
	var regNum =/^[0-9]+$/;      
    var regPhone =/^[0-9]{2,3}-[0-9]{3,4}-[0-9]{4}$/;       
	var regPost =/^[0-9]{3}-[0-9]{3}/      
	var regTel1 =/^[0-9]{2,3}/      
	var regTel2 = /^[0-9]{3,4}/      
	var regTel3 = /^[0-9]{4}$/;      
    var regMail =/^[_a-zA-Z0-9-]+@[._a-zA-Z0-9-]+.[a-zA-Z]+$/;       
    var regDomain =/^[.a-zA-Z0-9-]+.[a-zA-Z]+$/;       
    var regAlpha =/^[a-zA-Z]+$/;       
    var regHost =/^[a-zA-Z-]+$/;       
    var regHangul =/[°¡-ÆR]/;       
	var regHangulEng =/[°¡-ÆRa-zA-Z]/;
	var regHangulEngNum =/[°¡-ÆRa-zA-Z0-9]/;
    var regHangulOnly =/^[°¡-ÆR]*$/;      
	var regId = /^[a-zA-Z0-9_-]{1}[a-zA-Z0-9_-]{3,11}$/;
	var regPw = /^[a-zA-Z0-9]{1}[a-zA-Z0-9_-]{3,11}$/;
	var regDate = /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/;      
      
	patten = eval(patten);      
	if(!patten.test(val)){
		return false;      
	}      
	return true;      
}      
      
function chkJno(entry_no){      
    len = entry_no.length;      
    temp = "";      
    no_ck = 0;      
      
    no_1 = parseInt( entry_no.substring(0,1) );      
    no_2 = parseInt( entry_no.substring(1,2) );      
    no_3 = parseInt( entry_no.substring(2,3) );      
    no_4 = parseInt( entry_no.substring(3,4) );      
    no_5 = parseInt( entry_no.substring(4,5) );      
    no_6 = parseInt( entry_no.substring(5,6) );      
    no_7 = parseInt( entry_no.substring(6,7) );      
    no_8 = parseInt( entry_no.substring(7,8) );      
    no_9 = parseInt( entry_no.substring(8,9) );      
    no_10 = parseInt( entry_no.substring(9,10) );      
      
    if(len == 13){ // ÁÖ¹Îµî·Ï¹øÈ£      
        no_11 = parseInt( entry_no.substring(10,11) );      
        no_12 = parseInt( entry_no.substring(11,12) );      
        no_13 = parseInt( entry_no.substring(12,13) );      
      
        if((no_7 > 0) && (no_7 < 5)){ //ÁÖ¹Îµî·Ï¹øÈ£(2000³â ÀÌÈÄ Ãâ»ýÀÚ´Â      
            no_ck += no_1 * 2; //µÞÀÚ¸® Ã¹¹øÂ° ¼ýÀÚÀÚ ³²¼ºÀÇ °æ¿ì 3,      
            no_ck += no_2 * 3; // ¿©¼ºÀÇ °æ¿ì 4·Î ºÎ¿©µÈ´Ù.)      
            no_ck += no_3 * 4;      
            no_ck += no_4 * 5;      
            no_ck += no_5 * 6;      
            no_ck += no_6 * 7;      
            no_ck += no_7 * 8;      
            no_ck += no_8 * 9;      
            no_ck += no_9 * 2;      
            no_ck += no_10 * 3;      
            no_ck += no_11 * 4;      
            no_ck += no_12 * 5;      
            no_ck = no_ck % 11;      
            no_ck = 11 - no_ck;      
            no_ck = no_ck % 10;      
      
            if(no_ck == no_13){ return true; }      
            else { return false; }      
        }      
        else { return false; }      
    }      
      
    if(len == 10){ // »ç¾÷ÀÚµî·Ï¹øÈ£      
      
        no_ck += no_1 * 1;      
        no_ck += no_2 * 3;      
        no_ck += no_3 * 7;      
        no_ck += no_4 * 1;      
        no_ck += no_5 * 3;      
        no_ck += no_6 * 7;      
        no_ck += no_7 * 1;      
        no_ck += no_8 * 3;      
        no_ck += Math.floor(no_9 * 5 / 10);       
        no_ck += no_9 * 5 % 10;       
        no_ck += no_10;       
               
        if( no_ck % 10 == 0) { return true; }       
        else { return false; }      
    }      
      
}      
      
function chkSelect(field, name){      
	if(field.options[0].selected == true){      
		alert(name + 'Ç×¸ñÀº ¹Ýµå½Ã ¼±ÅÃÇÏ¼Å¾ß ÇÕ´Ï´Ù.');      
		return field.focus();      
		return false;      
	}      
	return true;      
}      
      
      
function chkRadio(field, name){      
	for(var duck = 0; duck < field.length; duck++){      
	  if(field[duck].checked == true){      
	    return true;      
	  }      
	}      
	alert(name + " Ç×¸ñÀ» ¼±ÅÃÇÏ¼¼¿ä");      
	field[0].focus();      
	return false;      
}      
      
function chkCheckbox(field, name)
{
	for(var duck = 0; duck < field.length; duck++)
	{
		if(field[duck].checked == true)
		{
			return true;
		}
	}
	alert(name + " Ç×¸ñÀ» ÇÑ°³ ÀÌ»ó ¼±ÅÃÇÏ¼¼¿ä");
	field[0].focus();
	return false;
}      
      
function chkSpace(field, name)
{
	for ( var i=0; i< field.value.length; i++ )
	{
		if(field.value.substring(i,i+1) == " ")
		{
			alert(name + " Ç×¸ñ¿¡´Â °ø¹é¹®ÀÚ°¡ Çã¿ëÀÌ ¾ÈµË´Ï´Ù.");
			field.focus();
			return false;
		}
    }
	return true;
}      
    
      
/**
* °ø¹éÀ» Á¦°Å ÇÑ´Ù.
*/
function trim(str)
{
	var checkString = " ";      
	var returnValue = "";
	for ( var i=0; i< str.length; i++ )
	{      
		if (checkString.indexOf( str.substring(i,i+1)) < 0 )
		{      
			 returnValue += str.substring( i, i+1 );      
		}      
	}      
	return returnValue;      
}

function setCookie( name, value, expiredays){
	var todayDate = new Date();
	var days = "0";
	if(expiredays != 0)
	{
		todayDate.setDate( todayDate.getDate() + expiredays );
		days = todayDate.toGMTString();
	}
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + days + ";"
}
function getCookie(name) {
	var from_idx = document.cookie.indexOf(name+'=');
	if (from_idx != -1) { 
		from_idx += name.length + 1
		to_idx = document.cookie.indexOf(';', from_idx)
		if (to_idx == -1) {
			to_idx = document.cookie.length
		}
		return unescape(document.cookie.substring(from_idx, to_idx))
	}
}

function trimStr(str,checkString)
{
	var returnValue = "";
	for ( var i=0; i< str.length; i++ )
	{      
		if (checkString.indexOf( str.substring(i,i+1)) < 0 )
		{      
			 returnValue += str.substring( i, i+1 );      
		}      
	}      
	return returnValue;      
}

function formatCurrency(str){      
	var val = "";      
	var d = str.length%3      
	for(i=0;i<str.length;i++){      
		if(i%3 == d){      
			val+=",";      
		}      
		val+=str.charAt(i);      
	}      
	if(!d){val = val.replace(val.charAt(0),"")}      
	return val;      
}

function imageExtCheck(field,name)
{
	if(field.value.length > 0)
	{
		if(!(field.value.substring(field.value.length - 3,field.value.length).toLocaleLowerCase() == 'jpg' || field.value.substring(field.value.length - 3,field.value.length).toLocaleLowerCase() == 'gif') )
		{
			alert(name);
			field.focus();
			return false;
		}
	}
	return true;
}

function KeyCode(mystring)
{
	newstring = '';
	for (i=0; i<mystring.length; i++)
	{
		if (mystring.charCodeAt(i) == 32){newstring = newstring +"%20";}
		else if (mystring.charCodeAt(i) == 35){newstring = newstring +"%23";}
		else if (mystring.charCodeAt(i) == 36){newstring = newstring +"%24";}
		else if (mystring.charCodeAt(i) == 37){newstring = newstring +"%25";}
		else if (mystring.charCodeAt(i) == 38){newstring = newstring +"%26";}
		else if (mystring.charCodeAt(i) == 43){newstring = newstring +"%2B";}
		else if (mystring.charCodeAt(i) == 46){newstring = newstring +"%2E";}
		else if (mystring.charCodeAt(i) == 47){newstring = newstring +"%2F";}
		else if (mystring.charCodeAt(i) == 58){newstring = newstring +"%3A";}
		else if (mystring.charCodeAt(i) == 59){newstring = newstring +"%3B";}
		else if (mystring.charCodeAt(i) == 60){newstring = newstring +"%3C;";}
		else if (mystring.charCodeAt(i) == 61){newstring = newstring +"%3D";}
		else if (mystring.charCodeAt(i) == 62){newstring = newstring +"%3E;";}
		else if (mystring.charCodeAt(i) == 63){newstring = newstring +"%3F";}
		else if (mystring.charCodeAt(i) == 64){newstring = newstring +"%40";}
		else if (mystring.charCodeAt(i) == 91){newstring = newstring +"%5B;";}
		else if (mystring.charCodeAt(i) == 92){newstring = newstring +"%5C";}
		else if (mystring.charCodeAt(i) == 93){newstring = newstring +"%5D;";}
		else if (mystring.charCodeAt(i) == 94){newstring = newstring +"%5E";}
		else if (mystring.charCodeAt(i) == 96){newstring = newstring +"%60";}
		else if (mystring.charCodeAt(i) == 123){newstring = newstring +"%7B";}
		else if (mystring.charCodeAt(i) == 124){newstring = newstring +"%7C";}
		else if (mystring.charCodeAt(i) == 125){newstring = newstring +"%7D";}
		else if (mystring.charCodeAt(i) == 126){newstring = newstring +"%7E";}
		else {newstring = newstring + mystring.charAt(i)}
	}
	return newstring; 
}

function delalert()
{
	return confirm("»èÁ¦ ÇÏ½Ã¸é º¹±¸ ÇÏ½Ç ¼ö ¾ø½À´Ï´Ù. »èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?");
}

function login()
{
	alert("·Î±×ÀÎÈÄ »ç¿ëÇÏ¼¼¿ä.");
	return true;
}

function whoami()
{
	alert("º»ÀÎ¸¸ »ç¿ë °¡´ÉÇÕ´Ï´Ù.");
	return true;
}