//document.domain »ç¿ëÇÏÁö ¸¶¼¼¿ä Á¦¹ß~~~ 
//document.domain = "et-house.com";
//document.all.domain = "et-house.com";

var sait_domain = "http://file.et-house.com";

function openWin(dir,inputname,form1,file_seq){
	window.open("/Ne_common/pop_fileattach.asp?dir="+dir+"&inputName="+inputname+"&file_seq="+file_seq+"&openerform="+form1,"filepopup","scrollbars=yes,resizable=no,status=yes,width=460,height=243,left=0,top=0");
}


function openWinImage(dir,inputname,form1,file_seq){
	window.open("/Ne_common/upload_image.asp?dir="+dir+"&inputName="+inputname+"&file_seq="+file_seq+"&openerform="+form1,"filepopup","scrollbars=yes,resizable=no,status=yes,width=360,height=300,left=0,top=0");
}



function setfname(fname, inputname, form_name){
		frmtarget = eval("document."+form_name+"." + inputname);
		frmtarget.value = fname;
  }


function showMSG(img,view,msg){
	if(img){
		sMSG.innerHTML="<table border=0 cellpadding=2 cellspacing=0 width=200><tr><td><img src='"+img+"' width=200 border=0><td></tr><tr><td>"+msg+"</td></tr></table>";
	}else{
		sMSG.innerHTML="";
	}

	sMSG.style.pixelLeft=event.clientX+15;
	sMSG.style.pixelTop=event.clientY+15+document.body.scrollTop;

	if(view) sMSG.style.display="block";
	else sMSG.style.display="none";
}

function moveMSG(){
	sMSG.style.pixelLeft=event.clientX+15;
	sMSG.style.pixelTop=event.clientY+15+document.body.scrollTop;
}


function hasCheckedRadio(input) {
    if (input.length > 1) {
        for (var inx = 0; inx < input.length; inx++) {
            if (input[inx].checked) return true;
        }
    } else {
        if (input.checked) return true;
    }
    return false;
}

function download(d_file){
	var nUrl = sait_domain+"/ne_common/download.asp?contets_file="+d_file;
	window.open(nUrl,'filedownload','width=1,height=1,left=10000,top=10000');

}


/*-------------------------------------------------------------------------------------------------------------*/


/*
	* 2005-03-25
	* ¹è½ÂÁø
	* ÀÌ¹ÌÁö ¿øº» »çÀÌÁî·Î º¸¿©ÁÖ±â
*/
function popView(file_path){
	window.open("/common/pop_img.php?file_path="+file_path,"","width=500,height=500,scrollbars=yes");
}
/**ÆË¾÷Ã¢ ¶ç¿ì±â*/
function pop(url,name,w,h){ window.open(url,name,'width='+w+',height='+h+',scrollbars=no') } //Popup(½ºÅ©·Ñ¹Ù¾øÀ½)
function pops(url,name,w,h){ window.open(url,name,'width='+w+',height='+h+',scrollbars=yes') } //Popup(½ºÅ©·Ñ¹ÙÀÖÀ½)

/** 
* 2005-02-17 ¹è½ÂÁø 
* ÇØ´ç ÆÄÀÏ ÀÌ¹ÌÁö¿Í ³»¿ë º¸¿©ÁÖ±â
*/
function showMSG2(img,view,msg,imgsize){
	if(img){
		if(imgsize == "s"){
			sMSG.innerHTML="<table border=0 cellpadding=2 cellspacing=0 width=100><tr><td><img src='"+img+"' width=100 border=0><td></tr><tr><td>"+msg+"</td></tr></table>";
		}
		else 	sMSG.innerHTML="<table border=0 cellpadding=2 cellspacing=0 width=200><tr><td><img src='"+img+"' width=200 border=0><td></tr><tr><td>"+msg+"</td></tr></table>";
	}else{
		sMSG.innerHTML="";
	}

	sMSG.style.pixelLeft=event.clientX+15;
	sMSG.style.pixelTop=event.clientY+15+document.body.scrollTop;

	if(view) sMSG.style.display="block";
	else sMSG.style.display="none";
}



// isBlank °ø¹é¿©ºÎ È®ÀÎ (°´Ã¼ÀÌ¸§,¸Þ¼¼Áö³»¿ë,Æ÷Ä¿½º»ç¿ëY/N)

function isBlank(strName,strMsg,useFocus)
{

	if (strName.value.trim())

	{ return false; }

	else

	{

		alert(strMsg);

		if ( useFocus == 'Y' )

		{

			cmd_focus(strName);

		}

		return true;

	}

}

// radio, checkbox¿Í °°Àº input formÀÇ Ã¼Å©¿©ºÎ

function isChecked(strName,strMsg,useFocus)

{

	var blockFlag = true;

	for(i = 0; i < strName.length; i++)

		if( strName[i].checked )

			blockFlag = false;

	if ( blockFlag )

	{

		alert(strMsg);

		if ( useFocus == 'Y' )
			cmd_focus(strName[0]);

		return false;

	}

	else

		return true;

}


// ¾ÕµÚ °ø¹é¹®ÀÚ ¾ø¾Ö±â

String.prototype.trim = function()

{

	return this.replace(/(^\s*)|(\s*$)/g, "");

}



// E-mail °ø¹é¿©ºÎ È®ÀÎ (°´Ã¼ÀÌ¸§,BlankÃ¼Å©Y/N,Æ÷Ä¿½º»ç¿ëY/N)

function isEmail(strEmail,useBlank,useFocus)

{
	if ( useBlank == 'Y' )

	{

		if (isBlank(strEmail,'¸ÞÀÏÀ» ÀÔ·ÂÇÏ¼¼¿ä','Y'))

		{

			return false;

		}

	}

	if (chkEmail(strEmail.value))

	{

		return true;

	}

	else

	{

		alert(strEmail.value + ' (Àº)´Â Àß¸øµÈ E-Mail Çü½Ä ÀÔ´Ï´Ù');

		if (useFocus == 'Y')

		{

			cmd_focus(strEmail);

		}

		return false;

	}

}


// E-mail Ã¼Å© (Email)

function chkEmail(strEmail)

{

	var pos = strEmail.indexOf("@");

	if (pos == -1 || pos == 0)

		return false;

	var value = strEmail.split("@");

	if (value[1].length < 1)

		return false;

	var domain = value[1].split(".");

	if (domain.length < 2 || domain[1].length < 1)

		return false;

	return true;

}


// ÁÖ¹Î¹øÈ£ °ø¹é¿©ºÎ È®ÀÎ (°´Ã¼ÀÌ¸§,BlankÃ¼Å©Y/N,Æ÷Ä¿½º»ç¿ëY/N)

function isJno(strJno1, strJno2,useBlank,useFocus)

{

	if ( useBlank == 'Y' )

	{

		if (isBlank(strJno1,'ÁÖ¹Î¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä','Y'))

		{

			return false;

		}

	}

	if (chkJno(strJno1.value,strJno2.value))
	{

		return true;

	}

	else

	{

		alert(strJno1.value + ' - ' +strJno2.value + ' (Àº)´Â Àß¸øµÈ ÁÖ¹Îµî·Ï¹øÈ£ ÀÔ´Ï´Ù');

		if (useFocus == 'Y')

		{

			strJno1.value = '';

			strJno2.value = '';

			strJno1.focus();

		}

		return false;

	}

}



// ÁÖºó¹øÈ£ Ã¼Å©

function chkJno(valueJno1, valueJno2)

{
	var ssno = valueJno1+ "-" + valueJno2;

	if (isNaN(parseInt(valueJno1))) return false;

	if (isNaN(parseInt(valueJno2))) return false;

	tval=ssno.charAt(0)*2 + ssno.charAt(1)*3 + ssno.charAt(2)*4

		+ ssno.charAt(3)*5 + ssno.charAt(4)*6 + ssno.charAt(5)*7

		+ ssno.charAt(7)*8+ ssno.charAt(8)*9 + ssno.charAt(9)*2

		+ ssno.charAt(10)*3 + ssno.charAt(11)*4 + ssno.charAt(12)*5;

	tval2=11- (tval % 11);

	tval2=tval2 % 10;

	if (ssno.charAt(13)==tval2 &&  (ssno.charAt(7)=="1" ||ssno.charAt(7)=="2"))

		return true;

	else

		return false;

}



//¼ýÀÚ ÀÔ·Â

function isNo(strName,useBlank,msgBlank,useFocus)

{
	if ( useBlank == 'Y')

	{

		if (isBlank(strName,msgBlank,'Y'))

		{

			return false;

		}

	}



	if (!isNaN(strName.value))

	{

		return true;

	}

	else

	{

		alert('¼ýÀÚ¸¸ ÀÔ·ÂÇÒ ¼ö ÀÖ½À´Ï´Ù');

		if (useFocus == 'Y')

		{

			cmd_focus(strName);

		}

	}

}




// ¿µ¹®,¼ýÀÚ°ª¸¸ ¹ÝÈ¯

function isEngNo(strName,useFocus)

{

var chkStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";

var strValue = strName.value;

	for (i=0; i<strValue.length; i++)

	{

		idcheck = strValue.charAt(i);

		for (j=0;  j< chkStr.length; j++)

		if (idcheck == chkStr.charAt(j))
		break;

		if( j == chkStr.length)

		{

		alert("¿µ¹®ÀÚ ¶Ç´Â ¼ýÀÚ¸¸ °¡´ÉÇÕ´Ï´Ù.");

			if (useFocus == 'Y')

			{

				cmd_focus(strName);

			}

			return false;

		}

	}

	return true;

}



// Æ÷Ä¿½º

function cmd_focus(strName)

{

	strName.value = '';

	strName.focus();

}



// ¹®ÀÚ¿­ ±æÀÌ

function getLenStr(strName)

{

var strValue = strName.value;

var cntStr;

cntStr = 0;

	for (i=0;  i<strValue.length; i++)

	{

		if(is2Byte(strValue.charAt(i)))

		{cntStr = Number(cntStr + 2)}

		else

		{cntStr = Number(cntStr + 1)}

	}

	return cntStr;

}



// ¿øÇÏ´Â ¹®ÀÚ¿­ ±æÀÌ Ã¼Å©

function chkLenStr(strName,strLen,useFocus)

{

var strValue = strName;

	if(getLenStr(strValue)>=strLen)

	{

		alert('ÀÔ·ÂÇÑ ¹®ÀÚÀÇ ±æÀÌ´Â ÃÑ ' + (strLen-1) + ' Byte¸¦ ³ÑÀ» ¼ö ¾ø½À´Ï´Ù');

		if (useFocus == 'Y')

		{

			cmd_focus(strName);

			return false;

		}
	}

			return true;

}




// 2Byte ¹®ÀÚ Ã¼Å© true ¹ÝÈ¯

function is2Byte(str)

{

var i;

var ch;



	for (i=0;i<str.length;i++)
	{

		ch = escape(str.charAt(i));        //ISO-Latin-1 ¹®ÀÚ¼ÂÀ¸·Î º¯°æ

		if (chkByte(ch) != 2)

		{

			return false;

		}

	}

return true;

}



function chkByte(strCh)

{

	if (strCh.substring(0, 2) == '%u')

	{

		if (strCh.substring(2,4) == '00')

		{	return 1; }

		else

		{	return 2; }       //ÇÑ±Û

	}

	else if (strCh.substring(0,1) == '%')

	{

		if (parseInt(strCh.substring(1,3), 16) > 127)

		{	return 2; }        //ÇÑ±Û

		else

		{	return 1; }

	}

	else

	{

		return 1;

	}
}

function goLocationUrl(url) {
	if (url == undefined) {
		url = "http://www.et-house.com/";
	}
	location.href = url;
}


function goOpenUrl(url,size,scroll) {
	if (url == undefined) { url = "http://www.et-house.com/"; }
	if (scroll == undefined) { scroll = "0"; }
	if (size != undefined) {
		var splitS = size.split(",");
		var ws = splitS[0];
		var hs = splitS[1];
		if (scroll == "0") {
			window.open(url,"","width="+ws+",height="+hs);
		} else {
			window.open(url,"","width="+ws+",height="+hs+",scrollbars=1");
		}
	} else {
		window.open(url,"","");
	}
}

function fncAct(nextUrl) {
	document.addInfoForm.action = nextUrl;
	document.addInfoForm.submit();
}

function actLogin() {
	var pForm = document.loginForm;
	if(pForm.userid.value == "") {
		alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		pForm.userid.focus();
		return;
	}
	if(pForm.passwd.value == "") {
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		pForm.passwd.focus();
		return;
	}

	pForm.submit();
}

function fncCMAct(nextUrl) {
	document.glLoginForm.action = nextUrl;
	document.glLoginForm.submit();
}