document.write("<script language='javascript' src='/js/bdf.js'></script>");

var isSubmit = false;

/* ¿øº»
function go_search(){
	if(document.frmsearch.query.value == ""){
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		document.frmsearch.query.focus();
		return false;
	}
	else{
		document.frmsearch.submit();
	}
}
*/

//2008-06-11, °³ÀÎ¹ðÅ·°ú µ¿±âÈ­, Á¤À±Ã¶KJ
function go_search(){
	var search_value = document.frmsearch.query.value;
	if(document.frmsearch.query.value == ""){
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		document.frmsearch.query.focus();
		return false;
	}
	else if(NoSecChar(search_value)){
		document.frmsearch.submit();
	}
}

function FormSubmit(obj, TrxID, flag) {
	if(showErrLayer){
		document.errorForm.submit();
	}else{
		if(isSubmit == false){	// Áßº¹ °Å·¡ Ã¼Å©
			if(validateForm(obj)){	// form µ¥ÀÌÅ¸ validation
				if(PkiCube_EncPost(obj, TrxID) == false) {
					alert("¾ÏÈ£È­Ã³¸®Áß ¿¡·¯¹ß»ý");
					isSubmit = false;
				}
				else{
					if(flag != "N"){
						if( document.all.btn1 != null && document.all.btn1.style != null ){
							document.all.btn1.style.visibility="hidden";
						}
						if( document.all.btn2 != null && document.all.btn2.style != null ){
							document.all.btn2.style.visibility="visible";
						}

					}
					isSubmit = true;
				}
			}
		}
		else{
			alert("ÀÌ¹Ì Ã³¸®ÁßÀÔ´Ï´Ù. Àá½Ã¸¸ ±â´Ù·Á ÁÖ½Ê½Ã¿ä");
		}
	}
	return false;
}

//ÀÎÅÍ³Ý¹ðÅ·¿¡¼­ »ç¿ëÇÏ´Â °ÍÀÓ( UMS °èÁÂÃß°¡ ÆË¾÷¿¡ »ç¿ëÇÏ´Â°Í)
//Àý´ëÁö¿ìÁö ¸»°Í.(±è±Ô¼®)
function UmsFormSubmit(obj, TrxID, flag) {
 	if(showErrLayer){
		document.errorForm.submit();
	}else{
 		if(isSubmit == false){	// Áßº¹ °Å·¡ Ã¼Å©
 			if(validateForm(obj)){	// form µ¥ÀÌÅ¸ validation
 				if(PkiCube_EncPost(obj, TrxID) == false) {
 					alert("¾ÏÈ£È­Ã³¸®Áß ¿¡·¯¹ß»ý");
					isSubmit = false;
				}
				
				else{
 					if(flag != "N"){
						if( document.all.btn1 != null && document.all.btn1.style != null ){
							document.all.btn1.style.visibility="hidden";
						}
						if( document.all.btn2 != null && document.all.btn2.style != null ){
							document.all.btn2.style.visibility="visible";
						}

					}
					isSubmit = true;
				}
			}
		}
		else{
			alert("ÀÌ¹Ì Ã³¸®ÁßÀÔ´Ï´Ù. Àá½Ã¸¸ ±â´Ù·Á ÁÖ½Ê½Ã¿ä");
		}
	}
	return isSubmit;
}


// 2009-06-14 ±èÀå¶ô Fileupload Submit
function FileFormSubmit(obj, TrxID, flag, url) {
	if(showErrLayer){
		document.errorForm.submit();
	}else{
		if(isSubmit == false){	// Áßº¹ °Å·¡ Ã¼Å©
			if(validateForm(obj)){	// form µ¥ÀÌÅ¸ validation
				if(PkiCube_FileEncPost(obj, TrxID, url) == false) {
					isSubmit = false;
				}
				else{
					if(flag != "N"){
						if( document.all.btn1 != null && document.all.btn1.style != null ){
							document.all.btn1.style.visibility="hidden";
						}
						if( document.all.btn2 != null && document.all.btn2.style != null ){
							document.all.btn2.style.visibility="visible";
						}

					}
					isSubmit = true;
				}
			}
		}
		else{
			alert("ÀÌ¹Ì Ã³¸®ÁßÀÔ´Ï´Ù. Àá½Ã¸¸ ±â´Ù·Á ÁÖ½Ê½Ã¿ä");
		}
	}
	return false;
}

// Ã³¸®ÁßÀÔ´Ï´Ù ¹öÆ° º¸¿©ÁÖ±â
function fGoLinkPage(url, flag){

	if(flag){
		if( document.all.btn1 != null && document.all.btn1.style != null ){
			document.all.btn1.style.visibility="hidden";
		}
		if( document.all.btn2 != null && document.all.btn2.style != null ){
			document.all.btn2.style.visibility="visible";
		}

	}
	LinkPage(url,'','');
}

function CertFormSubmit(obj,signStr,TrxID, flag) {
	if(isSubmit == false){	// Áßº¹ °Å·¡ Ã¼Å©
		if(validateForm(obj)){	// form µ¥ÀÌÅ¸ validation
			if(DefaultCertSign(obj,signStr,TrxID) == false) {
				//alert("¾ÏÈ£È­Ã³¸®Áß ¿¡·¯¹ß»ý");
				isSubmit = false;
			}
			else{
				if(flag != "N"){
					if( document.all.btn1 != null && document.all.btn1.style != null ){
						document.all.btn1.style.visibility="hidden";
					}
					if( document.all.btn2 != null && document.all.btn2.style != null ){
						document.all.btn2.style.visibility="visible";
					}

				}
				isSubmit = true;
			}
		}
	}
	else{
		alert("ÀÌ¹Ì Ã³¸®ÁßÀÔ´Ï´Ù. Àá½Ã¸¸ ±â´Ù·Á ÁÖ½Ê½Ã¿ä");
	}
	return false;
}

function CertConfirmFormSubmit(obj,signStr,TrxID, flag) {
	if(isSubmit == false){	// Áßº¹ °Å·¡ Ã¼Å©
		if(validateForm(obj)){	// form µ¥ÀÌÅ¸ validation
			if(CertSignConfirm(obj,signStr,TrxID) == false) {
				//alert("¾ÏÈ£È­Ã³¸®Áß ¿¡·¯¹ß»ý");
				isSubmit = false;
			}
			else{
/*
PkiCube/PkiCube_initech.js ÀÇ CertSignConfirm ¿¡¼­ Á¶ÀÛ...
				if(flag != "N"){
					if( document.all.btn1 != null && document.all.btn1.style != null ){
						document.all.btn1.style.visibility="hidden";
					}
					if( document.all.btn2 != null && document.all.btn2.style != null ){
						document.all.btn2.style.visibility="visible";
					}
				}
				isSubmit = true;
*/
			}
		}
	}
	else{
		alert("ÀÌ¹Ì Ã³¸®ÁßÀÔ´Ï´Ù. Àá½Ã¸¸ ±â´Ù·Á ÁÖ½Ê½Ã¿ä");
	}
	return false;
}

/*
function FormSubmit_newOpen(obj, TrxID, flag, etc) {
	if(isSubmit == false){	// Áßº¹ °Å·¡ Ã¼Å©
		if(validateForm(obj)){	// form µ¥ÀÌÅ¸ validation
			if(PkiCube_EncPost(obj, TrxID) == false) {
				alert("¾ÏÈ£È­Ã³¸®Áß ¿¡·¯¹ß»ý");
			}
			else{
				if(flag != "N"){
					document.all.btn1.style.visibility="hidden";
					document.all.btn2.style.visibility="visible";
				}
			}

			isSubmit = true;
		}
	}
	else{
		alert("ÀÌ¹Ì Ã³¸®ÁßÀÔ´Ï´Ù. Àá½Ã¸¸ ±â´Ù·Á ÁÖ½Ê½Ã¿ä");
	}
	return false;
}
*/
function next_transaction(){
//	alert("next_transaction");
	FormSubmit(document.NextForm, document.NextForm.TRXID.value, "N");
	return false;
}

function next_transaction_speed(){
	PkiCube_Logout();
	FormSubmit(document.NextForm, document.NextForm.TRXID.value, "N");
	return false;
}

function GetPageLink(url, target, feature, TrxID) {
//	if(target == ''){
//		location.href = url;
//	else
		PkiCube_EncGet(url, target, feature, TrxID);
}

function isValidDate(datestr){
	//³ÎÀÎÁö?
	if(isEmpty(datestr)){
		return null;
	}
	//¼ýÀÚÀÎÁö?
	if(!isNum(datestr)){
		alert("¼ýÀÚ¸¦ ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		return false;
	}
	//±æÀÌ°¡ 8ÀÚ¸®?
	if(datestr.length != 8){
		alert("³â¿ùÀÏ 8ÀÚ¸®¸¦ ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		return false;
	}
	var yy = Number(datestr.substring(0,4));
	var mm = Number(datestr.substring(4,6));
	var dd = Number(datestr.substring(6,8));
	//¿ù °ËÁõ
	if( !(mm > 0 && mm < 13) ){
		alert("¿ùÀº 1~12 ±îÁö¸¸ ÀÔ·ÂÇÒ ¼ö ÀÖ½À´Ï´Ù.  ");
		return false;
	}
	//À±³â °ËÁõ
	var boundDay = "";
	if(mm != 2){
		var mon=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
		boundDay = mon[mm-1];
	}
	else{
		if (yy%4 == 0 && yy%100 != 0 || yy%400 == 0){
			boundDay = 29;
		}
		else{
			boundDay = 28;
		}
	}
	//ÀÏ °ËÁõ
	if( (dd <= 0) || (dd > boundDay) ){
		alert("À¯È¿ÇÏÁö ¾ÊÀº ÀÏÀÚÀÔ´Ï´Ù.\n(" + yy + "³â " + mm + "¿ùÀº " + boundDay + "ÀÏ ±îÁö ÀÖ½À´Ï´Ù.)");
		return false;
	}
	return true;
}

// ³â¿ù¸¸ °ËÁõ
function isValidDateYYYYMM(datestr){
	//³ÎÀÎÁö?
	if(isEmpty(datestr)){
		return null;
	}
	//¼ýÀÚÀÎÁö?
	if(!isNum(datestr)){
		alert("¼ýÀÚ¸¦ ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		return false;
	}
	//±æÀÌ°¡ 8ÀÚ¸®?
	if(datestr.length != 6){
		alert("³â¿ù 6ÀÚ¸®¸¦ ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		return false;
	}
	var yy = Number(datestr.substring(0,4));
	var mm = Number(datestr.substring(4,6));
	//¿ù °ËÁõ
	if( !(mm > 0 && mm < 13) ){
		alert("¿ùÀº 1~12 ±îÁö¸¸ ÀÔ·ÂÇÒ ¼ö ÀÖ½À´Ï´Ù.  ");
		return false;
	}
	return true;
}

//EMAIL À¯È¿¼º °ËÁõ
function isValidEmail(email){
	//³ÎÀÎÁö?
	if(isEmpty(email)){
		return null;
	}
	//¿Ã¹Ù¸¥ EMAIL ÀÎÁö °ËÁõ
	var format = /^((\w|[\-\.])+)@((\w|[\-\.])+)\.([A-Za-z]+)$/;
	if (email.search(format) == -1) {
	   alert("À¯È¿ÇÏÁö ¾ÊÀº ÀÌ¸ÞÀÏ Çü½ÄÀÔ´Ï´Ù.");
	   return false
	}
	return true;
}

//ÁÖ¹Îµî·Ï¹øÈ£ À¯È¿¼º °ËÁõ
function isValidJuminNo(regno){
	//³ÎÀÎÁö?
	if(isEmpty(regno)){
		return null;
	}
	// 13ÀÚ¸® ¼ýÀÚÀÎ°¡? -> ÁÖ¹Î¹øÈ£
	if((getByteLength(regno) != 13) || (!isNum(regno)) ) {
		alert("ÁÖ¹Îµî·Ï¹øÈ£´Â 13ÀÚ¸® ¼ýÀÚÀÔ´Ï´Ù.");
		return false;
	}

	if(regno.substring(6, 7) == '5'){
		return true;
	}else{
		//¿Ã¹Ù¸¥ ÁÖ¹Îµî·Ï¹øÈ£ÀÎÁö °ËÁõ
		var ju = regno.substring(0,6);
		var ju1 = regno.substring(6);
		juid = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0);
		for(var i = 0; i<6;i++)
			juid[i] = ju.substring(i,i+1);
		for(i=0;i<7;i++)
			juid[i+6] = ju1.substring(i,i+1);
		for(var sum = 0, i = 0;i<12;i++)
			sum += juid[i] * ((i >7) ? (i-6) : (i+2));
		var mod = 11 - sum%11;
		if(mod >= 10)
			mod -= 10;
		if(mod != juid[12]) {
			 alert("¿Ã¹Ù¸£Áö ¾ÊÀº ÁÖ¹Îµî·Ï¹øÈ£ÀÔ´Ï´Ù.");
			 return false;
		}
		else {
			  return true;
		}
	}
}

//20110601 ¼ºµ¿ÀÏ
//¼öÇù ÀÌ¿ëÈ£ Â÷Àå´ÔÀÇ ¿äÃ»À¸·Î »ç¾÷ÀÚ¹øÈ£ À¯È¿¼º °ËÁõ ÁÖ¼®
//»ç¾÷ÀÚ¹øÈ£ À¯È¿¼º °ËÁõ
function isValidSaupNo(strNumb)
{
	
	//³ÎÀÎÁö?
	if(isEmpty(strNumb)){
		return null;
	}
	// 10ÀÚ¸® ¼ýÀÚÀÎ°¡?
	if((getByteLength(strNumb) != 10) || (!isNum(strNumb)) ) {
		alert("»ç¾÷ÀÚµî·Ï¹øÈ£´Â 10ÀÚ¸® ¼ýÀÚÀÔ´Ï´Ù.");
		return false;
	}
	
	/*
	20110601 ÁÖ¼®Ã³¸®
	sumMod	=	0;
	sumMod	+=	Number(strNumb.substring(0,1));
	sumMod	+=	Number(strNumb.substring(1,2)) * 3 % 10;
	sumMod	+=	Number(strNumb.substring(2,3)) * 7 % 10;
	sumMod	+=	Number(strNumb.substring(3,4)) * 1 % 10;
	sumMod	+=	Number(strNumb.substring(4,5)) * 3 % 10;
	sumMod	+=	Number(strNumb.substring(5,6)) * 7 % 10;
	sumMod	+=	Number(strNumb.substring(6,7)) * 1 % 10;
	sumMod	+=	Number(strNumb.substring(7,8)) * 3 % 10;
	sumMod	+=	Math.floor(Number(strNumb.substring(8,9)) * 5 / 10);
	sumMod	+=	Number(strNumb.substring(8,9)) * 5 % 10;
	sumMod	+=	Number(strNumb.substring(9,10));
	if	(sumMod % 10	!=	0)
	{
		alert("¿Ã¹Ù¸£Áö ¾ÊÀº »ç¾÷ÀÚµî·Ï¹øÈ£ÀÔ´Ï´Ù.");
		return false;
	}
	*/
	return	true;
}

function isValidJUSaupNo(strNumb){
		if(strNumb.length == 13){
			if(!isValidJuminNo(strNumb)) return false;
		}else if(strNumb.length == 10){
			if(!isValidSaupNo(strNumb)) return false;
		}else{
			alert("ÁÖ¹Î(»ç¾÷ÀÚ)µî·Ï¹øÈ£°¡ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.")
			return false;
		}
		return true;
}

function isValidSpeedRegno(strNumb){
	if(strNumb.length != 7 && strNumb.length != 5){
		alert("ÁÖ¹Î(»ç¾÷ÀÚ)µî·Ï¹øÈ£°¡ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.");
		return false;
	}else if(!isNum(strNumb)){
		alert("ÁÖ¹Î(»ç¾÷ÀÚ)µî·Ï¹øÈ£´Â ¼ýÀÚÀÔ´Ï´Ù.");
		return false;
	}
	return true;

}

function isValidUserId(userid){
	//³ÎÀÎÁö?
	if(isEmpty(userid)){
		return null;
	}
	if(getByteLength(userid)>16 || getByteLength(userid) < 8 ){
		alert("»ç¿ëÀÚ ¾ÆÀÌµð´Â 8ÀÚ ÀÌ»ó 16ÀÚÀÌ³»·Î ¹Ýµå½Ã ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		return false;
	}
	/*if(isNum(userid)){
		alert("¾ÆÀÌµð´Â ¼ýÀÚ·Î¸¸ ±¸¼ºÇÒ ¼ö ¾ø½À´Ï´Ù.");
		return false;
	}*/

	for(var i=0; i < userid.length; i++) {
		if ( !(isValidMask(userid.charAt(i),"N"))){
			return false;
		}
	} // for end
	return true;
}

//ºñ¹Ð¹øÈ£ °ËÁõ
function isValidPassword(pwd){
	var alpaBig= "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	var alpaSmall= "abcdefghijklmnopqrstuvwxyz";
	var num = "01234567890";
	//³ÎÀÎÁö?
	if(isEmpty(pwd)){
		alert("Á¢¼Óºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ½Ê½Ã¿À.")
		return null;
	}
	// ºñ¹Ð¹øÈ£´Â 6ÀÚ¸®ÀÌ»ó 8ÀÚ¸® ÀÌÇÏ .. maxLength=10·Î º¯°æ ÇÒ°Í
/*	if(getByteLength(pwd)<6 || getByteLength(pwd) > 10 ){
		alert("ºñ¹Ð¹øÈ£´Â ¹Ýµå½Ã 6ÀÚ ÀÌ»ó 8ÀÚÀÌ³»·Î ÀÔ·ÂÇØ¾ß ÇÕ´Ï´Ù.");
		return false;
	}*/
	if(isNum(pwd)){
		alert("Á¢¼Óºñ¹Ð¹øÈ£´Â ¹Ýµå½Ã ¾ËÆÄºªÀ» ÇÏ³ª ÀÌ»ó Æ÷ÇÔÇØ¾ß ÇÕ´Ï´Ù.");
		return false;
	}
	for(var i=0;i < alpaBig.length - pwd.length+1;i++){
		if(alpaBig.substring(i,i+pwd.length) == pwd)
		{
			alert("ABCDEFÃ³·³ ¿¬¼ÓµÈ ¹®ÀÚ´Â »ç¿ëÇÒ ¼ö °¡ ¾ø½À´Ï´Ù.");
			return false;
		}
	}
	if (pwd.indexOf(' ') > -1) {
		alert("°ø¹éÀº ÀÔ·ÂÇÒ ¼ö ¾ø½À´Ï´Ù.");
		return false;
	}
	for(i=0;i < alpaSmall.length - pwd.length+1;i++){
		if(alpaSmall.substring(i,i+pwd.length) == pwd)
		{
			alert("abcdefÃ³·³ ¿¬¼ÓµÈ ¹®ÀÚ´Â »ç¿ëÇÒ ¼ö °¡ ¾ø½À´Ï´Ù.");
			return false;
		}
	}
	for(i=1;i < pwd.length;i++){
		if(pwd.substring(0,1) != pwd.substring(i,i+1) )
			return true;
	}
	alert("Á¢¼Óºñ¹Ð¹øÈ£´Â °°Àº ¹®ÀÚ¸¸ ¿¬¼ÓÇØ¼­ ÀÔ·ÂÇÒ ¼ö ¾ø½À´Ï´Ù");
	return false;
}

function isValidAcctNo(acct){
	if(Chk_Digit(acct) == false){
		alert("°èÁÂ¹øÈ£´Â ¼ýÀÚ·Î ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		return false;
	}
	else if(acct.length < 11 || acct.length > 12){
		alert("°èÁÂ¹øÈ£´Â 11~12ÀÚ¸® ÀÔ´Ï´Ù. Á¤È®È÷ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿ä.");
		return false;
	}
	return true;
}

function isValidCardNo(cardno){
	if(Chk_Digit(cardno) == false){
		alert("Ä«µå¹øÈ£´Â ¼ýÀÚ·Î ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		return false;
	}
	else if(cardno.length != 16){
		alert("Ä«µå¹øÈ£´Â 16ÀÚ¸® ÀÔ´Ï´Ù. Á¤È®È÷ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿ä.");
		return false;
	}
	return true;
}

function isValidAcctNo_r(acct){
	if(Chk_Digit(acct) == false){
		alert("°èÁÂ¹øÈ£´Â ¼ýÀÚ·Î ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		return false;
	}
	return true;
}

function isValidAcctNoPassWd(passwd){
	if(Chk_Digit(passwd) == false){
		alert("°èÁÂºñ¹Ð¹øÈ£´Â ¼ýÀÚ·Î ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		return false;
	}else if(passwd.length != 4){
		alert("°èÁÂºñ¹Ð¹øÈ£´Â 4ÀÚ¸®ÀÔ´Ï´Ù. Á¤È®È÷ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿ä.");
		return false;
	}
	return true;
}
function  isValidTransPassWd(passwd){
	if(isAlphaNumber(passwd) == false){
		alert("ÀÌÃ¼ºñ¹Ð¹øÈ£´Â ¿µ.¼ýÀÚ·Î ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		return false;
	}else if(passwd.length != 6){
		alert("ÀÌÃ¼ºñ¹Ð¹øÈ£´Â 6ÀÚ¸®ÀÔ´Ï´Ù. Á¤È®È÷ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿ä.");
		return false;
	}
	return true;
}

function  isValidConnctPassWd(passwd){
	if(isAlphaNumber(passwd) == false){
		alert("Á¢¼Óºñ¹Ð¹øÈ£´Â ¿µ.¼ýÀÚ·Î ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		return false;
	}else if(passwd.length != 8){
		alert("Á¢¼Óºñ¹Ð¹øÈ£´Â 6ÀÚ¸®ÀÔ´Ï´Ù. Á¤È®È÷ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿ä.");
		return false;
	}
	return true;
}


function isValidSecNo(secno){
	if(Chk_Digit(secno) == false){
		alert("º¸¾ÈÄ«µå ºñ¹Ð¹øÈ£´Â ¼ýÀÚ·Î ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		return false;
	}else if(secno.length != 2){
		alert("º¸¾ÈÄ«µå ºñ¹Ð¹øÈ£´Â 2ÀÚ¸®ÀÔ´Ï´Ù. Á¤È®È÷ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿ä.");
		return false;
	}
	return true;
}

function isValidOTPNo(otpno){
	if(Chk_Digit(otpno) == false){
		alert("OTP ÀÔ·Â¹øÈ£´Â ¼ýÀÚ·Î ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		return false;
	}else if(otpno.length != 6){
		alert("OTP ÀÔ·Â¹øÈ£´Â 6ÀÚ¸®ÀÔ´Ï´Ù. Á¤È®È÷ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿ä.");
		return false;
	}
	return true;
}

function isValidAmt(amt){
	if(Chk_Digit(amt) == false){
		alert("±Ý¾×Àº ¼ýÀÚ·Î ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		return false;
	}
	// 4line simz added... 20070606
	if( amt == '0' ){
		alert("±Ý¾×À» ÀÔ·ÂÇÏ¼¼¿ä");
		return false;
	}
	return true;
}

// 2009-06-19
function isValidCnt(cnt){
	if( cnt == '0' ){
		alert("ÃÑ °Ç¼ö¸¦ ÀÔ·ÂÇÏ¼¼¿ä");
		return false;
	}
	return true;
}

function isValidNumber(secno){
	if(Chk_Digit(secno) == false){
		alert("¼ýÀÚ·Î ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		return false;
	}
	return true;
}

function isValidNotHangul(secno){
	if(!isHangul(secno) == false){
		alert("¿µ¹® ¶Ç´Â ¼ýÀÚ·Î ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		return false;
	}
	return true;
}

//2011.08.06 ¼ºµ¿ÀÏ Ãß°¡ B2B¿Ü»ó¸ÅÃâÃ¤±Ç¿¡¼­ »ç¿ë
function isValidNotHangulB2B(taxno){
	if(!isHangul(taxno) == false){
		return false;
	}
	return true;
}

function Chk_Digit(str){
	var str_len = str.length;
	var i;
	var num = '1234567890';
	if(str_len == 0) return true;
	for (i=0; i < str_len; i++)	{
	   if(num.indexOf(str.substring(i,i+1)) < 0) {
	       return false;
	   }
	}
	return true;
}


// ºó°ªÀÎÁö ¸®ÅÏÇÑ´Ù.
function isEmpty(pValue){

	if( (pValue == "") || (pValue == null) ){
		return true;
	}
	return false;
}



// ¼ýÀÚ°ËÁõ
function isNum(str){
	if(isEmpty(str)) return false;

	for(var idx=0;idx < str.length;idx++){
		if(str.charAt(idx) < '0' || str.charAt(idx) > '9'){
			return false;
		}
	}
	return true;
//	alert(isHangul(str));
}


// ¿µ¹®ÀÚ°ËÁõ
function isAlpha(str){

	if(isEmpty(str)) return false;

	for(var idx=0;idx < str.length;idx++){
		if(!((str.charAt(idx) >='a' && str.charAt(idx) <= 'z') || (str.charAt(idx) >= 'A' && str.charAt(idx) <= 'Z'))){
			return false;
		}
	}
	return true;
}

function isAlphaNumber(str){
	if(isEmpty(str)) return false;

	for(var idx=0;idx < str.length;idx++){
		if(!((str.charAt(idx) >='a' && str.charAt(idx) <= 'z') || (str.charAt(idx) >= 'A' && str.charAt(idx) <= 'Z') || (str.charAt(idx) >= '0' && str.charAt(idx) <= '9'))){
			return false;
		}
	}
	return true;
}


function isAlphaNumSpc(str){
	EtcStr = String(" !#%&()-.=@[]^_`{}~");
    EngNameStr = String(str);

	for(i = 0; i < EngNameStr.length; i++){
        ch = EngNameStr.charAt(i) ;
        if(ch >= "a" && ch <= "z")
                continue;
        else if(ch >= "A" && ch <= "Z")
                continue;
        else if(ch >= "0" && ch <= "9")
                continue;
        else{
                for(j = 0; j < EtcStr.length; j++){
                        EtcCh = EtcStr.charAt(j);
                        if(EtcCh == ch){
                                break;
                        }
                }
                if( j == EtcStr.length )
                        return false;
        }
    }
        return true;
}

// ÇÑ±Û°ËÁõ
function isHangul(str){

	if(isEmpty(str)) return false;

	for(var idx=0;idx < str.length;idx++){
      var c = escape(str.charAt(idx));
      if ( c.indexOf("%u") == -1 ) {
			return false;
		}
	}
	return true;
}


function getByteLength(s){

   var len = 0;
   if ( s == null ) return 0;
   for(var i=0;i<s.length;i++){
      var c = escape(s.charAt(i));
      if ( c.length == 1 ) len ++;
      else if ( c.indexOf("%u") != -1 ) len += 2;
      else if ( c.indexOf("%") != -1 ) len += c.length/3;
   }
   return len;
}



 function foot1(src)
 {
 	window.open(src,"",'menubar=0,resizable=0,scrollbars=yes,width=667, height=500, left=0, top=0');
 }
 function foot2(src)
 {
 	window.open(src,"",'menubar=0,resizable=0,scrollbars=yes,width=667, height=500, left=0, top=0');
}

	// 1 byte °ª¿¡ ´ëÇÏ¿© ÇØ´çµÈ ¸¶½ºÅ©°¡ Á¸ÀçÇÏ´ÂÁö °ËÁõÇÑ´Ù.
	function isValidMask(pValue, pMask){
		if(pValue == '@') return true;
		if(isEmpty(pValue))	return true;
		if(isEmpty(pMask))	return true;
		if(isAlpha(pValue) || isNum(pValue) || isHangul(pValue))	return true;
		if(pMask == "USE") return true;
		//Æ¯¼ö¹®ÀÚ¸¦ ÀüºÎ »ç¿ëÇÏÁö ¸øÇÔ
		if(pMask == "N"){
			alert("ÀÌ Ç×¸ñ¿¡´Â °ø¹éÀÌ³ª Æ¯¼ö¹®ÀÚ¸¦ ÀÔ·ÂÇÒ ¼ö ¾ø½À´Ï´Ù.");
			return false;
		}
		if(pMask.indexOf(pValue) >= 0) 	return true;
		var errmsg = "";
		for(var idx=0;idx<pMask.length;idx++){
			errmsg = errmsg + "'" + pMask.charAt(idx) + "', ";
		}
		errmsg = errmsg.substring(0,errmsg.length-2);
		ERR_MSG = "ÀÌ Ç×¸ñ¿¡´Â '" + pValue + "' À»(¸¦) ÀÔ·ÂÇÒ ¼ö ¾ø½À´Ï´Ù.\nÀÔ·Â°¡´ÉÇÑ Æ¯¼ö¹®ÀÚ´Â " + errmsg + "¸¸ °¡´ÉÇÕ´Ï´Ù.";
		alert(ERR_MSG)
		return false;
	}


	function NoSecChar(str){
		var len = str.length;
		var pos = 0;
		var ch = '';
		while (pos < len) {
			ch = str.charCodeAt(pos);
			if ((ch >= '32') && (ch <= '47') || (ch >= '58') && (ch <= '64') || (ch >= '91') && (ch <= '96') || (ch >= '123') && (ch <= '126')){
				alert("ÇÑ±Û,¿µ¾î,¼ýÀÚ¸¸ ÀÔ·Â °¡´ÉÇÕ´Ï´Ù.");
				return false;
			}
			pos = pos + 1;
		}
		return true;
	}
/*
function win_form_init(){

	win_resize(420);

	window.focus();

}

function win_resize(re) {

	var obj = navigator.appVersion;

	var hei = 30;

	if (navigator.appVersion.indexOf("NT") != -1) {

		os = obj.substr(obj.indexOf("NT"),6);

		if (os > "NT 5.0") {

			hei = 50;

		}

	}

	wid = document.body.scrollWidth;

	wid = re;

	hei = document.body.scrollHeight+hei;

	self.resizeTo(wid,hei);

}
*/
function Go_CerPage() {
	opener.location.href = '/banking/certification/cert0101Q.jsp';
	self.close();
}





// 20080328 ¾ÈÈñµ¿ ÀÌÇÏ °³ÀÎ¹ðÅ·À¸·Î °¥¶§ ¹°¾îº¸°í °¡±â.
function bridgeWinOpen(url, bridge) {
//	alert("bridgeWinOpen : " + url);

	if (parent.login_flag != "login")
		location.href = "/bridge.jsp?forward="+encodeURL(url)+"&bridge="+bridge+"&login_flag="+parent.login_flag;
	else
		window.showModalDialog("/bridge.jsp?forward="+encodeURL(url)+"&bridge="+bridge+"&login_flag="+parent.login_flag, "new_win","dialogwidth=300px;dialogHeight=200px;dialogtop=200px;dialogleft=300px;scroll=no;resizable=no;status=no");
//		window.open("/bridge.jsp?forward="+encodeURL(url)+"&bridge="+bridge+"&login_flag="+parent.login_flag, "new_win", "toolbar=no, status=no, width=300,height=200");
	}

function bridgeWinOpenError() {
	window.open('/banking/login/logout.jsp','contentframe','');

//	window.open("/bridge_error.jsp", "new_win", "toolbar=no, status=no, width=300,height=200");
	window.showModalDialog("/bridge_error.jsp", "new_win","dialogwidth=300px;dialogHeight=200px;dialogtop=200px;dialogleft=300px;scroll=no;resizable=no;status=no");
}

function bridgeGo(url) {
	parent.login_flag = "notlogin";
	open("/banking/login/logout.jsp", "tempframe", "toolbar=no,scrollbars=no,menubar=no,status=no,width=10,height=10");
//	alert("bridge.jsp  url="+url);
	top.location.href = url;
}

function index_call(){
//	alert("/index.jsp");
        // 20100622 ½Å½ÂÇÊ - ¸ÞÀÎ·Î°í Å¬¸¯½Ã ÀÎÅÍ³Ý¹ðÅ· ¸ÞÀÎÆäÀÌÁö(°³ÀÎ) ÀÌµ¿ÇÏ´Â °ÍÀ¸·Î ¿äÃ» (¼öÇù ¹ÚÁÖ¿ÏÆÀÀå)
	//top.location.href = "/index.jsp";
	LinkPage('http://www.suhyup-bank.com/index.html','','');
	//LinkPage('http://biztest2.suhyup-bank.com/index.html','','');
}

function getURLParam(name)
{
    name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
    var regexS = "[\\?&]"+name+"=([^&#]*)";
    var regex = new RegExp( regexS );
    var results = regex.exec( window.location.href );
    if (results == null)
        return null;
    else {
		return results[1];
	}
}

function winresize() {
	window.resizeBy(screen.width, screen.height);
}

function encodeURL(str){
    var s0, i, s, u;
    s0 = "";                // encoded str
    for (i = 0; i < str.length; i++){   // scan the source
        s = str.charAt(i);
        u = str.charCodeAt(i);          // get unicode of the char
        if (s == " "){s0 += "+";}       // SP should be converted to "+"
        else {
            if ( u == 0x2a || u == 0x2d || u == 0x2e || u == 0x5f || ((u >= 0x30) && (u <= 0x39)) || ((u >= 0x41) && (u <= 0x5a)) || ((u >= 0x61) && (u <= 0x7a))){       // check for escape
                s0 = s0 + s;            // don't escape
            }
            else {                  // escape
                if ((u >= 0x0) && (u <= 0x7f)){     // single byte format
                    s = "0"+u.toString(16);
                    s0 += "%"+ s.substr(s.length-2);
                }
                else if (u > 0x1fffff){     // quaternary byte format (extended)
                    s0 += "%" + (oxf0 + ((u & 0x1c0000) >> 18)).toString(16);
                    s0 += "%" + (0x80 + ((u & 0x3f000) >> 12)).toString(16);
                    s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
                    s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                }
                else if (u > 0x7ff){        // triple byte format
                    s0 += "%" + (0xe0 + ((u & 0xf000) >> 12)).toString(16);
                    s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
                    s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                }
                else {                      // double byte format
                    s0 += "%" + (0xc0 + ((u & 0x7c0) >> 6)).toString(16);
                    s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                }
            }
        }
    }
    return s0;
}


function decodeURL(str){
    var s0, i, j, s, ss, u, n, f;
    s0 = "";                // decoded str
    for (i = 0; i < str.length; i++){   // scan the source str
        s = str.charAt(i);
        if (s == "+"){s0 += " ";}       // "+" should be changed to SP
        else {
            if (s != "%"){s0 += s;}     // add an unescaped char
            else{               // escape sequence decoding
                u = 0;          // unicode of the character
                f = 1;          // escape flag, zero means end of this sequence
                while (true) {
                    ss = "";        // local str to parse as int
                        for (j = 0; j < 2; j++ ) {  // get two maximum hex characters for parse
                            sss = str.charAt(++i);
                            if (((sss >= "0") && (sss <= "9")) || ((sss >= "a") && (sss <= "f"))  || ((sss >= "A") && (sss <= "F"))) {
                                ss += sss;      // if hex, add the hex character
                            } else {--i; break;}    // not a hex char., exit the loop
                        }
                    n = parseInt(ss, 16);           // parse the hex str as byte
                    if (n <= 0x7f){u = n; f = 1;}   // single byte format
                    if ((n >= 0xc0) && (n <= 0xdf)){u = n & 0x1f; f = 2;}   // double byte format
                    if ((n >= 0xe0) && (n <= 0xef)){u = n & 0x0f; f = 3;}   // triple byte format
                    if ((n >= 0xf0) && (n <= 0xf7)){u = n & 0x07; f = 4;}   // quaternary byte format (extended)
                    if ((n >= 0x80) && (n <= 0xbf)){u = (u << 6) + (n & 0x3f); --f;}         // not a first, shift and add 6 lower bits
                    if (f <= 1){break;}         // end of the utf byte sequence
                    if (str.charAt(i + 1) == "%"){ i++ ;}                   // test for the next shift byte
                    else {break;}                   // abnormal, format error
                }
            s0 += String.fromCharCode(u);           // add the escaped character
            }
        }
    }
    return s0;
}

function session_Check(){
	//if(navigator.appVersion.indexOf("MSIE 8.0") != -1){
		var client_login_time = top.login_time;
	 	if(client_login_time != null && client_login_time == "" && client_login_time != "null"){
			//alert("¼¼¼Ç °øÀ¯µÈ ºê¶ó¿ìÁ®ÀÔ´Ï´Ù.");
			alert("ÁË¼ÛÇÕ´Ï´Ù!\n¼¼¼Ç °øÀ¯ ¹®Á¦·Î ºê¶ó¿ìÁ® Á¾·á ÈÄ ´Ù½Ã ÀÌ¿ëÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
			top.login_time = "";
			top.contentframe.location.href = "/banking/login/logout.jsp";
			return false;
		}
		return true;
	//}
}

function fn_AddSelectBox(elSel)
{
	if(elSel.selectedIndex >= 0) {
		var elOptNew = document.createElement('option');
		elOptNew.text = '¼±ÅÃÇÏ¼¼¿ä';
		elOptNew.value = '';
		var elOptOld = elSel.options[elSel.selectedIndex]; 
		
			try {
				elSel.add(elOptNew, elOptOld); // standards compliant; doesn't work in IE
			}catch(ex){
				elSel.add(elOptNew, 0); // IE only
			}
			
			elSel.options[0].selected = true;
	}
	
}

// 2011.03.16		NEXTRO Ãß°¡
//Æûµ¥ÀÌÅ¸¸¦ PKCS#7 ¼­¸í + º»ÀÎÈ®ÀÎÁ¤º¸
function CertSignReConfirm(infrm, signStr , TrxID)
{
	//PkiCube_Logout();
	var insigndata ='';

	PkiCube_Init();

	initCertFilter();
	
	var sELCSIGN = "";
	//signedData Æ÷¸ËÁöÁ¤
	initP7Msg('0');

	encodeData = GatherValueForSign(infrm, 0,'');
	insigndata = initPKCS7SignedData(encodeData,false);
	if(insigndata !=null && insigndata !='') {

			sELCSIGN =  "--Input Start--";
			sELCSIGN = sELCSIGN+ ","+"TRXID=" + infrm.TRXID.value;
			if(infrm.TRXTYPE != null && infrm.TRXTYPE !='' && infrm.TRXTYPE != 'undefined' &&  infrm.TRXTYPE != undefined ) {
				sELCSIGN = sELCSIGN+","+"TRXTYPE=" + infrm.TRXTYPE.value; 
			}
			sELCSIGN = sELCSIGN+","+"CLIENTIP=" +infrm.CLIENTIP.value;
			sELCSIGN = sELCSIGN+","+"SERVICECODE=" +infrm.SERVICECODE.value; 
			sELCSIGN = sELCSIGN+","+"TRANSSEQ=";
			sELCSIGN = sELCSIGN+","+"ERROR_MSG=";
			sELCSIGN = sELCSIGN+","+"SIGN=" +insigndata;
			sELCSIGN = sELCSIGN+",--Input End--";

			// NEXTRO 2011.03.10 ÀüÀÚ¼­¸í Ãß°¡ 
			infrm.ELCSIGN.value = sELCSIGN;
			infrm.ELCSIGNLEN.value = sELCSIGN.length;

			//alert(infrm.ELCSIGN.value );
			//alert(infrm.ELCSIGNLEN.value );

			infrm.SIGNVALUE.value = insigndata;
			
			if (EncFormVerify2(infrm,document.iniSendForm)){

				document.iniSendForm.TrxID.value = TrxID;
				document.iniSendForm.target = infrm.target;
				document.iniSendForm.action = infrm.action;
				// ÀÎÁõ¼­Ã¢ È®ÀÎ¹öÆ°´©¸¦°æ¿ì¿¡¸¸...
				if( document.all.btn1 != null && document.all.btn1.style != null ){
					document.all.btn1.style.visibility="hidden";
				}
				if( document.all.btn2 != null && document.all.btn2.style != null ){
					document.all.btn2.style.visibility="visible";
				}

				//·Î±×ÀÎÇÏÁö ¾Ê°í ¼­¸í ½Ã ÀüÀÚ¼­¸í ÈÄ Ä³½¬¸¦ »èÁ¦ÇÏ¿© ¸ðµç ÀÎÁõ¼­°¡ º¸ÀÌ°ÔÇÔ
				if (!CERTLOGIN){
					InitCache();
				}

				isSubmit=true;
				document.iniSendForm.submit();
				return true;
		}

		//·Î±×ÀÎÇÏÁö ¾Ê°í ¼­¸í ½Ã ÀüÀÚ¼­¸í ÈÄ Ä³½¬¸¦ »èÁ¦ÇÏ¿© ¸ðµç ÀÎÁõ¼­°¡ º¸ÀÌ°ÔÇÔ
		if (!CERTLOGIN){
			InitCache();
		}

	}
} 


// 2011.03.16		NEXTRO Ãß°¡(°Å·¡È£Ãâ SUBMITÇÒ ¶§ ÀüÀÚ¼­¸í±æÀÌ, ÀüÀÚ¼­¸í Æ÷ÇÔ)
function CertConfirmSignFormSubmit(obj,signStr,TrxID, flag) {
	if(isSubmit == false){	// Áßº¹ °Å·¡ Ã¼Å©
		if(validateForm(obj)){	// form µ¥ÀÌÅ¸ validation
			if(CertSignReConfirm(obj,signStr,TrxID) == false) {
				//alert("¾ÏÈ£È­Ã³¸®Áß ¿¡·¯¹ß»ý");
				isSubmit = false;
			}
			else{
/*
PkiCube/PkiCube_initech.js ÀÇ CertSignConfirm ¿¡¼­ Á¶ÀÛ...
				if(flag != "N"){
					if( document.all.btn1 != null && document.all.btn1.style != null ){
						document.all.btn1.style.visibility="hidden";
					}
					if( document.all.btn2 != null && document.all.btn2.style != null ){
						document.all.btn2.style.visibility="visible";
					}
				}
				isSubmit = true;
*/
			}
		}
	}
	else{
		alert("ÀÌ¹Ì Ã³¸®ÁßÀÔ´Ï´Ù. Àá½Ã¸¸ ±â´Ù·Á ÁÖ½Ê½Ã¿ä");
	}
	return false;
}

function fn_RadioBoxChecked(obj,setValue)
{
    var FLength = obj.length;
    var FValue = "";
    for(var i=0; i < FLength; i++)
    {
        if(obj[i].value == setValue){
            obj[i].checked = true;
            return;
        }
    }
}

function fn_SelectBox(obj, sbValue)
{
	for(var i=0; i < obj.length; i++)
	{
	    if(obj.options[i].value == sbValue){
	        obj.options[i].selected = true;
	    }
	}
}


/************map °´Ã¼ »ý¼º ***************/
function JsMap(){
 this._array = new Array();
 this.pointer = 0;
 this.getIndexNumByKey = function(key){
  for(var i=0; i < this._array.length; i++){
   if(key == this._array[i][0]){
    return i;
    break;
   }
  }
  return -1;
 };
 this.put = function(key, value){
  var index = this.getIndexNumByKey(key);
  if(index == -1){
   var newArray = new Array();
   newArray[0] = key;
   newArray[1] = value;
   this._array[this._array.length] = newArray;
  }else{
   this._array[index][1] = value;
  }
 };
 this.get = function(key){
  for(var i=0; i < this._array.length; i++){
   if(this._array[i][0] == key){
    return this._array[i][1];
   }
  }
 };
 this.inNext = function(){
  var result;
  if(this._array.length > this.pointer){
   result = true;
  }else{
   result = false;
  }
  this.pointer++;
  return result;
 };
 this.size = function(){
  return this._array.length;
 };
 this.nowKey = function(){
  return this._array[this.pointer - 1][0];
 };
 this.nowValue = function(){
  return this._array[this.pointer - 1][1];
 };
 this.getValueByIndex = function(index){
  if(index < this._array.length){
   return this._array[index][1];
  }else{
   return "";
  }
  
 };
 this.getKeyByIndex = function(index){
  if(index < this._array.length){
   return this._array[index][0];
  }else{
   return "";
  }
  
 };
}
/************map °´Ã¼ »ý¼º ***************/

