/* alert ¸Þ¼¼Áö ±¸¹® ½ÃÀÛ ************************************/
var MSG_NO_INPUT 			= "(ÀÌ)°¡ ÀÔ·ÂµÇÁö ¾Ê¾Ò½À´Ï´Ù.";
var MSG_INPUT_REPEAT		= "´Ù½Ã ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿À.";
/* alert ¸Þ¼¼Áö ±¸¹® ³¡ :  ************************************/

/*
 * ÇÔ¼ö¸í : POST
 * ¼³  ¸í : ¸µÅ©¸¦ POSTÇü½ÄÀ¸·Î ³Ñ±ä´Ù.
 * Çü  ½Ä : ÁÖ¼Ò, °Ù¹æ½ÄÀÇ ÁÖ¼Ò, Å¸°Ù(»èÁ¦°¡´É)
 * ¿¹) <a href="#" onClick="POST('./Link.asp','a=aaa&b=bbb&c=ccc','target')">¸µÅ©~</a>
 */
function POST(page,get,target){
	
	var obj = document.createElement("div");
	obj.id = "href";
	document.body.appendChild(obj);	
	
	var href = document.getElementById("href");
	var form, hiddenform;

	form = "";
	hiddenform = "";
	
	if (get != ""){
		gettmp = get.split("&");
		for (i=0;i<gettmp.length;i++){
			hidden_name = gettmp[i].split("=")[0];
			hidden_value = gettmp[i].split("=")[1];
			hiddenform = hiddenform + " <input type='hidden' name='"+ hidden_name + "' value='"+ hidden_value +"'> ";
		}
	}
	
	form = form + " <form name='LINKPAGE' method='POST'> ";
	form = form + hiddenform ;
	form = form + " </form> ";

	href.style.display = "none";
	href.innerHTML = form;
	
	if (!target) target = "";

	var frm = document.LINKPAGE;
	frm.action = page;
	frm.target = target;
	frm.submit();
	
}


/* ÇÊ¼ö Ç×¸ñ ÀÔ·Â ¿©ºÎ Ã¼Å©
 * ¿¹) if(requiredField(frm.are_code, "Áö¿ªÄÚµå")) return;
 */
function requiredField(obj, objName){
    if(objName == null || objName == "") objName = obj.name;

    if(obj.value.replace(/[ ]/g, "") == ""){
        alert("[" + objName + "]" + MSG_NO_INPUT + "\n" + MSG_INPUT_REPEAT);
        if(obj.select != null) obj.select();
        obj.focus();
        return true;;
    }
    return false;
}

/* ÇÊ¼ö Ç×¸ñ ÀÔ·Â ¿©ºÎ Ã¼Å©
 * ¿¹) if(requiredFieldRADIO(frm.are_code, "Áö¿ªÄÚµå")) return;
 */
function requiredFieldRADIO(obj, objName){
    if(objName == null || objName == "") objName = obj.name;

    if(getChecked(obj) == ""){
        alert("[" + objName + "](ÀÌ)°¡ ¼±ÅÃµÇÁö ¾Ê¾Ò½À´Ï´Ù.\n´Ù½Ã ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿À.");
        obj[0].focus();
        return true;;
    }
    return false;
}



function file_check(obj, check) {
	var count=0;
	
	ext = obj.value;
	ext = ext.substring(ext.lastIndexOf(".")+1);
	ext = ext.toLowerCase(); 
	
	if (check != "" ) {
		checkarr = check.split(",")
	}else{	
		checkarr = ["pdf", "hwp", "doc", "xls", "ppt", "txt", "hul", "htm", "html", "gif", "jpg", "wav", "mp3", "wma", "alz", "zip", "rar", "arj", "swf", "css", ""]
	}
	
	for (var i=0; i <= checkarr.length; i++){
		if (ext == checkarr[i]){
			count = count + 1;
		}
	}
	
	if (count > 0){
		return true;
	}else{
		alert("¡ØÆÄÀÏ ¾÷·Îµå °¡´É ÆÄÀÏ Çü½ÄÀº ¾Æ·¡¿Í °°½À´Ï´Ù.\n -È®ÀåÀÚ("+ checkarr +")");	
		obj.focus();
		obj.select();
		return false;
	}
}


/* ¼ýÀÚ¸¸ ÀÔ·Â °¡´ÉÇÏ°Ô ÇÔ
 * onkeypress ÀÌº¥Æ®¿¡ Àû¿ë : ime-mode¸¦ ¹Ýµå½Ã disabled·Î ¼³Á¤ÇØ¾ß ÇÔ.
 * ¿¹) style="ime-mode:disabled" onkeypress="onlyNumber()"
 */
function onlyNumber()
{
	if( window.event.keyCode >= 48 && window.event.keyCode <= 57) {
	} else {
		window.event.keyCode = "";
	}
}


//========== ¹«Á¶°Ç ¼ýÀÚ¸¸ Ã¼Å© ========================
function Chk_Num(fo_Field) {		//¹«Á¶°Ç ¼ýÀÚ¸¸ Ã¼Å©
	if (isNaN(fo_Field.value)) {
	  alert("¼ýÀÚ¸¦ ÀÔ·ÂÇÏ½Ê½Ã¿À.");
	  fo_Field.focus();
	  fo_Field.select();
	}
}


function addComma(val)
{
	var rtnVal = "";
	var stack = "";

	for(var i=0; i<val.length; i++){
		stack = val.charAt(i) + stack;
	}
	for(var i=0; i<stack.length; i++){
		if(i%3 == 0 && i!=0){
			rtnVal = stack.charAt(i) + "," + rtnVal;
		}else{
			rtnVal = stack.charAt(i) + rtnVal;
		}
	}
	return rtnVal
}






/****************************************************************************
 * Check °´Ã¼ Á¦¾î ÇÔ¼ö
 * ÀÛ¼ºÀÏ : 2004-11-10
 ***************************************************************************/
/*
 * ÇÔ¼ö¸í : getChecked
 * ¼³  ¸í : Radio °´Ã¼¿¡¼­ Ã¼Å©µÈ Ç×¸ñÀÇ value ¸¦ ¹ÝÈ¯ÇÑ´Ù.
 * @param _obj (Radio, Ã¼Å©)
 * @return String, Ã¼Å©µÈ Ç×¸ñÀÇ value, ¾øÀ» °æ¿ì ""
 */
function getChecked(_obj){
	if (_obj == null) return "";
	
	//1°Ç ÀÏ °æ¿ì¿¡ ´ëÇÑ Ã³¸®
	if(_obj.length == null){
		_objLen=1;			
	}else{
		_objLen= _obj.length;
	}
	for(var i=0; i<_objLen; i++){
		if(_obj.length == null){
			if(_obj.checked)
				return _obj.value;
		}else{
			if(_obj[i].checked)
				return _obj[i].value;
		}
	}
	return "";
}

/*
 * ÇÔ¼ö¸í : getCheckedCount
 * ¼³  ¸í : Radio °´Ã¼¿¡¼­ Ã¼Å©µÈ Ç×¸ñ ¼ö¸¦ ¹ÝÈ¯ÇÑ´Ù.
 * @param _obj (Radio, Ã¼Å©)
 * @return String, Ã¼Å©µÈ Ç×¸ñ¼ö, ¾øÀ» °æ¿ì 0
 */
function getCheckedCount(_obj){
	var cnt=0;
	var chkLen=0;
	if (_obj == null) return cnt;

//1°Ç ÀÏ °æ¿ì¿¡ ´ëÇÑ Ã³¸®
	if(_obj.length == null){
		_objLen=1;			
	}else{
		_objLen= _obj.length;
	}
	
	for(var i=0; i<_objLen; i++){
		if(_obj.length == null){
			if(_obj.checked)
				cnt++;
		}else{
			if(_obj[i].checked)
				cnt++;
		}
	}
	return cnt;
}

// ¸ðµç Ã¼Å© ¹Ú½ºÀÇ checked ¼Ó¼º ¼¼ÆÃ
function chkAllRows(chkMain, chk){
	if(chk == null){
		return;
	}
	// 2°Ç ÀÌ»óÀÏ °æ¿ì ½ÇÇà µÊ.
	for(i=0; chk.length != null && i<chk.length; i++){
		if(chkMain.checked){
			chk[i].checked = true;
		}else{
			chk[i].checked = false;
		}
	}
	// 1°Ç ÀÏ¶§ ½ÇÇàµÊ.
	if(chk.length == null){
		if(chkMain.checked){
			chk.checked = true;
		}else{
			chk.checked = false;
		}
	}

}


/* ¿£ÅÍÅ° ÀÔ·Â½Ã ¿øÇÏ´Â ÇÔ¼ö È£ÃâÇÏ±â
 * onkeypress ÀÌº¥Æ®¿¡ Àû¿ë
 * ¿¹) onkeypress="key13Check('goSearch1()')"
 */
function key13Check(fnc){
	if(window.event.keyCode == 13){
        eval(fnc);
	}
}


// ÆË¾÷ È­¸é »ý¼º
function popUpWindow(url, popName, width, height, scroll, resizable){
	if( width == null || width == "" ) width = 600;
	if( height == null || height == "" ) height = 500;
	if( resizable == null || resizable == "" ) resizable = "yes";
	
	var left, top;
	top  = (window.screen.height - height) / 2;
	left = (window.screen.width  - width ) / 2;
	sFeatures = "width="+width+",height="+height+",left="+left+",top="+top+",resizable="+resizable;
	if(scroll == "yes") sFeatures += ",scrollbars=yes";
	else sFeatures += ",status=no,toolbar=no,menubar=no,location=no";

	var obj = window.open(url,popName,sFeatures);
	obj.focus();
	return obj;
}
// ÆË¾÷ È­¸é »ý¼º
function popUpWindow_(url, popName, width, height, scroll, resizable){
	if( width == null || width == "" ) width = 600;
	if( height == null || height == "" ) height = 500;
	if( resizable == null || resizable == "" ) resizable = "yes";
	
	var left, top;
	top  = 0//(window.screen.height - height) / 2;
	left = 0//(window.screen.width  - width ) / 2;
	sFeatures = "width="+width+",height="+height+",left="+left+",top="+top+",resizable="+resizable;
	if(scroll == "yes") sFeatures += ",scrollbars=yes";
	else sFeatures += ",status=no,toolbar=no,menubar=no,location=no";

	var obj = window.open(url,popName,sFeatures);
	obj.focus();
	return obj;
}

/*
 * ÇÔ¼ö¸í : ImagePreview
 * ¼³  ¸í : ÀÌ¹ÌÁö ¹Ì¸®º¸±â
 * Çü  ½Ä : onChange="ImagePreview(this,'Photo')"  
 * ¿¹) <input type="file" name="imgfile" onChange="ImagePreview(this,'ÀÌ¹ÌÁöº¸¿©ÁÙÀ§Ä¡ID')">
 */
function ImagePreview(src,key) {
	
	if (navigator.product != "Gecko"){
		if (navigator.appVersion.indexOf("MSIE 8") > -1){
			document.getElementById(key).innerHTML = "<div align='center' style='font-size:11px'>¹Ì¸®º¸±â´Â<br>MS IE 7.0<br>ÀÌÇÏ¿¡¼­¸¸<br>°¡´ÉÇÕ´Ï´Ù.</div>";
			return;
		}
	}else{
		document.getElementById(key).innerHTML = "<div align='center' style='font-size:11px'>¹Ì¸®º¸±â´Â<br>MS IE°è¿­¸¸<br>°¡´ÉÇÕ´Ï´Ù.</div>";
		return;
	}

	if (src.value != ""){
		if(src.value.match(/\.(gif|jpg|jpeg|png)$/i)) {
		
			document.getElementById(key).innerText="";
			document.getElementById(key).style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src.value + "',sizingMethod=scale)";
		
		} else {
		
			document.getElementById(key).style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='',sizingMethod=scale)";
			
			alert("ÀÌ¹ÌÁö ÆÄÀÏ¸¸ ¿Ã·ÁÁÖ¼¼¿ä");
			//src.select();
			//document.selection.clear();
			
		}
	}
	
}


/*µ¦½ºÆ® ÆÄÀÏ¾÷·Îµå ±×·¡ÇÁ*/
function ShowProgress() { 
strAppVersion = navigator.appVersion; 
if (strAppVersion.indexOf('MSIE')!=-1 && 
strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4) {
//winstyle = "dialogWidth=385px; dialogHeight:150px; center:yes"; 
winstyle = "dialogWidth=385px; dialogHeight:150px; center:no"; 
window.showModelessDialog("/_Manager/include/dext/show_progress.asp?nav=ie", null, winstyle); 
}else { 
//winpos = "left=" + ((window.screen.width-380)/2)+",top="+((window.screen.height-110)/2);
winpos = "left=10,top=10";
winstyle="width=380,height=110,status=no,toolbar= no,menubar = no,location=no,resizable=no,scrollbars=no,copyhistory=no," + winpos; 
window.open("/_Manager/include/dext/show_progress.asp",null,winstyle); 
} 

return; 
}

/* ¿µ¿ª ÇÁ¸°Æ® ½ÃÀÛ */
/*
Body ÀüÃ¼¸¦ <DIV ID="objContents"></DIV> ·Î °¨½ÑÈÄ
¸Ç³¡¿¡ <DIV ID="objSelection"></DIV> Ãß°¡..
±×µÚ¿¡ ÇÁ¸°Æ®¿µ¿ª ÁöÁ¤
<DIV id="Print_DIV"></DIV> ¿µ¿ª¸¸ ÇÁ¸°Æ®
*/
function printDiv () { 
	if (document.all && window.print) { 
		window.onbeforeprint = beforeDivs; 
		window.onafterprint = afterDivs; 
		//window.print(); 
		Print(window);
	} 
} 

function beforeDivs () { 
	if (document.all) { 
		objContents.style.display = 'none'; 
		objSelection.innerHTML = document.all['Print_DIV'].innerHTML; 
	} 
} 

function afterDivs () { 
	if (document.all) { 
		objContents.style.display = 'block'; 
		objSelection.innerHTML = ""; 
	} 
} 


function SetPrintSettings() {
	factory.printing.header = "";			// Header¿¡ µé¾î°¥ ¹®Àå 
	factory.printing.footer = "";			// Footer¿¡ µé¾î°¥ ¹®Àå 
	factory.printing.portrait = true;		// true ¸é °¡·ÎÀÎ¼â, false ¸é ¼¼·Î ÀÎ¼â 
	factory.printing.leftMargin = 1.0;		// ¿ÞÂÊ ¿©¹é »çÀÌÁî 
	factory.printing.topMargin = 1.0;		// À§ ¿©¹é »çÀÌÁî 
	factory.printing.rightMargin = 1.0;		// ¿À¸¥ÂÊ ¿©¹é »çÀÌÁî 
	factory.printing.bottomMargin = 1.0;	// ¾Æ·¡ ¿©¹é »çÀÌÁî 
}

function Print(frame) {

	if ( !factory.object ) {
		if(confirm("ActiveX ¼³Ä¡ÈÄ ÀÎ¼âÇÏ½Ã°Ú½À´Ï±î?")){
			alert("ÀÎÅÍ³ÝÃ¢ »ó´ÜÀÇ ActiveX¸¦ ¼³Ä¡ÈÄ ÁøÇàÇÏ¿© ÁÖ½Ê½Ã¿ä.");
		}else{
			window.print();			
		}		
	}else{
		SetPrintSettings();
		if(confirm("¹Ì¸®º¸±âÈÄ ÀÎ¼âÇÏ½Ã°Ú½À´Ï±î?")){
			factory.printing.Preview();     // ÇöÀçÀ©µµ¸¦ ÇÁ¸°Æ®ÇÏ´Â¶æ(window´ë½Å¿¡ frameÀ» ÁöÁ¤ÇØÁÖ¸é ÇØ´ç ÇÁ·¹ÀÓÀ» Ãâ·ÂÇÕ´Ï´Ù.)
		}else{
			factory.printing.Print(true);     // ÇöÀçÀ©µµ¸¦ ÇÁ¸°Æ®ÇÏ´Â¶æ(window´ë½Å¿¡ frameÀ» ÁöÁ¤ÇØÁÖ¸é ÇØ´ç ÇÁ·¹ÀÓÀ» Ãâ·ÂÇÕ´Ï´Ù.)
		}
	}

}
/* ¿µ¿ª ÇÁ¸°Æ® Á¾·á */


function nextFocus(sFormName,sNow,sNext)
{
	var sForm = 'document.'+ sFormName +'.'
	var oNow = eval(sForm + sNow);

	if (typeof oNow == 'object')
	{
		if ( oNow.value.length == oNow.maxLength)
		{
			var oNext = eval(sForm + sNext);

			if ((typeof oNext) == 'object')
				oNext.focus();
		}
	}
}



/*** Æ÷Ä¿½º Å×µÎ¸® ³Ö±â ½ÃÀÛ ***/
document.write ("<style>.FocusLine{	border:#627dce 1px solid; }</style>");
function FocusIN(i, classname) {
	if (classname != ""){
		(i).className = 'FocusLine '+ classname ;
	}else{
		(i).style.border = '#627dce 1px solid';
	}
}
function FocusOUT(i, border, classname) {
	if (classname != ""){
		(i).className = classname;
	}else{
		(i).style.border = border;
	}
}

function linecss(){
	var obj = document.getElementsByTagName('input');
	var obj_txa = document.getElementsByTagName('textarea');
	for( e =0; e < obj.length; e++ ){
		var type = obj[e].getAttribute('type');
		if( type == 'text' || type == 'password' || type == 'file'){
			tmp = ""+obj[e].onfocus+"";

			tmp = tmp.replace("function onfocus()", "");		//ie8
			tmp = tmp.replace("function anonymous()", "");		//~ie7
			tmp = tmp.replace("{", "");
			tmp = tmp.replace("}", "");
			
			tmp2 = ""+obj[e].onblur+"";

			tmp2 = tmp2.replace("function onblur()", "");		//ie8
			tmp2 = tmp2.replace("function anonymous()", "");	//~ie7
			tmp2 = tmp2.replace("{", "");
			tmp2 = tmp2.replace("}", "");
			obj[e].onfocus = new Function ( ""+tmp+";"+"FocusIN(this, '"+ obj[e].className +"')" );
			obj[e].onblur = new Function ( ""+tmp2+";"+"FocusOUT(this,'"+ obj[e].style.border +"', '"+ obj[e].className +"')" );
		}
	}

	for( t =0; t < obj_txa.length; t++ ){
		if (obj_txa[t].style.display != "none") {
			tmp = ""+obj_txa[t].onfocus+"";

			tmp = tmp.replace("function onfocus()", "");		//ie8
			tmp = tmp.replace("function anonymous()", "");		//~ie7
			tmp = tmp.replace("{", "");
			tmp = tmp.replace("}", "");
			
			tmp2 = ""+obj_txa[t].onblur+"";

			tmp2 = tmp2.replace("function onblur()", "");		//ie8
			tmp2 = tmp2.replace("function anonymous()", "");	//~ie7
			tmp2 = tmp2.replace("{", "");
			tmp2 = tmp2.replace("}", "");
			
			obj_txa[t].onfocus = new Function ( ""+tmp+";"+"FocusIN(this, '"+ obj_txa[t].className +"')" );
			obj_txa[t].onblur = new Function ( ""+tmp2+";"+"FocusOUT(this,'"+ obj_txa[t].style.border +"', '"+ obj_txa[t].className +"')" );
		}
	}
	
	clearInterval(linecss_process);
}

var linecss_process = "";
linecss_process = setInterval('linecss()',1000);

/*** Æ÷Ä¿½º Å×µÎ¸® ³Ö±â Á¾·á ***/


/* »õ·Î°íÄ§, F1~F12 Â÷´Ü¸·±â*/
/*
document.onkeydown=KeyEventHandle;
document.onkeyup=KeyEventHandle;
*/
function KeyEventHandle() {
	if( 
		(event.ctrlKey == true && (event.keyCode == 78 || event.keyCode == 82)) 
		|| 
		(event.keyCode >= 112 && event.keyCode <= 123) 
	   )
	 { 

		event.keyCode = 0; 
		event.cancelBubble = true; 
		event.returnValue = false; 

	} 
}


//========= Email Check ½ºÅ©¸³Æ® =========
// »ç¿ë¹ý: return emailCheck(this) ÇüÅÂ·Î ¾²½Ã¸é µË´Ï´Ù.(Email ¿À·ù½Ã Æ÷Ä¿½º ÀÌµ¿)
// ÄÞ¸¶(',')¸¦ ±¸ºÐÀ¸·Î ¿©·¯°³ÀÇ ¸ÞÀÏÁÖ¼Ò¸¦ ÀÔ·ÂÇÒ ¶§´Â emailCheck(this, ',') ÇüÅÂ·Î ¾²½Ã¸é µË´Ï´Ù.
function emailCheck(_email, _delim) {
    var email = _email.value;
    var aidx = -1; // @ À§Ä¡
    var didx = -1; // . À§Ä¡
    var valid = true;
    var arrSpChSet= new Array(" ", "\"", "'", "#", "%"); // Ã¼Å©ÇÒ Æ¯¼ö¹®Á¦ ¼Â

    // ÀÔ·ÂÁ¤º¸°¡ ¾øÀ» °æ¿ì
    if(_email==null || email.length < 1) { return true; }
    if(_delim==null || _delim.length < 1) _delim = " ";

    var emails = email.split(_delim);

    for(var i=0; i < emails.length; i++) {
        email = emails[i];


		if (/^[_0-9a-zA-Z-]+(\.[_0-9a-zA-Z-]+)*@[0-9a-zA-Z-]+(\.)+([0-9a-zA-Z-]+)([\.0-9a-zA-Z-])*$/.test(email) == false){
            valid = false; break;
		}
    }

    // ÁÖ¼Ò°¡ Çü½Ä¿¡ ¸ÂÁö ¾ÊÀ» ¶§
    if(!valid) {
        alert("E-mail ( " + email + " )ÁÖ¼Ò°¡ Á¤È®ÇÏÁö ¾Ê½À´Ï´Ù!");
        _email.focus();
    }

    return valid;
}

//========= ÁÖ¹Îµî·Ï¹øÈ£ Check ½ºÅ©¸³Æ® =========
// »ç¿ë¹ý: Check_Jumin(frm.Jumin1, frm.Jumin2) ÇüÅÂ·Î ¾²½Ã¸é µË´Ï´Ù.
function Check_Jumin(ssn1, ssn2) {

	var chk =0;
	var yy  = ssn1.value.substring(0,2);
	var mm  = ssn1.value.substring(2,4);
	var dd  = ssn2.value.substring(4,6);
	var sex = ssn2.value.substring(0,1);

	// ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÚ¸®¼ö¿¡ ¸Â°Ô ÀÔ·ÂÇß´ÂÁö Ã¼Å©
	if (ssn2.value.split(" ").join("") == "") {
		alert ('ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇÏ½Ê½Ã¿À.');
		ssn1.focus();
		return false;
	}
	if (ssn1.value.length!=6) {
		alert ('ÁÖ¹Îµî·Ï¹øÈ£ ¾ÕÀÚ¸®¸¦ ÀÔ·ÂÇÏ½Ê½Ã¿À');
		ssn1.focus();
		return false;
	}
	if (ssn2.value.length != 7 ) {
		alert ('ÁÖ¹Îµî·Ï¹øÈ£ µÞÀÚ¸®¸¦ ÀÔ·ÂÇÏ½Ê½Ã¿À.');
		ssn2.focus();
		return false;
	}
	if (isNaN(ssn1.value) || isNaN(ssn2.value)) {
		ssn1.value = ""
		ssn2.value = ""
		alert('ÁÖ¹Îµî·Ï¹øÈ£´Â ¼ýÀÚ¸¸ °¡´ÉÇÕ´Ï´Ù.');
		return false;
	}
	if ((ssn1.value.length!=6)||(mm <1||mm>12||dd<1)){
		alert ('ÁÖ¹Îµî·Ï¹øÈ£ ¾ÕÀÚ¸®°¡ Àß¸øµÇ¾ú½À´Ï´Ù.');
		ssn1.focus();
		return false;
	}
	if ((sex != 1 && sex !=2 && sex !=3 && sex !=4 )||(ssn2.value.length != 7 )){
		alert ('ÁÖ¹Îµî·Ï¹øÈ£ µÞÀÚ¸®°¡ Àß¸øµÇ¾ú½À´Ï´Ù.');
		ssn2.focus();
		return false;
	}

	for (var i = 0; i <=5 ; i++) {
		chk = chk + ((i%8+2) * parseInt(ssn1.value.substring(i,i+1)))
	}
	for (var i = 6; i <=11 ; i++) {
		chk = chk + ((i%8+2) * parseInt(ssn2.value.substring(i-6,i-5)))
	}

	chk = 11 - (chk %11)
	chk = chk % 10

	if (chk != ssn2.value.substring(6,7)) {
		alert ('ÁÖ¹Îµî·Ï¹øÈ£°¡ Á¤È®ÇÏÁö ¾Ê½À´Ï´Ù.');
		ssn1.focus();
		return false;
	}
	
	return true;
}

/*°ø¹éÃ¼Å©*/
function checkSpace( str )
{
	if(str.search(/\s/) != -1){
		return 1;
	}else {
		return "";
	}
}
/** 
* string String::cut(int len)
* ±ÛÀÚ¸¦ ¾Õ¿¡¼­ºÎÅÍ ¿øÇÏ´Â ¹ÙÀÌÆ®¸¸Å­ Àß¶ó ¸®ÅÏÇÕ´Ï´Ù.
* ÇÑ±ÛÀÇ °æ¿ì 2¹ÙÀÌÆ®·Î °è»êÇÏ¸ç, ±ÛÀÚ Áß°£¿¡¼­ Àß¸®Áö ¾Ê½À´Ï´Ù.
*/
String.prototype.cut = function(len) {
	var str = this;
	var l = 0;
	for (var i=0; i<str.length; i++) {
		l += (str.charCodeAt(i) > 128) ? 2 : 1;
		if (l > len) return str.substring(0,i);
	}
	return str;
}

/** 
* bool String::bytes(void)
* ÇØ´ç½ºÆ®¸µÀÇ ¹ÙÀÌÆ®´ÜÀ§ ±æÀÌ¸¦ ¸®ÅÏÇÕ´Ï´Ù. (±âÁ¸ÀÇ length ¼Ó¼ºÀº 2¹ÙÀÌÆ® ¹®ÀÚ¸¦ ÇÑ±ÛÀÚ·Î °£ÁÖÇÕ´Ï´Ù)
*/
String.prototype.bytes = function() {
	var str = this;
	var l = 0;
	for (var i=0; i<str.length; i++) l += (str.charCodeAt(i) > 128) ? 2 : 1;
	return l;
}


var is=false;
function ImgResize(str, size){
	
	if(is==false){
		if(document.getElementById(str).width > size){
			document.getElementById(str).width = size;
		}
	}
	is=true;
}




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_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_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 _ID(obj){return document.getElementById(obj)}


//ÇÑ±ÛÀÔ·Â Ã¼Å©
//¿¹) if(!checkHangulChar(chk_name)) return;
function checkHangulChar(chk_name){
	if (/^[°¡-Èþ]{0,}$/.test(chk_name.value) == false){
	   alert("ÇÑ±Û·Î¸¸ ÀÔ·ÂÇÏ½Ê½Ã¿ä.\n°ø¹éÀÌ³ª Æ¯¼ö¹®ÀÚ´Â ÀÔ·ÂÇÒ ¼ö ¾ø½À´Ï´Ù.");
	   chk_name.focus();
	   chk_name.select();
	   return false;
	}
	return true;
}
function isHangul(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 addCashComma(obj)
{
	var isMinus = false;
	if(obj.value.indexOf("-") != -1 ){
		obj.value = obj.value.substring(obj.value.indexOf("-")+1)
		isMinus = true;
	}
	var numValue = ""+delCashComma(obj);
	var cashReturn = "";
	for (var i = numValue.length-1; i >= 0; i--){
		cashReturn = numValue.charAt(i) + cashReturn;
		if (i != 0 && i%3 == numValue.length%3) cashReturn = "," + cashReturn;
	}
	if(isMinus){
		obj.value = "-"+cashReturn;
	}else{
		obj.value = cashReturn;
	}
}

function delCashComma(obj)
{
	var numValue = obj.value;
	obj.value =  replace(numValue,",","");
	return obj.value;
}


function addCashComma2(obj)
{
	var isMinus = false;
	if(obj.indexOf("-") != -1 ){
		obj = obj.substring(obj.indexOf("-")+1)
		isMinus = true;
	}
	var numValue = ""+delCashComma2(obj);
	var cashReturn = "";
	for (var i = numValue.length-1; i >= 0; i--){
		cashReturn = numValue.charAt(i) + cashReturn;
		if (i != 0 && i%3 == numValue.length%3) cashReturn = "," + cashReturn;
	}
	
	if(isMinus){
		obj = "-"+cashReturn;
	}else{
		obj = cashReturn;
	}
	
	return obj;
}

function delCashComma2(obj)
{
	var numValue = obj;
	obj =  replace(numValue,",","");
	return obj;
}

/**
 *  ¹®ÀÚ¿­¿¡ ÀÖ´Â Æ¯Á¤¹®ÀÚÆÐÅÏÀ» ´Ù¸¥ ¹®ÀÚÆÐÅÏÀ¸·Î ¹Ù²Ù´Â ÇÔ¼ö.
 */
function replace(targetStr, searchStr, replaceStr)
{
	var len, i, tmpstr;
	len = targetStr.length;
	tmpstr = "";
	for ( i = 0 ; i < len ; i++ ) {
		if ( targetStr.charAt(i) != searchStr ) {
			tmpstr = tmpstr + targetStr.charAt(i);
		}
		else {
			tmpstr = tmpstr + replaceStr;
		}
	}
	return tmpstr;
}











/*** ÀÌµ¿·¹ÀÌ¾î °ü·Ã : start ***/
var appname = navigator.appName.charAt(0);
var move_type = false;
var divpop_id;

 function Start_move(e,thisID){
	 var event = e || window.event;
	 divpop_id = thisID;
	 //ÀÍ½º
	 if( appname == "M" ){
		 target_Element = event.srcElement;
	}else{ //ÀÍ½º¿Ü
		if (event.which !=1){
			return false;
		}
		else{
			move_type = true;
			target_Element = event.target;
		}
	}

	move_type = true;
	Move_x = event.clientX;
	Move_y = event.clientY;
	if( appname == "M" ) target_Element.onmousemove = Moveing;
	else document.onmousemove = Moveing;
 }


 function Moveing(e){
	var event = e || window.event;

	if(move_type == true){
		var Nowx = event.clientX - Move_x;
		var Nowy = event.clientY - Move_y;
		var targetName = document.getElementById(divpop_id);
		targetName.style.left = int_n(targetName.style.left) + Nowx;
		targetName.style.top = int_n(targetName.style.top) + Nowy;
		Move_x = event.clientX;
		Move_y = event.clientY;
		return false;
	}
 }

 function Moveing_stop(){
	move_type =  false;
}

function int_n(cnt){
	if( isNaN(parseInt(cnt)) == true ) var re_cnt = 0;
	else var re_cnt = parseInt(cnt);
	return re_cnt;
}

document.onmouseup = Moveing_stop;


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
}

/*** ÀÌµ¿·¹ÀÌ¾î °ü·Ã : end ***/

/*** Cookie »ý¼º ***/
function setCookie( name, value, expiredays ){ 
    var todayDate = new Date(); 
    todayDate.setDate( todayDate.getDate() + expiredays ); 
    document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";" 
} 

/*** 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 arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
		 return getCookieVal (j); 
		i = document.cookie.indexOf(" ", i) + 1; 
		if (i == 0) break;
	} 
	return null;
} 

function getCookieVal (offset) {
	var endstr = document.cookie.indexOf (";", offset); 
	if (endstr == -1)
		endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
} 
/*** Cookie ÄÁÆ®·Ñ ***/
function PopupLayerClose( name, cookiename, elemnt ){

	if ( elemnt.checked ){
		setCookie( cookiename, 'done', 1 );
		setTimeout( "_ID('" + name + "').style.display='none'" );
	}

	return;
}



/* ÀÔ·Â ÅØ½ºÆ®ÀÇ ¹ÙÀÌÆ® ¼ö Ã¼Å©
 * ¿¹) if(!check_msglen(frm.htl_comid, 15, "°ø±Þ¾÷Ã¼ »óÇ°ÄÚµå")) return;
 */
function check_msglen(obj, maxlen, objName)
{
    if(objName == null) objName = obj.name;
    var length = calculate_msglen(obj.value);
    if (length > maxlen) {
        alert("[" + objName + "]Àº(´Â) ÃÖ´ë " + maxlen + " Bytes±îÁö ¾µ¼ö ÀÖ½À´Ï´Ù.\nÇöÀç " + length + " Bytes¸¦ »ç¿ëÇÏ¿´½À´Ï´Ù.");
        obj.select();
        obj.focus();
        return false;
    }
    return true;
}


/* ÀÔ·Â ÅØ½ºÆ®ÀÇ ¹ÙÀÌÆ® ¼ö °è»êÇÏ±â
 * ¿¹) var len = calculate_msglen(obj.value);
 */
function calculate_msglen(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 == '\n') {
			if (message.charAt(i-1) != '\r') {
				nbytes += 1;
			}
		} else if (ch == '<' || ch == '>') {
			nbytes += 4;
		} else {
			nbytes += 1;
		}
	}

	return nbytes;
}

function getCheckedValue(chk, diffLetter){
	var rtnValue="";


if (chk == null){ return ""; }
	if (diffLetter == null || diffLetter == ""){
		diffLetter="|";
	}
	
	var chkLen = chk.length;
	if (chk.length==null){
		chkLen = 1;
	}
	for (i=0; i< chkLen;i++){
		if(parseInt(chkLen)==1){
			if(chk.checked){
				rtnValue = rtnValue+chk.value;
				rtnValue = rtnValue+diffLetter;
			}
		}else {
			if(chk[i].checked){
				rtnValue = rtnValue+chk[i].value;
				rtnValue = rtnValue+diffLetter;
			}
		}
	}
	//¸Ç¿ìÃø¿¡ ºÙÀº ±¸ºÐÀÚ Á¦°ÅÇÏ±â
	if (rtnValue.length >= 1 ) {
			if (rtnValue.lastIndexOf(diffLetter) != -1){
					rtnValue = rtnValue.substring(0,rtnValue.length-1);
			}
	}
	return rtnValue;
	
}

//ºñ±³ »óÇ° ¼ö Ã¼Å©
//ex) onclick='return ItemCompareChkCnt(frmList.chk)'
function ItemCompareChkCnt (chk) { 
	var chkLen = getCheckedCount(chk);
	if(chkLen > 2){
			alert("2°³ ÀÌ»ó »óÇ°Àº ºñ±³ ÇÒ ¼ö ¾ø½À´Ï´Ù.");
			return false;
	}
	return true;
}



function addCashComma_(obj)
{
	var isMinus = false;
	/*
	if(obj.indexOf("-") != -1 ){
		obj = obj.substring(obj.indexOf("-")+1)
		isMinus = true;
	}
	*/
	var numValue = ""+obj;
	var cashReturn = "";
	for (var i = numValue.length-1; i >= 0; i--){
		cashReturn = numValue.charAt(i) + cashReturn;
		if (i != 0 && i%3 == numValue.length%3) cashReturn = "," + cashReturn;
	}
	if(isMinus){
		obj = "-"+cashReturn;
	}else{
		obj = cashReturn;
	}
	
	return obj;
}

function test123(){
	alert(123);
}
