/****************************
faq.jsp ¿¡¼­ »ç¿ëµÇ´Â ½ºÅ©¸³Æ®
****************************/
function ask(){
	if(document.form.word.value == ""){
		alert("°Ë»öÇÏ°íÀÚ ÇÏ´Â ´Ü¾î¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		document.form.word.focus();
		return;
	}
	document.form.submit();
}

/*************************************
card_search_pop.jsp »ç¿ëÇÏ´Â ½ºÅ©¸³Æ® 
*************************************/
//ISP, ¾È½ÉÅ¬¸¯ Ä«µåÆ÷¸Ë ±¸ºÐ ½ºÅ©¸³Æ®
function Display( flag ) {
	form_name = document.cardInfo;
	form_name.Card_Select.value=flag;
	if ( form_name.Card_Select.value=="isp"){
		document.all.Ispold1Display.style.display = "none";
		document.all.Ispold2Display.style.display = "none";
		document.all.Ispold3Display.style.display = "none";
		document.all.Ispold4Display.style.display = "none";
		document.all.Isp1Display.style.display = "";
		document.all.Isp2Display.style.display = "";
		document.all.Isp3Display.style.display = "";
		document.all.Isp4Display.style.display = "";
		document.all.Visa1Display.style.display = "none";
		document.all.Visa2Display.style.display = "none";
		document.all.Visa3Display.style.display = "none";
		document.all.Visa4Display.style.display = "none";
		form_name.ispcardno1.value="";
		form_name.ispcardno2.value="";
		form_name.ispcardno3.value="****";
		form_name.ispcardno4.value="";
		form_name.deal_won.value="";
		form_name.Card_Method.value="isp";
	} else if (form_name.Card_Select.value=="ispold") {
		document.all.Ispold1Display.style.display = "";
		document.all.Ispold2Display.style.display = "";
		document.all.Ispold3Display.style.display = "";
		document.all.Ispold4Display.style.display = "";
		document.all.Isp1Display.style.display = "none";
		document.all.Isp2Display.style.display = "none";
		document.all.Isp3Display.style.display = "none";
		document.all.Isp4Display.style.display = "none";
		document.all.Visa1Display.style.display = "none";
		document.all.Visa2Display.style.display = "none";
		document.all.Visa3Display.style.display = "none";
		document.all.Visa4Display.style.display = "none";
		form_name.ispoldcardno1.value="";
		form_name.ispoldcardno2.value="";
		form_name.ispoldcardno3.value="";
		form_name.ispoldcardno4.value="****";
		form_name.deal_won.value="";
		form_name.Card_Method.value="ispold";
	} else {
		document.all.Ispold1Display.style.display = "none";
		document.all.Ispold2Display.style.display = "none";
		document.all.Ispold3Display.style.display = "none";
		document.all.Ispold4Display.style.display = "none";
		document.all.Isp1Display.style.display = "none";
		document.all.Isp2Display.style.display = "none";
		document.all.Isp3Display.style.display = "none";
		document.all.Isp4Display.style.display = "none";
		document.all.Visa1Display.style.display = "";
		document.all.Visa2Display.style.display = "";
		document.all.Visa3Display.style.display = "";
		document.all.Visa4Display.style.display = "";
		form_name.visacardno1.value="";
		form_name.visacardno2.value="";
		form_name.visacardno3.value="";
		form_name.visacardno4.value="";
		form_name.deal_won.value="";
		form_name.Card_Method.value="visa";
	}
}

//³¯Â¥ °Ë»ö½Ã ¼±ÅÃ select¹® ½ºÅ©¸³Æ®
function sneddt_disp_thr()
{
	today = new Date();
	year=today.getFullYear();
	month=today.getMonth();
	month+=1;
	if(month <10) month="0" + month;
	date=today.getDate();
	if(date<10) date="0" + date;

	// °Ë»ö ½ÃÀÛ ÀÏÀÚ 
	document.writeln("<select name=from_yy class='formbox_input'>");
	for (index=2002;index <= 2010;index++) {
		if(index==year) document.writeln("<option value=" + index + " selected>" + index);
		else document.writeln("<option value=" + index + ">" + index);
	}  	
	document.writeln("</select> ³â");

	document.writeln("<select name=from_mm class='formbox_input'>");	
	for (index=1;index <= 12;index++) {
		if(index==month){
			if(index <10) document.writeln("<option value=0" + index + " selected>0" + index);
			else document.writeln("<option value=" + index + " selected>" + index);
		}else{
			if(index <10) document.writeln("<option value=0" + index + ">0" + index);
			else document.writeln("<option value=" + index + ">" + index);
		}
	}
	document.writeln("</select> ¿ù");

	document.writeln("<select name=from_dd class='formbox_input'>");	
	for (index=1;index <= 31;index++) {
		if(index==date){
			if(index <10) document.writeln("<option value=0" + index + " selected>0" + index);
			else document.writeln("<option value=" + index + " selected>" + index);
		}else {
			if(index <10) document.writeln("<option value=0" + index + ">0" + index);
			else document.writeln("<option value=" + index + ">" + index);
		}
	}
	document.writeln("</select> ÀÏºÎÅÍ&nbsp;&nbsp;  &nbsp;");
	// °Ë»ö Á¾·á ÀÏÀÚ
	document.writeln("<select name=to_yy class='formbox_input'>");
	for (index=2002;index <= 2010;index++) {
		if(index==year) document.writeln("<option value=" + index + " selected>" + index);
		else document.writeln("<option value=" + index + ">" + index);
	}
	document.writeln("</select>³â");

	document.writeln("<select name=to_mm class='formbox_input'>");
	for (index=1;index <= 12;index++) {
		if(index==month){
			if(index <10) document.writeln("<option value=0" + index + " selected>0" + index);
			else document.writeln("<option value=" + index + " selected>" + index); 
		}else {
			if(index <10) document.writeln("<option value=0" + index + ">0" + index);
			else document.writeln("<option value=" + index + ">" + index);
		}
	}
	document.writeln("</select>¿ù");

	document.writeln("<select name=to_dd class='formbox_input'>");
	for (index=1;index <= 31;index++) {
		if(index==date){
			if(index <10) document.writeln("<option value=0" + index + " selected>0" + index);
			else document.writeln("<option value=" + index + " selected>" + index);
		}else {
			if(index <10) document.writeln("<option value=0" + index + ">0" + index);
			else document.writeln("<option value=" + index + ">" + index);
		}
	}
	document.writeln("</select> ÀÏ±îÁö");
}

//ÀÚµ¿ Æ÷Ä¿½º ÀÌµ¿(ÇöÀç°´Ã¼, ÀÌµ¿°´Ã¼, MaxLength)
function autoFocus(input1, input2, maxLen) {
	if(input1.value.length == maxLen && event.keyCode != 9 && event.keyCode != 16) input2.focus() ;
}

//µ¥ÀÌÅÍ Ã¼Å© ¹× card_result.jsp·Î ³»¿ë submit
function sendData(form_name)
{
	//°áÁ¦ ±Ý¾× Ã¼Å©
	var check_num = form_name.deal_won.value + "";
	if ( check_num == "") {
		alert("°Å·¡±Ý¾×À» ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		return;
	}
	for ( var i = 0; i < check_num.length; i++ ){
		if ( check_num.charAt(i) < "0" || check_num.charAt(i) >  "9") {
			alert("°áÁ¦±Ý¾×Àº ¼ýÀÚ¸¸À¸·Î ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
			return;
		}
	}
	
	// Ä«µå ¹øÈ£ Ã¼Å©
	if( form_name.Card_Method.value == 'isp' ) {
		if( form_name.ispcardno1.value.length < 4 ) {
			 alert("Ä«µå¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
			 form_name.ispcardno1.focus()
			 return;
		}
		if( form_name.ispcardno2.value.length < 4 ) {
			 alert("Ä«µå¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
			 form_name.ispcardno2.focus()
			 return;
		}
		if( form_name.ispcardno4.value.length < 4 ) {
			 alert("Ä«µå¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
			 form_name.ispcardno4.focus()
			 return;
		}
		form_name.ispcardno.value = form_name.ispcardno1.value + form_name.ispcardno2.value + form_name.ispcardno4.value;
		if( form_name.ispcardno.value.length < 12) {
			alert("Ä«µå¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
			return;
		}
	} else if ( form_name.Card_Method.value == 'ispold' ) {
		if( form_name.ispoldcardno1.value.length < 4 ) {
			 alert("Ä«µå¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
			 form_name.ispoldcardno1.focus()
			 return;
		}
		if( form_name.ispoldcardno2.value.length < 4 ) {
			 alert("Ä«µå¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
			 form_name.ispoldcardno2.focus()
			 return;
		}
		if( form_name.ispoldcardno3.value.length < 4 ) {
			 alert("Ä«µå¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
			 form_name.ispoldcardno3.focus()
			 return;
		}
		form_name.ispoldcardno.value = form_name.ispoldcardno1.value + form_name.ispoldcardno2.value + form_name.ispoldcardno3.value;
		if( form_name.ispoldcardno.value.length < 12) {
			alert("Ä«µå¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
			return;
		}
	} else {
		if( form_name.visacardno1.value.length < 4 ) {
			 alert("Ä«µå¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
			 form_name.visacardno1.focus()
			 return;
		}
		if( form_name.visacardno2.value.length < 4 ) {
			 alert("Ä«µå¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
			 form_name.visacardno2.focus()
			 return;
		}
		if( form_name.visacardno3.value.length < 4 ) {
			 alert("Ä«µå¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
			 form_name.visacardno3.focus()
			 return;
		}
		if( form_name.visacardno4.value.length < 2 ) {
			 alert("Ä«µå¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
			 form_name.visacardno4.focus()
			 return;
		}
		form_name.visacardno.value = form_name.visacardno1.value + form_name.visacardno2.value + form_name.visacardno3.value + form_name.visacardno4.value;
		if( form_name.visacardno.value.length < 14) {
			alert("Ä«µå¹øÈ£ 14ÀÚ¸® ¶Ç´Â 16ÀÚ¸®¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
			return;
		}
	}

	// °áÁ¦ ÀÏÀÚ Ã¼Å©
	from_y = Number(form_name.from_yy.value);
	from_m = Number(form_name.from_mm.value);
	from_d = Number(form_name.from_dd.value);
	to_y = Number(form_name.to_yy.value);
	to_m = Number(form_name.to_mm.value);
	to_d = Number(form_name.to_dd.value);

	if( (to_y - from_y) < 0 ) {
		alert("Àß¸øµÈ Á¶È¸ ±â°£ ÀÔ´Ï´Ù \n ´Ù½Ã È®ÀÎÇÏ½Ã°í ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		return;
	} else if ( (to_y - from_y) == 0 ){
		if ( (to_m - from_m) < 0 ){
			alert("Àß¸øµÈ Á¶È¸ ±â°£ ÀÔ´Ï´Ù \n ´Ù½Ã È®ÀÎÇÏ½Ã°í ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
			return;
		} else if ( (to_m - from_m) > 1 ){
			alert("Á¶È¸±â°£Àº 1´ÞÀ» ÃÊ°úÇÒ ¼ö ¾ø½À´Ï´Ù.");
			return;
		} else if ( (to_m - from_m) == 0 ){ 
			if ( (to_d - from_d) < 0 ) {
				alert("Àß¸øµÈ Á¶È¸ ±â°£ ÀÔ´Ï´Ù \n ´Ù½Ã È®ÀÎÇÏ½Ã°í ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
				return;
			}
		} else if ( (to_m - from_m) == 1 ){
			if ( from_d < to_d ){
				alert("Á¶È¸±â°£Àº 1´ÞÀ» ÃÊ°úÇÒ ¼ö ¾ø½À´Ï´Ù.");
				return;
			} else if ( from_d == to_d ){
				alert("Á¶È¸±â°£Àº 1´ÞÀ» ÃÊ°úÇÒ ¼ö ¾ø½À´Ï´Ù.");
				return;
			}
		}
	} else if ( (to_y - from_y) > 1) {
		alert("Á¶È¸±â°£Àº 1´ÞÀ» ÃÊ°úÇÒ ¼ö ¾ø½À´Ï´Ù.");
		return;
	} else {
		if( (from_m - to_m) != 11) {
			alert("Á¶È¸±â°£Àº 1´ÞÀ» ÃÊ°úÇÒ ¼ö ¾ø½À´Ï´Ù.");
			return;
		} else {
			if ( from_d < to_d ){
				alert("Á¶È¸±â°£Àº 1´ÞÀ» ÃÊ°úÇÒ ¼ö ¾ø½À´Ï´Ù.");
				return;
			} else if ( from_d == to_d ){
				alert("Á¶È¸±â°£Àº 1´ÞÀ» ÃÊ°úÇÒ ¼ö ¾ø½À´Ï´Ù.");
				return;
			}
		}
	}

	form_name.submit();
}


/*******************************
inquiry.jsp ¿¡¼­ »ç¿ëµÇ´Â ½ºÅ©¸³Æ®
*******************************/
function check(form){
	
	if(form.gubun_select[0].checked==false && form.gubun_select[1].checked==false){
		alert("Áú¹® À¯ÇüÀ» ¼±ÅÃÇØÁÖ¼¼¿ä.");
		return;
	}
	if(form.gubun_select[0].checked==true){
		form.gubun.value = "0";
	}else if(form.gubun_select[1].checked==true){
		form.gubun.value = "1";
	}

	if(form.subject_gubun[1].checked==true) {
		if(form.user_id.value == ""){
			alert("»óÁ¡ID¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.");
			form.user_id.focus();
			return;
		}
		if(form.user_id.value.length < 6 || form.user_id.value.length > 20){
			alert("»óÁ¡ID´Â 6ÀÚÀÌ»ó 20ÀÚÀÌÇÏ·Î ÀÔ·ÂÇØÁÖ¼¼¿ä.");
			form.user_id.focus();
			return;
		}
		
		var num = "abcdefghijklmnopqrstuvwxyz0123456789";
		hangul = form.user_id.value;

		for (var i=0;i<hangul.length;i++) {
			if(-1 == num.indexOf(hangul.charAt(i))) {
				alert("¿µ¹® ´ë¹®ÀÚ¿Í Æ¯¼ö ¹®ÀÚ·Î ÀÌ·ç¾îÁø »óÁ¡ID´Â ¾ø½À´Ï´Ù.");
				form.user_id.focus();
				return;
			}
		}

		if(form.id_check_flag.value != "y"){
			alert("ID°¡ È®ÀÎµÇÁö ¾Ê¾Ò½À´Ï´Ù.");
			return;
		}
	}
			
	if(form.username.value == ""){
		alert("ÀÛ¼ºÀÚ¸¦ ÀÔ·ÂÇÏ¼¼¿ä");
		form.username.focus();
		return;
	}
	if(form.username.value.length > 10){
		alert("ÀÛ¼ºÀÚ´Â 10ÀÚ ÀÌ³»·Î ÀÔ·ÂÇÏ¼¼¿ä.");
		form.username.focus();
		return;
	}


/*
	if(document.form.passwd.value == ""){
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		document.form.passwd.focus();
		return;
	}
	if(document.form.passwd.value.length < 4 || document.form.passwd.value.length > 10){
		alert("ºñ¹Ð¹øÈ£´Â 4ÀÚÀÌ»ó 10ÀÚÀÌ³»·Î ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		document.form.passwd.focus();
		return;
	}
*/
	if(form.mail1.value == ""){
		alert("ÀÌ¸ÞÀÏÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		form.mail1.focus();
		return;
	}
	if(form.mail2.value == "00" && form.mail3.value == ""){
		alert("ÀÌ¸ÞÀÏÀ» ÀÛ¼ºÇØ ÁÖ¼¼¿ä.");
		form.mail3.focus();
		return;
	}
	if(form.mail2.value == "00"){
		form.mail.value = form.mail1.value + "@" + form.mail3.value;
	}else{
		form.mail.value = form.mail1.value + "@" + form.mail2.value;
	}
	form.tel_no.value = form.tel_no1.value + "-" + form.tel_no2.value + "-" + form.tel_no3.value;
	if(form.tel_no1.value == "" || form.tel_no2.value == "" || form.tel_no3.value == ""){
		alert("ÀüÈ­¹øÈ£¸¦ È®ÀÎÇØ ÁÖ¼¼¿ä.");
		form.tel_no1.focus();
		return;
	}
	if(form.subject.value == ""){
		alert("Á¦¸ñÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		form.subject.focus();
		return;
	}
	if(form.subject.value.length > 40){
		alert("Á¦¸ñÀº 40ÀÚ ÀÌ³»·Î ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		form.subject.focus();
		return;
	}
	if(form.contents.value == ""){
		alert("³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		form.contents.focus();
		return;
	}
	if(form.contents.value.length > 2000){
		alert("³»¿ëÀº 2000ÀÚ ÀÌ³»·Î ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		form.contents.focus();
		return;
	}
	if(!form.privacyAgreeCheck.checked){
		alert("»ó´ãµî·ÏÀ» À§ÇØ¼­ °³ÀÎÁ¤º¸Á¦°ø¿¡ µ¿ÀÇÇØÁÖ½Ê½Ã¿À.\n¼öÁýµÈ Á¤º¸(¼º¸í,ÀÌ¸ÞÀÏ,¿¬¶ôÃ³)´Â ´äº¯¿ëµµ ¿Ü¿¡´Â »ç¿ëµÇÁö ¾Ê½À´Ï´Ù.");
		form.privacyAgreeCheck.focus();
		return;
	}
	
	if(form.subject_gubun[1].checked==true) {
		form.contents.value = "* »óÁ¡¾ÆÀÌµð : " + form.user_id.value + "<br><br>" + form.contents.value;
	}

	form.submit();
}

/*******************************
application.jsp ¿¡¼­ »ç¿ëµÇ´Â ½ºÅ©¸³Æ®
*******************************/
function send_data() {
	form_name = document.retailer_joining;  
	
	if(form_name.customer_name.value  ==""){
		alert("°í°´¸íÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		form_name.customer_name.focus();
		return;
	}
	
	/*
	form_name.customer_no.value = form_name.customer_no1.value + form_name.customer_no2.value;
	if (form_name.customer_no.value.length != 13 )
	{
		alert("ÁÖ¹Îµî·Ï¹øÈ£¸¦ È®ÀÎÇØ ÁÖ¼¼¿ä.");
		form_name.customer_no1.focus();
		return;
	}
	*/
	if(form_name.customer_tel.value == ""){
		alert("¿¬¶ôÃ³¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		form_name.customer_tel.focus();
		return;
	}

	if(form_name.customer_email_fir.value == ""){
		alert("ÀÌ¸ÞÀÏÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		form_name.customer_email_fir.focus();
		return;
	}

	if(form_name.customer_email_sec.value == "00" && form_name.customer_email_thi.value == ""){
		alert("ÀÌ¸ÞÀÏÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		form_name.customer_email_thi.focus();
		return;
	}

	if(form_name.customer_email_sec.value == "00"){
		form_name.customer_email.value = form_name.customer_email_fir.value + "@" + form_name.customer_email_thi.value;
	}else{
		form_name.customer_email.value = form_name.customer_email_fir.value + "@" + form_name.customer_email_sec.value;
	}

	form_name.customer_zipcd.value = form_name.customer_zipcd1.value + form_name.customer_zipcd2.value;

	if(form_name.customer_zipcd.value.length != 6){
		alert("¿ìÆí¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		return;
	}
	if(form_name.customer_addr1.value == ""){
		alert("ÁÖ¼ÒÀÔ·ÂÀ» È®ÀÎÇØ ÁÖ¼¼¿ä.");
		return;
	}
	if(form_name.customer_addr2.value == ""){
		alert("»ó¼¼ÁÖ¼Ò¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		form_name.customer_addr2.focus();
		return;
	}
	if(form_name.customer_addr2.value.length > 50){
		alert("»ó¼¼ÁÖ¼Ò´Â 50ÀÚÀÌ³»·Î ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		form_name.customer_addr2.focus();
		return;
	}

	if(form_name.adm_dt.value == ""){
		alert("Ä«µå°Å·¡³»¿ªÀ» Á¶È¸ÇØ ÁÖ¼¼¿ä");
		return;
	}

	if(form_name.subject.value == ""){
		alert("¹Î¿ø Á¦¸ñÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		form_name.subject.focus();
		return;
	}

	if(form_name.discontent.value == ""){
		alert("¹Î¿ø ³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		form_name.discontent.focus();
		return;
	}

	if(form_name.discontent.length > 500){
		alert("¹Î¿ø ³»¿ëÀº 500ÀÚÀÌ³»·Î ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		form_name.discontent.focus();
		return;
	}

	if(!form_name.privacyAgreeCheck.checked){
		alert("¹Î¿øÁ¢¼ö¸¦ À§ÇØ¼­ °³ÀÎÁ¤º¸Á¦°ø¿¡ µ¿ÀÇÇØÁÖ½Ê½Ã¿À.\n¼öÁýµÈ Á¤º¸(¼º¸í,ÀÌ¸ÞÀÏ,¿¬¶ôÃ³)´Â ´äº¯¿ëµµ ¿Ü¿¡´Â »ç¿ëµÇÁö ¾Ê½À´Ï´Ù.");
		form_name.privacyAgreeCheck.focus();
		return;
	}
	

	form_name.submit();
}