// TOP FLASH MENU **************************************************************
/////»ý»êÇ°°ú ¼Ö·ç¼Ç****************
function ClickEMenu01_01()								//°³ÀÎ»óÇ°
{
	location.href ="/USR_main.asp??=PRODUCTS/personal";
}
function ClickEMenu01_02()								//±â¾÷»óÇ°
{
	location.href ="/USR_main.asp??=PRODUCTS/business01";
}

/////¼­ºñ½º****************
function ClickEMenu02_01()								//°³ÀÎ¼­ºñ½º
{
	location.href ="/USR_main.asp??=SERVICE/personal";
}
function ClickEMenu02_02()								//±â¾÷¼­ºñ½º
{
	location.href ="/USR_main.asp??=SERVICE/business";
}
/////IR****************
function ClickEMenu03_01()								//IRÀÚ·á
{
	location.href ="/USR_main.asp??=IR/IR01/list";
}
function ClickEMenu03_02()								//ÅõÀÚ¾È³»
{
	location.href ="/USR_main.asp??=IR/INVESTOR/list";
}
function ClickEMenu03_03()								//ÁÖÁÖ¾È³»
{
	location.href ="/USR_main.asp??=IR/SHAREOWNER/list";
}
/////±â¾÷½Ã¹Î****************
function ClickEMenu04_01()								//NWS±Û·Î¹ú±â¾÷½Ã¹Î
{
	location.href ="/USR_main.asp??=CITIZENSHIP/citizenship";
}
/////company****************
function ClickEMenu05_01()								//È¸»ç°³¿ä
{
	location.href ="/USR_main.asp??=NWS/nws01";
}
function ClickEMenu05_02()								//»ç¾÷¿µ¿ª
{
	location.href ="/USR_main.asp??=NWS/nws02";
}
function ClickEMenu05_03()								//±â¾÷¼Ò½Ä
{
	location.href ="/USR_main.asp??=NWS/NOTICE/list";
}
function ClickEMenu05_04()								//¿¬Çõ
{
	location.href ="/USR_main.asp??=NWS/nws03";
}
function ClickEMenu05_05()								//PR
{
	location.href ="/USR_main.asp??=NWS/NEWS01/list";
}
/////Å¾¸Þ´º****************
function ClickMenu_contact()								//contact us
{
	location.href ="/USR_main.asp??=MAIN/index";
}
function ClickMenu_english()								//english
{
	location.href ="/USR_main.asp??=MAIN/index";
}

// ¼ýÀÚ¸¸ ÀÔ·Â (INPUT) *********************************************************
function num_only()
{
	if((event.keyCode < 48) || (event.keyCode > 57))
	{
		event.returnValue=false;
	}
}


// ÁÖ¹Îµî·Ï¹øÈ£ Ã¼Å© ***********************************************************
function numbercheck(theform)
{
	var chk	= 0;
	var yy	= theform.id_no1.value.substring(0,2);
	var mm	= theform.id_no1.value.substring(2,4);
	var dd	= theform.id_no1.value.substring(4,6);
	var sex	= theform.id_no2.value.substring(0,1);

	// ÁÖ¹Îµî·Ï¹øÈ£ Ã¼Å©
	for (var i = 0; i <= 5 ; i++)
	{
		chk = chk + ((i % 8 + 2) * parseInt(theform.id_no1.value.substring(i, i + 1)));
	}
	for (var i = 6; i <= 11 ; i++)
	{
		chk = chk + ((i % 8 + 2) * parseInt(theform.id_no2.value.substring(i - 6, i - 5)));
	}
	chk = 11 - (chk % 11);
	chk = chk % 10;

	if (chk != theform.id_no2.value.substring(6, 7))
	{
		alert ("À¯È¿ÇÏÁö ¾ÊÀº ÁÖ¹Îµî·Ï¹øÈ£ÀÔ´Ï´Ù.");
		theform.id_no1.value = "";
		theform.id_no1.focus();
		return false;
	}

	else if ((theform.id_no1.value.length != 6) || (yy < 25 || mm < 1 || mm >12 || dd < 1))
	{
		alert ("ÁÖ¹Îµî·Ï¹øÈ£°¡ Àß¸øµÇ¾ú½À´Ï´Ù.");
		theform.id_no1.value = "";
		theform.id_no1.focus();
		return false;
	}

	else if ((sex != 1 && sex !=2 )||(theform.id_no2.value.length != 7 ))
	{
		alert ("ÁÖ¹Îµî·Ï¹øÈ£°¡ Àß¸øµÇ¾ú½À´Ï´Ù.");
		theform.id_no2.value = "";
		theform.id_no2.focus();
		return false;
	}

	else
		return true;
}


// ÀÌ¸ÞÀÏ ÁÖ¼Ò Ã¼Å© ************************************************************
function email_chk(email_input)
{
	var email = email_input.value;
	var invalidChars = "\"|&;<>!*\'\\"   ;
	for (var i = 0; i < invalidChars.length; i++)
	{
		if (email.indexOf(invalidChars.charAt) != -1)
		{
			alert("Àß¸øµÈ ÀÌ¸ÞÀÏ ÁÖ¼ÒÀÔ´Ï´Ù.");
			email_input.value = "";
			email_input.focus();
			return false;
		}
	}
	if (email.indexOf("@") == -1)
	{
		alert("Àß¸øµÈ ÀÌ¸ÞÀÏ ÁÖ¼ÒÀÔ´Ï´Ù. '@'°¡ ¾ø½À´Ï´Ù..");
		email_input.value = "";
		email_input.focus();
		return false;
	}
	if (email.indexOf(" ") != -1)
	{
		alert("Àß¸øµÈ ÀÌ¸ÞÀÏ ÁÖ¼ÒÀÔ´Ï´Ù.");
		email_input.value = "";
		email_input.focus();
		return false;
	}
	if (window.RegExp)
	{
		var reg1str = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
		var reg2str = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$";
		var reg1 = new RegExp (reg1str);
		var reg2 = new RegExp (reg2str);

		if (reg1.test(email) || !reg2.test(email))
		{
			alert("Àß¸øµÈ ÀÌ¸ÞÀÏ ÁÖ¼ÒÀÔ´Ï´Ù.");
			email_input.value = "";
			email_input.focus();
			return false;
		}
	}
}


// ¼ýÀÚÆ÷¸Ë (,) ³Ö±â ***********************************************************
function number_format(number)
{
	unit		= 3;
	i			= 0;
	rst			= '';
	number		= number + '';
	len			= number.length;
	arr			= new Array(len);

	while(i <len){
		arr[i]	= number.charAt(len-i-1);
		rst		= arr[i] + rst;
		i++;
		if(i % unit == 0 && i != len)
			rst	= ',' + rst;
	}
	return rst;
}


// TRIM ************************************************************************
function trim(str)
{
	str += '';				// ¼ýÀÚ¶óµµ ¹®ÀÚ¿­·Î º¯È¯
	return str.replace(/^\s*|\s*$/g, '');
}


// ÁÖ¼ÒÃ£±â ********************************************************************
function popup_addressCheck(formName, siName, dongName, moreName, zipCodeName)
{
	var win = "/LIBS/TOOLKIT/NWS_address/address.asp?formName="+ formName +"&siName="+ siName +"&dongName="+ dongName +"&moreName="+ moreName +"&zipCodeName="+ zipCodeName;
	window.open(win, "address", "width=470, height=568, left=200, top=200, scrollbars=yes");
}


// ÁÖ¼ÒÃ£±â 2 ******************************************************************
function popup_addressCheck2(formName, siName, guName, dongName, moreName, zipCodeName)
{
	var win = "/LIBS/TOOLKIT/NWS_address/address2.asp?formName="+ formName +"&siName="+ siName +"&guName="+ guName +"&dongName="+ dongName +"&moreName="+ moreName +"&zipCodeName="+ zipCodeName;
	window.open(win, "address", "width=470, height=568, left=200, top=200, scrollbars=yes");
}

// ¾ÆÀÌµð Ã¼Å© *****************************************************************
function checkid(formName, usr_id)
{
	if(document.frm.usr_id.value == "")
		alert("ID¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä");
	else
	{
		var id		= eval(formName +"."+ usr_id +".value");
		var win		= "none.asp??=JOIN/POPUP/id_check&formName="+ formName +"&usr_id="+ id;
		window.open(win, "id_check", "width=420, height=253, left=200, top=200");
	}
}

// ÀÌ¹ÌÁö Å©°Ôº¸±â *************************************************************
function popup_enlarge(item_idx)
{
	var url = 'none.asp??=item/popup_enlarge&item_idx=' + item_idx;
	window.open(url, "enlarge", "width=683, height=545");
}

// ·Î±×ÀÎ **********************************************************************
function login()
{
	var win = "none.asp??=PASSPORT/member_login&mode=login";
	window.open(win, "login", "left=20, top=25, width=440, height=320");
}

// ¾ÆÀÌµð Ã£±â *****************************************************************
function idsearch()
{
	var win = "none.asp??=PASSPORT/id_search";
	window.open(win, "login", "left=20, top=25, width=440, height=320");
}

// File Upload Ã¢ ¶ç¿ì±â *******************************************************
function popup_upload(formName, inputName)
{
	var win = '/LIBS/TOOLKIT/NWS_upload/fileselect.asp?formName='+ formName +'&imageName='+ inputName;
	window.open(win, 'popup', 'width=440, height=320');
}

// ¸¶ÀÌÆäÀÌÁö Á¶È¸³¯Â¥ º¯°æ ****************************************************
function change_date(str_date)
{
	var date	= new Date();

	var today_year		= date.getFullYear();
	var today_month		= date.getMonth() + 1;
	var today_day		= date.getDate();

	if (("" + today_month).length == 1)
		today_month		= "0" + today_month;
	if (("" + today_day).length == 1)
		today_day		= "0" + today_day;

	document.frm.from_year.value	= str_date.substring(0, 4);
	document.frm.from_month.value	= str_date.substring(5, 7);
	document.frm.from_day.value		= str_date.substring(8, 10);
	document.frm.to_year.value		= today_year;
	document.frm.to_month.value		= today_month;
	document.frm.to_day.value		= today_day;
}


// ·¹ÀÌ¾î View or Hidden *******************************************************
function show_layer(lname)
{
	var layer = (navigator.appName == 'Netscape') ? document.layers[lname] : document.all[lname];
	if (lname == '') return;
	if (navigator.appName == 'Netscape') layer.visibility = 'show';
	else layer.style.visibility = 'visible';
}

function hide_layer(lname)
{
	if (lname)
	{
		var layer = (navigator.appName == 'Netscape') ? document.layers[lname] : document.all[lname];
		if (navigator.appName == 'Netscape') layer.visibility = 'hide';
		else layer.style.visibility = 'hidden';
	}
	else
	{
		for (i = 1 ; i <= 10 ; i ++)
		{
			var lname = 'layer'+i;
			var layer = (navigator.appName == 'Netscape') ? document.layers[lname] : document.all[lname];
			if (navigator.appName == 'Netscape') layer.visibility = 'hide';
			else layer.style.visibility = 'hidden';
		}
	}
}


// TOPMENU »óÇ° °Ë»ö ***********************************************************
function checkform_top_search(theform)
{
	if (theform.search_value1.value == "")
	{
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		theform.search_value1.focus();
		return false;
	}
//	else if (theform.search_value1.value.length < 3)
//	{
//		alert("°Ë»ö¾î´Â 3ÀÚ ÀÌ»óÀÌ¾î¾ß ÇÕ´Ï´Ù.");
//		theform.search_value1.focus();
//		return false;
//	}
}


// ÀÌ¹ÌÁö Å©±â Á¶ÀýÇÏ¿© img ÅÂ±× Ãâ·Â ******************************************
function change_image_size(image_url, limit_width, limit_height)
{
	imgFile					= new Image();
	imgFile.src				= image_url;

	var real_width			= imgFile.width;
	var real_height			= imgFile.height;

	if (real_width >= real_height)
	{
		if (real_width <= limit_width)
		{
			result_width	= real_width;
			result_height	= real_height;
		}
		else
		{
			result_width	= limit_width;
			result_height	= parseInt((real_height * limit_width) / real_width);
		}
	}
	else
	{
		if (real_height <= limit_height)
		{
			result_width	= real_width;
			result_height	= real_height;
		}
		else
		{
			result_width	= parseInt((real_width * limit_height) / real_height);
			result_height	= limit_height;
		}
	}

	document.write ("<img src='"+ image_url +"' width='"+ result_width +"' height='"+ result_height +"' border='0' style='cursor:hand' onclick='showPicture(\""+ image_url +"\")'>");
}


// ÀÌ¹ÌÁö Á¦Å©±â·Î ÆË¾÷Ã¢ ¶ç¿ì±â ***********************************************
function showPicture(src)
{
	var imgObj = new Image();
	imgObj.src = src;
	var wopt = "scrollbars=no,status=no,resizable=no";
	wopt += ",width=" + imgObj.width;
	wopt += ",height=" + imgObj.height;
	var wbody = "<head><title>»çÁø º¸±â</title>";
	wbody += "<s"+"cript language='javascript'>";
	wbody += "function finalResize(){";
	wbody += "  var oBody=document.body;";
	wbody += "  var oImg=document.images[0];";
	wbody += "  var xdiff=oImg.width-oBody.clientWidth;";
	wbody += "  var ydiff=oImg.height-oBody.clientHeight;";
	wbody += "  window.resizeBy(xdiff,ydiff);";
	wbody += "}";
	wbody += "</"+"script>";
	wbody += "</head>";
	wbody += "<body onLoad='finalResize()' style='margin:0'>";
	wbody += "<a href='javascript:window.close()'><img src='" + src + "' border=0></a>";
	wbody += "</body>";
	winResult = window.open("about:blank","",wopt);
	winResult.document.open("text/html", "replace");
	winResult.document.write(wbody);
	winResult.document.close();
	return;
}


// input or textarea OnFocus ³»¿ëÁö¿ì±â ****************************************
function delete_contents(input)
{
	if (input.value == input.defaultValue)
	{
		input.value = "";
	}
}
