function openwin()	{
	window.open("/member/zipsearch.php", "¿ìÆí¹øÈ£Ã£±â","width=380, height=140, toolbar=no, status=no, menubar=no, scrollbars=no");
}

function openwin_cust()	{
	window.open("code_srch.php?code=1", "°Å·¡Ã³¸í°Ë»ö","width=540, height=240, toolbar=no, status=no, menubar=no, scrollbars=yes");
}

function openwin_prd_code()	{
	window.open("code_srch.php?code=2", "¹°Ç°ÄÚµå°Ë»ö","width=540, height=240, toolbar=no, status=no, menubar=no, scrollbars=yes");
}

function openwin_shop()	{
	window.open("/shop2/zipsearch.php", "¿ìÆí¹øÈ£Ã£±â","width=490, height=260, toolbar=no, status=no, menubar=no, scrollbars=no");
}

function openwin_id_pw()	{
//	alert('test');
	window.open("/member/pwd_search_new.php", "¾ÆÀÌµðºñ¹Ð¹øÈ£Ã£±â","width=400, height=260, toolbar=no, status=no, menubar=no, scrollbars=no");
}

function openwin2()	{
	tvalue=document.gaip.uid.value;
	if( tvalue == "" )	{
		alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿ä");
		document.gaip.uid.focus();
		return;
	}
//	alert(login_iframe.location);
	login_iframe.location.href="/member/id_check.php?cuid="+tvalue;
}

function id_no_chk(obj1)
{
	var li_lastid,li_mod,li_minus,li_last;
	var value0,value1,value2,value3,value4,value5,value6;
	var value7,value8,value9,value10,value11,value12;
	var str1 = obj1.value ;

	if (IsInteger(str1)) {
		li_lastid = parseFloat(str1.substring(12,13));
		value0  = parseFloat(str1.substring(0,1)) * 2;
		value1  = parseFloat(str1.substring(1,2)) * 3;
		value2  = parseFloat(str1.substring(2,3)) * 4;
		value3  = parseFloat(str1.substring(3,4)) * 5;
		value4  = parseFloat(str1.substring(4,5)) * 6;
		value5  = parseFloat(str1.substring(5,6)) * 7;
		value6  = parseFloat(str1.substring(6,7)) * 8;
		value7  = parseFloat(str1.substring(7,8)) * 9;
		value8  = parseFloat(str1.substring(8,9)) * 2;
		value9  = parseFloat(str1.substring(9,10)) * 3;
		value10 = parseFloat(str1.substring(10,11)) * 4;
		value11 = parseFloat(str1.substring(11,12)) * 5;
		value12 = value0 + value1 + value2 + value3 + value4 + value5 +
				  value6 + value7 + value8 + value9 + value10 + value11;

		li_mod = value12 % 11;
		li_minus = 11 - li_mod;
		li_last = li_minus % 10;
		if (li_last != li_lastid) {
			obj1.select();
			obj1.focus();
			return false;
		}
		else
		return true;
	}
	else {
		obj1.select();
		obj1.focus();
		return false;
	}
}


function id_no_chk_new(obj1)
{
	var li_lastid,li_mod,li_minus,li_last;
	var value0,value1,value2,value3,value4,value5,value6;
	var value7,value8,value9,value10,value11,value12;
	var str1 = obj1 ;

	if (IsInteger(str1)) {
		li_lastid = parseFloat(str1.substring(12,13));
		value0  = parseFloat(str1.substring(0,1)) * 2;
		value1  = parseFloat(str1.substring(1,2)) * 3;
		value2  = parseFloat(str1.substring(2,3)) * 4;
		value3  = parseFloat(str1.substring(3,4)) * 5;
		value4  = parseFloat(str1.substring(4,5)) * 6;
		value5  = parseFloat(str1.substring(5,6)) * 7;
		value6  = parseFloat(str1.substring(6,7)) * 8;
		value7  = parseFloat(str1.substring(7,8)) * 9;
		value8  = parseFloat(str1.substring(8,9)) * 2;
		value9  = parseFloat(str1.substring(9,10)) * 3;
		value10 = parseFloat(str1.substring(10,11)) * 4;
		value11 = parseFloat(str1.substring(11,12)) * 5;
		value12 = value0 + value1 + value2 + value3 + value4 + value5 +
				  value6 + value7 + value8 + value9 + value10 + value11;

		li_mod = value12 % 11;
		li_minus = 11 - li_mod;
		li_last = li_minus % 10;
		if (li_last != li_lastid) {
			obj1.select();
			obj1.focus();
			return false;
		}
		else
		return true;
	}
	else {
		obj1.select();
		obj1.focus();
		return false;
	}
}


function IsInteger(st)
{
	if (!IsEmpty(st)) {
		for (j = 0; j < st.length; j++)
			if (((st.substring(j, j+1) < "0") || (st.substring(j, j+1) > "9")))
				return false;
	}
	else
		return false;

	return true;
}

function IsEmpty(toCheck)
{
	var chkstr = toCheck + "";
	var is_Space = true;

	if (( chkstr == "") || (chkstr == null))
		return false;

	for (j = 0; is_Space && j < chkstr.length; j++) {
		if (chkstr.substring(j, j+1) != " ")
			is_Space = false ;
	}

	return is_Space;
}

function check_num(str) {
	num = new Array(13);
	digit = new Array(12);
	digit[1] = 2
	digit[2] = 3
	digit[3] = 4
	digit[4] = 5
	digit[5] = 6
	digit[6] = 7
	digit[7] = 8
	digit[8] = 9
	digit[9] = 2
	digit[10] = 3
	digit[11] = 4
	digit[12] = 5
	for(j = 1; j <= 13; j++) {
	      num[j] = parseInt(str.charAt(j - 1), 10)
	}
	if (num[7] != 3 && num[7] != 4) {
	      sum = 0;
		for(i=1; i<=12; i++) {
			sum += digit[i] * num[i];
		}
		div = (sum % 11);
		if ( div == 1 ) {
			comp = 0;
		} else 
			if(div == 0) {
				comp = 1;
			} else 
			if ( (div != 0) && (div != 1) ) {
				comp = 11 - div;
			}
	   		if (div == 0) {
		   		if(num[13] == 1)
		   		return true;
      			else
				return false;
  			} else 
			if(div == 1) {
  				if(num[13] == 0)
  					return true;
  				else
  					return false;
      	} else 
			if((11-div) == num[13]) {
         	return true;
      	} else {
         	return false;
      	}
      } else {
			if (num[3] != 0 && num[3] != 1) {
				return false;
			} else 
			if (num[5] != 0 && num[5] != 1 && num[5] != 2 && num[5] != 3) {
				return false;
			} else 
			if (num[7] != 1 && num[7] != 2 && num[7] != 3 && num[7] != 4) {
				return false;
			} else 
			if (num[3] == 0 && num[4] == 0) {
				return false;
			} else 
			if ((num[3] == 1) && (num[4] != 0 && num[4] != 1 && num[4] != 2)) {
				return false;
			} else 
			if (num[5] == 0 && num[6] == 0) {
				return false;
			} else 
			if (num[5] == 3 && (num[6] != 0 && num[6]  != 1)) {
				return false;
			} else 
				return true;
		}
}

function go_submit()	{

	if( document.gaip.job.value == '13' && document.gaip.school_name.value=='' ){
		alert("±³Á÷ÀÚ/ÇÐ¿ø°­»çÀÎ °æ¿ì ÇÐ±³¸íÀ» ÀÔ·ÂÇØÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
		document.gaip.school_name.focus();
		return;
	}

	if( document.gaip.job.value == '13' && document.gaip.school_tel.value=='' ){
		alert("±³Á÷ÀÚ/ÇÐ¿ø°­»çÀÎ °æ¿ì ÇÐ±³ÀüÈ­¸¦ ÀÔ·ÂÇØÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
		document.gaip.school_tel.focus();
		return;
	}

	if( document.gaip.uid.value == "" )	{alert("È¸¿øID¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.uid.focus(); return; }
	if( document.gaip.pwd.value == "" )	{alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.pwd.focus(); return; }
	if( document.gaip.name.value == "" ){alert("ÀÌ¸§¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.name.focus(); return; }
	if( document.gaip.tel.value == "" )	{alert("ÀüÈ­¹øÈ£¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.tel.focus(); return; }
	if( document.gaip.zipcode.value == "" )	{alert("¿ìÆí¹øÈ£¸¦ ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.zipcode.focus(); return; }
	if( document.gaip.addr1.value == "" )	{alert("ÁÖ¼Ò¸¦ ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.addr1.focus(); return; }
	if( document.gaip.email.value == "" )	{alert("E-MailÀ» ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.email.focus(); return; }
	if( document.gaip.tel.value == "" )	{alert("ÀüÈ­¹øÈ£¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.tel.focus(); return; }
	if( document.gaip.jumin.value == "" )	{alert("ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.jumin.focus(); return; }

	if ( check_num(document.gaip.jumin.value) != true ) {
		alert("ÁÖ¹Îµî·Ï¹øÈ£°¡ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.");
		document.gaip.jumin.focus();
		return;
	}

	if (id_no_chk(document.gaip.jumin) == false) {
		alert("ÁÖ¹Îµî·Ï¹øÈ£°¡ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù." );
		document.gaip.jumin.focus();
		return;
	}
	document.gaip.submit();
}

function go_submit2(){//Á¤º¸ ¼öÁ¤

	if( document.gaip.job.value == '13' && document.gaip.school_name.value=='' ){
		alert("±³Á÷ÀÚ/ÇÐ¿ø°­»çÀÎ °æ¿ì ÇÐ±³¸íÀ» ÀÔ·ÂÇØÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
		document.gaip.school_name.focus();
		return;
	}

	if( document.gaip.job.value == '13' && document.gaip.school_tel.value=='' ){
		alert("±³Á÷ÀÚ/ÇÐ¿ø°­»çÀÎ °æ¿ì ÇÐ±³ÀüÈ­¸¦ ÀÔ·ÂÇØÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
		document.gaip.school_tel.focus();
		return;
	}
	document.gaip.submit();
}


function go_submit_new()	{//ÃÖÃÊ°¡ÀÔ½Ã 2006-02-14 ¼îÇÎ¸ô¼öÁ¤
	if (document.gaip.mem_chk.checked==false ){
		alert("¾à°ü¿¡ µ¿ÀÇÇÏ¼Å¾ß È¸¿ø°¡ÀÔÀÌ °¡´ÉÇÕ´Ï´Ù!");
		document.gaip.mem_chk.focus();
		return;
	}
	if( document.gaip.job.value == '13' && document.gaip.school_name.value=='' ){
		alert("±³Á÷ÀÚ/ÇÐ¿ø°­»çÀÎ °æ¿ì ÇÐ±³¸íÀ» ÀÔ·ÂÇØÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
		document.gaip.school_name.focus();
		return;
	}
	if( document.gaip.job.value == '13' && document.gaip.school_tel.value=='' ){
		alert("±³Á÷ÀÚ/ÇÐ¿ø°­»çÀÎ °æ¿ì ÇÐ±³ÀüÈ­¸¦ ÀÔ·ÂÇØÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
		document.gaip.school_tel.focus();
		return;
	}

	if( document.gaip.uid.value == "" )	{alert("È¸¿øID¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.uid.focus(); return; }
	if( document.gaip.pwd.value == "" ){alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.pwd.focus(); return; }
	if( document.gaip.pwd1.value == "" ){alert("ºñ¹Ð¹øÈ£ È®ÀÎÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.pwd1.focus(); return; }
//	if( document.gaip.name.value == "" ){alert("ÀÌ¸§¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.name.focus(); return; }


//2006-07-26 ±âÁ¸°Í°ú µ¿½Ã¿¡ ¸¸Á·ÇÏ±â À§ÇØ¼­ Æí¹ý
	obj=document.getElementsByName('mem_type');
	len=obj.length;//len=0ÀÌ¸é mem_type ¾ø°í len=1ÀÌ¸é mem_type ÀÖÀ½

	if ( len>0 ){//mem_type ÀÖ´Â °æ¿ì¸¸ Ã¼Å© mem_typeÀÌ 2°³°¡ ÀÖÀ¸¹Ç·Î lenÀº 2
		if ( document.gaip.mem_type[1].checked == true ){//¹ýÀÎÀÌ Ã¼Å©µÈ °æ¿ì
			if( document.gaip.mem_type2.value == "" ){alert("±¸ºÐÀ» ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.mem_type2.focus(); return; }
			if( document.gaip.com_name.value == "" ){alert("»óÈ£¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.com_name.focus(); return; }
			if( document.gaip.biz_no1.value == "" ){alert("»ç¾÷ÀÚ¹øÈ£¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.biz_no1.focus(); return; }
			if( document.gaip.biz_no2.value == "" ){alert("»ç¾÷ÀÚ¹øÈ£¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.biz_no2.focus(); return; }
			if( document.gaip.biz_no3.value == "" ){alert("»ç¾÷ÀÚ¹øÈ£¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.biz_no3.focus(); return; }

			if( document.gaip.com_ceo.value == "" ){alert("´ëÇ¥ÀÚ¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.com_ceo.focus(); return; }
			if( document.gaip.com_addr.value == "" ){alert("»ç¾÷Àå¼ÒÀçÁö¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.com_addr.focus(); return; }
			if( document.gaip.com_type1.value == "" ){alert("¾÷ÅÂ¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.com_type1.focus(); return; }
			if( document.gaip.com_type2.value == "" ){alert("¾÷Á¾À» ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.com_type2.focus(); return; }
//			alert("test 2");
		}
		else{//°³ÀÎÀÌ Ã¼Å©µÈ °æ¿ì
			if( document.gaip.name.value == "" ){alert("ÀÌ¸§À» ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.name.focus(); return; }
			if( document.gaip.jumin1.value == "" ){alert("ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.jumin1.focus(); return; }
			if( document.gaip.jumin2.value == "" ){alert("ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.jumin2.focus(); return; }
			var jumin_str = document.gaip.jumin1.value + document.gaip.jumin2.value;
			if ( check_num(jumin_str) != true ) {
				alert("ÁÖ¹Îµî·Ï¹øÈ£°¡ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.");
				document.gaip.jumin1.value="";
				document.gaip.jumin2.value="";
				document.gaip.jumin1.focus();
				return;
			}
		}
	}
	else{//mem_typeÀÌ ¾ø´Â °æ¿ì (±âÁ¸ °æ¿ì°¡ ¿©±â¿¡ ÇØ´çµÊ)
		if( document.gaip.jumin1.value == "" ){alert("ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.jumin1.focus(); return; }
		if( document.gaip.jumin2.value == "" ){alert("ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.jumin2.focus(); return; }
		var jumin_str = document.gaip.jumin1.value + document.gaip.jumin2.value;
		if ( check_num(jumin_str) != true ) {
			alert("ÁÖ¹Îµî·Ï¹øÈ£°¡ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.");
			document.gaip.jumin1.value="";
			document.gaip.jumin2.value="";
			document.gaip.jumin1.focus();
			return;
		}
	}
/*
if ( document.gaip.mem_type.value == "2" ){

	alert("test 2");

}
else{

	if( document.gaip.jumin1.value == "" ){alert("ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.jumin1.focus(); return; }
	if( document.gaip.jumin2.value == "" ){alert("ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.jumin2.focus(); return; }
	var jumin_str = document.gaip.jumin1.value + document.gaip.jumin2.value;
	if ( check_num(jumin_str) != true ) {
		alert("ÁÖ¹Îµî·Ï¹øÈ£°¡ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.");
		document.gaip.jumin1.value="";
		document.gaip.jumin2.value="";
		document.gaip.jumin1.focus();
		return;
	}

}
*/

	if( document.gaip.zipcode.value == "" ){alert("¿ìÆí¹øÈ£¸¦ ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.zipcode.focus(); return; }
	if( document.gaip.addr1.value == "" ){alert("ÁÖ¼Ò¸¦ ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.addr1.focus(); return; }
	if( document.gaip.hp.value == "" ){alert("ÇÚµåÆù¹øÈ£¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.hp.focus(); return; }
	if( document.gaip.email.value == "" ){alert("E-MailÀ» ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.email.focus(); return; }
	if( document.gaip.job.value == "" )	{alert("Á÷¾÷À» ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿ä"); document.gaip.job.focus(); return; }

/*
	if (id_no_chk(jumin_str) == false) {
		alert("ÁÖ¹Îµî·Ï¹øÈ£°¡ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù." );
		document.gaip.jumin1.focus();
		return;
	}
*/

	document.gaip.submit();
}
function go_submit2_new(){//Á¤º¸ ¼öÁ¤ 2006-02-14 ¼îÇÎ¸ô¼öÁ¤

	if( document.gaip.job.value == '13' && document.gaip.school_name.value=='' ){
		alert("±³Á÷ÀÚ/ÇÐ¿ø°­»çÀÎ °æ¿ì ÇÐ±³¸íÀ» ÀÔ·ÂÇØÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
		document.gaip.school_name.focus();
		return;
	}

	if( document.gaip.job.value == '13' && document.gaip.school_tel.value=='' ){
		alert("±³Á÷ÀÚ/ÇÐ¿ø°­»çÀÎ °æ¿ì ÇÐ±³ÀüÈ­¸¦ ÀÔ·ÂÇØÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
		document.gaip.school_tel.focus();
		return;
	}

	document.gaip.submit();

}



function go_memberout(ver){
	if (confirm('Á¤¸» Å»ÅðÇÏ½Ã°Ú½À´Ï±î? Å»ÅðÇÏ½Ã¸é °°Àº¾ÆÀÌµð·Î Àç°¡ÀÔÇÏ½Ç¼ö ¾ø½À´Ï´Ù.')){
		document.location.href='out.php?ver='+ver;
	}
}
