
<!--
function LengthCheck(InObj, InMsg){
var str1; 
str1 = InObj.value; 
if ( str1.length < 3)
{ 
        alert(InMsg + ' 3ÀÚ¸® ÀÌ»ó ÀÔ·ÂÇØ¾ß ÇÕ´Ï´Ù.');
        InObj.focus();
        InObj.select();
        return true;
}
return false;
}

// ÀÔ·Â°ª °ø¹é Ã¼Å© ÇÔ¼ö
function isEmpty( data )
{
	for ( var i = 0 ; i < data.length ; i++ )
	{
		if ( data.substring( i, i+1 ) != " " )
			return false;
	}
	return true;
}

function NullCheck(InObj, InMsg){ 
if( InObj.value == "") 
{       
 alert(InMsg + ' ÀÔ·ÂÇÏ½Ê½Ã¿À.'); 
        InObj.focus(); 
        InObj.select();
        return true;
 }
return false;
 }

 
function NumStrLengthCheck(InStr, Length)
{
if ( (InStr.length != 0) &&
   (!isNaN(InStr)) &&
   (InStr.length == Length))
                return true;
else
        return false;
}

function NumberCheck(InObj, InMsg, Length)
{
if (NumStrLengthCheck(InObj.value, Length))
        return true;
alert(InMsg + ' ' + Length + 'ÀÚ¸®·Î ÀÔ·ÂÇÏ½Ê½Ã¿À.');
InObj.focus();
InObj.select();
return false;
}

function newNumberCheck(InObj, InMsg)
{
if (newNumStrLengthCheck(InObj.value))
        return true;
alert(InMsg + ' ' + '¼ýÀÚ·Î ÀÔ·ÂÇÏ½Ê½Ã¿À.');
InObj.focus();
InObj.select();
return false;
}

function newNumStrLengthCheck(InStr)
{
if ( (InStr.length != 0) &&   (!isNaN(InStr)) )
                return true;
else
        return false;
}

function CheckDate(InYYYY, InMM, InDD)
{
        var MonthArray = new Array(0,31,28,31,30,31,30,31,31,30,31,30,31);
        InMM = InMM ; 
        InDD = InDD ; 
        if (InYYYY < 1900 || InYYYY > 2500)
        return false;
        if (InMM < 1 || InMM > 12 ){
        return false;
    }
        if ((InYYYY) == 0 && (InYYYY) != 0 || (InYYYY) == 0) //À±³â
                MonthArray[2] = 29;
        if (InDD > parseInt(MonthArray[InMM]) || InDD < 1)
                return false;
        return true;
}
function IsAlphabet(InStr)
{
        InStr = InStr.toUpperCase();
        if (InStr.length == 0)
                return false;
        for (i = 0; i < InStr.length; i++)
        if (!((InStr.charAt(i) == '_') || (InStr.charAt(i) >= 'A' && InStr.charAt(i) <= 'Z')))
                        return false;
        return true;
}
function IsPossibleID(InStr)
{
        InStr = InStr.toUpperCase();
        if (InStr.length == 0)
                return false;
        for (i = 0; i < InStr.length; i++)
                if ( (InStr.charAt(i) == '|') || !((InStr.charAt(i) >= 'A' && InStr.charAt(i) <= 'Z')||
          (InStr.charAt(i) >= '0' && InStr.charAt(i) <= '9')||
                      (InStr.charAt(i) == '_')))
                        return false;
        return true;
}

function IsPossiblestr(InObj)
{
    var InStr = InObj.value;
        for (i = 0; i < InStr.length; i++)
    {
                if ((InStr.charAt(i) == '|'))
                {
                alert('Æ¯¼ö ¹®ÀÚ´Â ÀÔ·ÂÇÒ ¼ö ¾ø½À´Ï´Ù.'); 
                                return false;
                }
    }
        return true;
}


function CheckID(InObj)
{
        var Str = InObj.value;
        if (Str.length < 3)  // 3ÀÚÀÌ»ó
        {
                alert('»ç¿ëÀÚID´Â 3±ÛÀÚ ÀÌ»óÀÔ´Ï´Ù.');
                InObj.focus();
                InObj.select();
                return false;
        }
		/*
        if (!(IsAlphabet(Str.charAt(0)) && IsPossibleID(Str)))
        {
                alert('»ç¿ëÀÚID´Â ¿µ¹®°ú ¼ýÀÚ·Î¸¸ °¡´ÉÇÕ´Ï´Ù.');
                InObj.focus();
                InObj.select();
                return false;
        }
		*/
        return true;
}

function NumStrCheck(InStr)
{
if ( (InStr.length != 0) &&
   (!isNaN(InStr))  )
                return true;
else
        return false;
}

function NuCheck(InStr)
{
if (!isNaN(InStr))  
        return true;
else
        return false;
}

function Faxonecheck(InObj, InMsg)
{
if (NuCheck(InObj.value))
        return true;
alert(InMsg + ' ' + '¼ýÀÚ·Î ÀÔ·ÂÇÏ½Ê½Ã¿À.');
InObj.focus();
InObj.select();
return false;
}

function makeArray(n)
{
 this.length = n;
 for(var i=1; i<=n; i++)
  this[i] = 0;
 return this;
}

function check_num(str)
{ 
 num = new makeArray(13);
 digit = new makeArray(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(var j=1; j<=13; j++)
 {
  num[j] = parseInt(str.charAt(j-1),10)
 }
 
 if (CheckValidIDDate(str, '19991201') == false)
  return false;
 // Y2K source start : 2000³âÀÌÀü Ãâ»ýÀÚÀÇ ÁÖ¹Îµî·Ï ¹øÈ£ ÀÔ·ÂÀ» À§ÇÑ ºÎºÐ
 if (num[7] != 3 &&  num[7] != 4) {
  sum = 0;
  //check_digit¿Í ¹øÈ£¸¦ ¿¬»êÇÑ´Ù
  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 {
 // 2000³â ÀÌÈÄ Ãâ»ýÀÚÀÇ ÁÖ¹Îµî·Ï¹øÈ£ Ã¼Å© ·çÆ¾   
  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;
  }
 }
 // Y2K Source end
}

function CheckValidIDDate(id, str)
{
 var TodayYear, TodayMon, TodayDay;
 var idYear, idMon, idDay, cfDate; 
 
 idDay = new makeArray(13);
 Today = new makeArray(13);

 for(var i = 0; i < 13; i++){
  idDay[i] = parseInt(id.charAt(i), 10);
 }
 for(i = 0; i < 8; i++){
  Today[i] = parseInt(str.charAt(i), 10);
 }

 if (idDay[6] == 1 || idDay[6] == 2)     
                idYear = (idDay[0]*10 + idDay[1]) + 1900;
        if (idDay[6] == 3 || idDay[6] == 4)     
                idYear = (idDay[0]*10 + idDay[1]) + 2000;

 TodayYear = Today[0]*1200 + Today[1]*120 + Today[2]*10 + Today[3];

 idMon = idDay[2]*10 + idDay[3];
 idDay = idDay[4]*10 + idDay[5];
 
 TodayMon = Today[4]*10 + Today[5];
 TodayDay = Today[6]*10 + Today[7];
 
 if (idYear > TodayYear){
  return false;
 } else if (idYear < TodayYear){
  return true;
 } else {  // ¿¬µµ°¡ °°Àº°æ¿ì
  if (idMon > TodayMon){
   return false;
  } else if (idMon < TodayMon){
   return true;
  } else {  // ¿ùÀÌ °°Àº °æ¿ì
   if (idDay > TodayDay){
    return false;
   } else
    return true;
  }
 }
}

function CheckEmail(EmailForm)
{
	var strEmail = EmailForm.value;
//	ÀÌ¸ÞÀÏ ÁÖ¼Ò´Â ÀÔ·ÂÇÑ °æ¿ì¿¡¸¸ validÇÑÁö Ã¼Å©ÇÑ´Ù.
    var i;
    var strCheck1 = false;
    var strCheck2 = false;
	var iEmailLen = strEmail.length
	if (iEmailLen > 0) {
		// strEmail ¿¡ '.@', '@.' ÀÌ ÀÖ´Â °æ¿ì ¿¡·¯¸Þ½ÃÁö.
		// strEmailÀÇ ¸Ç¾Õ ¶Ç´Â ¸ÇµÚ¿¡  '@', '.' ÀÌ ÀÖ´Â °æ¿ì ¿¡·¯¸Þ½ÃÁö.
		if ((strEmail.indexOf(".@") != -1) || (strEmail.indexOf("@.") != -1) ||
			(strEmail.substring(0,1) == ".") || (strEmail.substring(0,1) == "@") ||
			(strEmail.substring(iEmailLen-1,iEmailLen) == ".") || (strEmail.substring(iEmailLen-1,iEmailLen) == "@"))
		{	
	        alert("\nÀÌ¸ÞÀÏ ÁÖ¼Ò¸¦ Á¤È®ÇÏ°Ô ÀÔ·ÂÇÏ½Ê½Ã¿À.");
	        EmailForm.focus();
			return false;
		}
		
	    for(i=0; i < iEmailLen; i++) {
	        if ((strEmail.substring(i,i+1) == ".") || 
	        	(strEmail.substring(i,i+1) == "-") || (strEmail.substring(i,i+1) == "_") ||
	           ((strEmail.substring(i,i+1) >= "0") && (strEmail.substring(i,i+1) <= "9")) ||
	           ((strEmail.substring(i,i+1) >= "@") && (strEmail.substring(i,i+1) <= "Z")) ||
	           ((strEmail.substring(i,i+1) >= "a") && (strEmail.substring(i,i+1) <= "z"))) {
	                if (strEmail.substring(i,i+1) == ".")
						strCheck1 = true;
	                if (strEmail.substring(i,i+1) == "@")
						strCheck2 = true;
	        }
	        else {
	            alert("\nÀÌ¸ÞÀÏ ÁÖ¼Ò¸¦ Á¤È®ÇÏ°Ô ÀÔ·ÂÇÏ½Ê½Ã¿À.");
	            EmailForm.focus();
				return false;
	        }
	    }
	
	    if ((strCheck1 == false) || (strCheck2 == false)) {
	        alert("\nÀÌ¸ÞÀÏ ÁÖ¼Ò¸¦ Á¤È®ÇÏ°Ô ÀÔ·ÂÇÏ½Ê½Ã¿À.");
	        EmailForm.focus();
			return false;
	    }
	}
    return true;
}

// ÃßÃµÀÎ ¾ÆÀÌµð Ã¼Å©
function check_recommend_userid(id, sig_id)
{
	if(id == sig_id) {
		return false;
	}
	return true;
}

function validate()
{
	theForm = document.register;

	//new_jumin = '';
	//new_jumin = document.register.resno1.value + document.register.resno2.value;

	if( isEmpty( theForm.id.value )){
		alert('¾ÆÀÌµð¸¦  ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.');
		theForm.id.focus();
		return ;
	}
	
	if (!CheckID(theForm.id)){
		theForm.id.focus();
		return;
	}
	if( isEmpty( theForm.pass.value )){
		alert('ºñ¹Ð¹øÈ£¸¦  ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.');
		theForm.pass.focus();
		return;
	}
	if( isEmpty( theForm.repass.value )){
		alert('È®ÀÎºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.');
		theForm.repass.focus();
		return;
	}
	if (theForm.pass.value != theForm.repass.value) {
		 alert('¾ÏÈ£¿Í È®ÀÎ¾ÏÈ£°¡ °°Áö ¾Ê½À´Ï´Ù.');
		 theForm.pass.focus();
		return;
	}

	if( isEmpty( theForm.kname.value )){
		alert('ÀÌ¸§À»  ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.');
		theForm.kname.focus();
		return;
	}
	if( isEmpty( theForm.resno1.value )){
		alert('ÁÖ¹Î¹øÈ£ ¾ÕÀÚ¸®¸¦ ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.');
		theForm.resno1.focus();
		return;
	}
	if( isEmpty( theForm.resno2.value )){
		alert('ÁÖ¹Î¹øÈ£ µÞÀÚ¸®¸¦ ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.');
		theForm.resno2.focus();
		return;
	}

//	if (!NumberCheck(theForm.resno1, 'ÁÖ¹Îµî·Ï¹øÈ£ ¾ÕÀÚ¸®¸¦', '6')) return;
//	if (!NumberCheck(theForm.resno2, 'ÁÖ¹Îµî·Ï¹øÈ£ µÞÀÚ¸®¸¦', '7')) return;
	//ÀÓ½ÃÁÖ¼®
/*
	if(check_num(new_jumin)==false) {
		alert('ÁÖ¹Îµî·Ï¹øÈ£¸¦ Á¤È®È÷ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.');
		return;
	}
*/
	if( isEmpty( theForm.h_zip1.value )){
		alert('¿ìÆí¹øÈ£ ¾ÕÀÚ¸®¸¦  ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.');
		theForm.h_zip1.focus();
		return;
	}
	if( isEmpty( theForm.h_zip2.value )){
		alert('¿ìÆí¹øÈ£ µÞÀÚ¸®¸¦  ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.');
		theForm.h_zip2.focus();
		return;
	}
	if( isEmpty( theForm.h_addr1.value )){
		alert('ÁÖ¼Ò¸¦  ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.');
		theForm.h_addr1.focus();
		return;
	}
	if( isEmpty( theForm.h_addr2.value )){
		alert('»ó¼¼ÁÖ¼Ò¸¦  ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.');
		theForm.h_addr2.focus();
		return;
	}
	if (!IsPossiblestr(theForm.h_addr2)){
		theForm.h_addr2.focus();
		return;
	}

	if( isEmpty( theForm.tel1.value )){
		alert('Áö¿ª¹øÈ£¸¦ ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.');
		theForm.tel1.focus();
		return;
	}
	if (!newNumberCheck(theForm.tel1, 'ÀüÈ­')) return;
	if (!IsPossiblestr(theForm.tel1)){
		theForm.tel1.focus();
		return;
	}

	if( isEmpty( theForm.tel2.value )){
		alert('±¹¹øÈ£¸¦ ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.');
		theForm.tel2.focus();
		return;
	}
	if (!newNumberCheck(theForm.tel2, 'ÀüÈ­')) return;
	if (!IsPossiblestr(theForm.tel2)){
		theForm.tel2.focus();
		return;
	}

	if( isEmpty( theForm.tel3.value )){
		alert('ÀüÈ­¹øÈ£ÀÇ ¸¶Áö¸· 4ÀÚ¸® ¹øÈ£¸¦  ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.');
		theForm.tel3.focus();
		return;
	}
	if (!newNumberCheck(theForm.tel3, 'ÀüÈ­')) return;
	if (!NumberCheck(theForm.tel3, 'ÀüÈ­¹øÈ£ÀÇ ¸¶Áö¸· 4ÀÚ¸® ¹øÈ£¸¦', '4')) return;
	if (!IsPossiblestr(theForm.tel3)){
		theForm.tel3.focus();
		return;
	}
	// °¡ÀÔÀÚ ¾ÆÀÌµð¿Í ÃßÃµÀÎ ¾ÆÀÌµð°¡ °°ÀºÁö Ã¼Å©
	if( !check_recommend_userid(theForm.id.value, theForm.sig_id.value)) 
	{
		alert('°¡ÀÔÀÚÀÇ ¾ÆÀÌµð´Â ÃßÃµÀÎÀ¸·Î ÀÔ·ÂÇÒ ¼ö ¾ø½À´Ï´Ù.');
		theForm.sig_id.focus();
		return;
	}
	if( theForm.accept.checked==false){
		alert('ÀÌ¿ë¾à°ü¿¡ µ¿ÀÇÇÔÀ» Ã¼Å©ÇÏ¼¼¿ä.');
		theForm.accept.focus();
		return ;
	}

	if( theForm.accept2.checked==false){
		alert('°³ÀÎÁ¤º¸ Ãë±Þ¹æÄ§ ¾à°ü¿¡ µ¿ÀÇÇÔÀ» Ã¼Å©ÇÏ¼¼¿ä.');
		theForm.accept2.focus();
		return ;
	}
	theForm.submit();

//  if (NullCheck(theForm.c_zip1, '¿ìÆí¹øÈ£')) return;
//  if (NullCheck(theForm.c_zip2, '¿ìÆí¹øÈ£')) return;

//  if (NullCheck(theForm.c_addr1, 'ÁÖ¼ÒÀÔ·ÂÀ»')) return;
//  if (NullCheck(theForm.c_addr2, 'µÎ¹øÂ°ÁÖ¼ÒÀÔ·ÂÀ»')) return;
//  if (!IsPossiblestr(theForm.c_addr2)){
//     theForm.c_addr2.focus();
//     return;
//  }

//  if (!NumberCheck(theForm.b_yy, '»ý³â¿ùÀÏÀÇ ³â¸¦', '4')) return;
//  if (!NumberCheck(theForm.b_mm, '»ý³â¿ùÀÏÀÇ ¿ù¸¦','2')) return;
//  if (!NumberCheck(theForm.b_dd, '»ý¿¬¿ùÀÏÀÇ ÀÏÀ»','2')) return;

//  if (NullCheck(theForm.cell1, 'ÈÞ´ëÀüÈ­¸¦')) return;	 
//  if (!newNumberCheck(theForm.cell1, 'ÈÞ´ëÀüÈ­')) return;
//  if (!IsPossiblestr(theForm.cell1)){
//     theForm.cell1.focus();
//     return;
//  }

//  if (NullCheck(theForm.cell2, 'ÈÞ´ëÀüÈ­¸¦')) return;	 
//  if (!newNumberCheck(theForm.cell2, 'ÈÞ´ëÀüÈ­')) return;
//  if (!IsPossiblestr(theForm.cell2)){
//     theForm.cell2.focus();
//     return;
//  }

//  if (NullCheck(theForm.cell3, 'ÈÞ´ëÀüÈ­¸¦')) return;	 
//  if (!newNumberCheck(theForm.cell3, 'ÈÞ´ëÀüÈ­')) return;
//  if (!IsPossiblestr(theForm.cell3)){
//     theForm.cell3.focus();
//     return;
//  }
}
function user_mod() {
	 theForm = document.register;
	if( isEmpty( theForm.pass.value )){
		alert('ºñ¹Ð¹øÈ£¸¦  ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.');
		theForm.pass.focus();
		return false;
	}
	if( isEmpty( theForm.repass.value )){
		alert('È®ÀÎºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.');
		theForm.repass.focus();
		return false;
	}
	if (theForm.pass.value != theForm.repass.value) {
		 alert('¾ÏÈ£¿Í È®ÀÎ¾ÏÈ£°¡ °°Áö ¾Ê½À´Ï´Ù.');
		 theForm.pass.focus();
		return false;
	}

	if( isEmpty( theForm.email.value )){
		alert('ÀÌ¸ÞÀÏÀ»  ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.');
		theForm.email.focus();
		return false;
	}
	if (CheckEmail(theForm.email) == false)
		return false;

	if (NullCheck(theForm.h_zip1, '¿ìÆí¹øÈ£')) return;
	if (NullCheck(theForm.h_zip2, '¿ìÆí¹øÈ£')) return;
	
	if (NullCheck(theForm.h_addr1, 'ÁÖ¼ÒÀÔ·ÂÀ»')) return;
	if (NullCheck(theForm.h_addr2, 'µÎ¹øÂ°ÁÖ¼ÒÀÔ·ÂÀ»')) return;
	if (!IsPossiblestr(theForm.h_addr2)){
		theForm.h_addr2.focus();
		return;
	}
	
	if (NullCheck(theForm.cell1, 'ÈÞ´ëÆùÀ»')) return;
	if (!newNumberCheck(theForm.cell1, 'ÈÞ´ëÆù')) return;
	if (!IsPossiblestr(theForm.cell1)){
		theForm.cell1.focus();
		return;
	}
	
	if (NullCheck(theForm.cell2, 'ÈÞ´ëÆùÀ»')) return;
	if (!newNumberCheck(theForm.cell2, 'ÈÞ´ëÆù')) return;
	if (!IsPossiblestr(theForm.cell2)){
		theForm.cell2.focus();
		return;
	}
	
	
	if (NullCheck(theForm.cell3, 'ÈÞ´ëÆùÀ»')) return;
	if (!newNumberCheck(theForm.cell3, 'ÈÞ´ëÆù')) return;
	if (!IsPossiblestr(theForm.cell3)){
		theForm.cell3.focus();
		return;
	}
	
	theForm.submit();

}

function ChkId()
{
	if(document.register.id.value.length<3)
	{
		alert("ID´Â 4ÀÚÀÌ»ó ¹Ýµå½Ã ÀÔ·Â ÇØÁÖ¼¼¿ä.");
		uid=document.register.id.focus();
	}
	else
	{
		var url="./checkid.php?uid="+document.register.id.value;
		window.open(url,"id","top=1,left=1,width=1,height=1");

	}
}

function OpenZipcode1(){
	window.open("./post.php?form=register&h_zip1=zip1&h_zip2=zip2&h_addr1=address1&address2=h_addr2&check_mod=1","ZipWin","width=417,height=220,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no");

}

function OpenZipcode2(){
	window.open("./post.php?form=register&c_zip1=zip1&c_zip2=zip2&c_addr1=address1&address2=c_addr2&check_mod=2","ZipWin","width=417,height=220,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no");

}
//-->