function no_check(no1, no2) {
	if (no1.length != 6) { return false; }
	else if (no2.length != 7) { return false; }
	else {
		var str_serial1 = no1;
		var str_serial2 = no2;

		var digit=0
		for (var i=0;i<str_serial1.length;i++) {
			var str_dig=str_serial1.substring(i,i+1);
			if (str_dig<'0' || str_dig>'9') { digit=digit+1; }
		}
		if ((str_serial1 == '') || ( digit != 0 )) { return false; }
		
		var digit1=0;
		for (var i=0;i<str_serial2.length;i++){
			var str_dig1=str_serial2.substring(i,i+1);
			if (str_dig1<'0' || str_dig1>'9') { digit1=digit1+1; }
		}
		if ((str_serial2 == '') || ( digit1 != 0 )) { return false; }

		if (str_serial1.substring(2,3) > 1) { return false; }
		if (str_serial1.substring(4,5) > 3) { return false; }
		if (str_serial2.substring(0,1) > 4 || str_serial2.substring(0,1) == 0) { return false; }
		
		var a1=str_serial1.substring(0,1);
		var a2=str_serial1.substring(1,2);
		var a3=str_serial1.substring(2,3);
		var a4=str_serial1.substring(3,4);
		var a5=str_serial1.substring(4,5);
		var a6=str_serial1.substring(5,6);
		var check_digit=a1*2+a2*3+a3*4+a4*5+a5*6+a6*7;
		var b1=str_serial2.substring(0,1);
		var b2=str_serial2.substring(1,2);
		var b3=str_serial2.substring(2,3);
		var b4=str_serial2.substring(3,4);
		var b5=str_serial2.substring(4,5);
		var b6=str_serial2.substring(5,6);
		var b7=str_serial2.substring(6,7);
		var check_digit=check_digit+b1*8+b2*9+b3*2+b4*3+b5*4+b6*5;
		check_digit = check_digit%11;
		check_digit = 11 - check_digit;
		check_digit = check_digit%10;
		
		if (check_digit != b7) { return false; }
		else { return true; }
	}
}	  

function id_check()
{

var id= document.member.id.value ; // document.ÆûÀÌ¸§.º¯¼öÀÌ¸§.value
    id = id.toLowerCase()
    
if(id_check1(id)) {
    window.open('../Fmember/idDupl.asp?id='+id,'idcheck','width=271, height=145, toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=no, scrollbars=no, copyhistory=no');
                                    // »õÃ¢À¸·Î ¿ÀÇÂ½Ã À§ÀÇ 'idcheck' µî°ú °°Àº ÀÌ¸§ÀÌ ÀÖ¾î¾ß ´Ù½Ã ÀÌ Ã¢À» È£ÃâÇØµµ °°ÀºÃ¢¿¡¼­ ½ÇÇàµÊ
                                    // ¸¸¾à Ã¢ÀÇ °ªÀÌ ¾øÀ¸¸é »õ·Î¿î Ã¢ÀÌ »ý¼ºµÊ  
    return true;
	} else {
		alert("ID is available 4~25 digit English or member or English and number");
		document.member.id.value="";
		document.member.id.focus();
		return false;
	}
    
}
function id_check1(id){    //¾ÆÀÌµðÀÇ Çü½Ä Ã¼Å©ÇÏ´Â ºÎºÐ
	var patten = /^[a-z0-9]{4,25}$/;
	var result = id.match(patten);
	if((result==null)||(result[0]!=id)) { return false; }
	return true;
}

function pass_check1(pass){    //¾ÆÀÌµðÀÇ Çü½Ä Ã¼Å©ÇÏ´Â ºÎºÐ
	var patten = /^[a-z0-9]{4,10}$/;
	var result = pass.match(patten);
	if((result==null)||(result[0]!=pass)) { return false; }
	return true;
}


function check_mail(mail) { //¸ÞÀÏ Çü½Ä Ã¼Å©
	var pattern = /^[^@ ]+@([a-zA-Z0-9-]){1,62}[a-zA-Z0-9]+\.[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$/; 
	var result = mail.match(pattern); 
	if((result == null)||(result[0]!=mail)) { return false; }
	return true;
}

function check()
{
   var chk = document.member;
   
     if(chk.firstName.value == "") {
	   alert("Please Enter first Name.");
	   chk.firstName.focus();
	   return true;
	 }
	 if(chk.lastName.value == "") {
	   alert("Please Enter last Name.");
	   chk.lastName.focus();
	   return true;
	 }
  	 if(chk.id.value == ""){
		alert("Please Enter your ID.");
		chk.id.focus();
		return true;
	 }
		
		var idChk = document.member.id.value;
		
		if(!id_check1(idChk)) {
		  alert("ID is available 4~10 digit English or member or English and number");
  		  chk.id.value="";
		  chk.id.focus();
		  return false;
		}  
		
		if(chk.passwd.value  == "") {
          alert("Please Enter password");
          chk.passwd.focus();
          return true;
        }
		
		if(chk.passwd2.value  == "") {
          alert("Please Enter recheck(password)");
          chk.passwd2.focus();
          return true;
        }
		
        if(chk.passwd.value != chk.passwd2.value ) {
         alert("Password is wrong.");
		 chk.passwd2.value="";
         chk.passwd2.focus();
         return true;
        }

		if(chk.position.value == "") {
          alert("Please Enter your position(job).");
          chk.position.focus();
          return true;
        }        
		
        if(chk.city.value == "") {
        alert("Please Enter your city.");
        chk.city.focus();
        return true;
        }
		
		if(chk.country.value == "") {
        alert("Please Enter your country.");
        chk.country.focus();
        return true;
        }
		
		if(chk.office.value == "") {
        alert("Please Enter your office telphone number.");
        chk.office.focus();
        return true;
        }
			
		if(chk.email.value == "") {
        alert("Please Enter your Email Address.");
        chk.email.focus();
        return true;
        }     
        var e_mail_1 = document.member.email.value; 
    
        if (check_mail(e_mail_1)) {
          //return true;
        }else {
          alert("Email Address is wrong.");
		  chk.email.value="";
		  chk.email.focus();
		  return false;
		}
				
	   //¶óµð¿À¹Ú½º Ã¼Å©
     /*   var part_num = chk.jobPart.length;
	    for(var i=0;i<part_num;i++) {
	      var part_obj = eval("chk.jobPart["+i+"]");
	      if(part_obj.checked == true) {
	      break;
	      }
	   }   
	   if(i == part_num) {  
	     alert("Èñ¸ÁºÐ°ú¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä.");
		 chk.jobPart[0].focus();
		 return true;
	   }	   	*/
		

       chk.submit();   
	   //return true;
          
}     


function check2()
{
   var chk = document.member;
   
     if(chk.firstName.value == "") {
	   alert("Please Enter first Name.");
	   chk.firstName.focus();
	   return true;
	 }
	 if(chk.lastName.value == "") {
	   alert("Please Enter last Name.");
	   chk.lastName.focus();
	   return true;
	 }
  	 if(chk.id.value == ""){
		alert("Please Enter your ID.");
		chk.id.focus();
		return true;
	 }
		
		var idChk = document.member.id.value;
		
		if(!id_check1(idChk)) {
		  alert("ID is available 4~10 digit English or member or English and number");
  		  chk.id.value="";
		  chk.id.focus();
		  return false;
		}  
		
		if(chk.passwd.value  == "") {
          alert("Please Enter password");
          chk.passwd.focus();
          return true;
        }
		
/*		if(chk.passwd2.value  == "") {
          alert("Please Enter recheck(password)");
          chk.passwd2.focus();
          return true;
        }
		
        if(chk.passwd.value != chk.passwd2.value ) {
         alert("Password is wrong.");
		 chk.passwd2.value="";
         chk.passwd2.focus();
         return true;
        }

		if(chk.position.value == "") {
          alert("Please Enter your position(job).");
          chk.position.focus();
          return true;
        }        */
		
        if(chk.city.value == "") {
        alert("Please Enter your city.");
        chk.city.focus();
        return true;
        }
		
		if(chk.country.value == "") {
        alert("Please Enter your country.");
        chk.country.focus();
        return true;
        }
		
		if(chk.office.value == "") {
        alert("Please Enter your office telphone number.");
        chk.office.focus();
        return true;
        }
			
		if(chk.email.value == "") {
        alert("Please Enter your Email Address.");
        chk.email.focus();
        return true;
        }     
        var e_mail_1 = document.member.email.value; 
    
        if (check_mail(e_mail_1)) {
          //return true;
        }else {
          alert("Email Address is wrong.");
		  chk.email.value="";
		  chk.email.focus();
		  return false;
		}
				
	   //¶óµð¿À¹Ú½º Ã¼Å©
     /*   var part_num = chk.jobPart.length;
	    for(var i=0;i<part_num;i++) {
	      var part_obj = eval("chk.jobPart["+i+"]");
	      if(part_obj.checked == true) {
	      break;
	      }
	   }   
	   if(i == part_num) {  
	     alert("Èñ¸ÁºÐ°ú¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä.");
		 chk.jobPart[0].focus();
		 return true;
	   }	   	*/
		

       chk.submit();   
	   //return true;
          
}     


function submit()
{

	if (document.flog.id.value =="") {
		alert("Please Enter your ID.");
		document.flog.id.focus();
		return;
	}
	
	if (document.flog.pwd.value =="") {
		alert("Please Enter your password.");
		document.flog.pwd.focus();
		return;
	}
	
		
	document.flog.submit();

}

function EnterCheck(i)  {
	if(event.keyCode ==13)
	switch(i) {
		case 1:
			document.flog.pwd.focus();
			break;
		case 2:
			submit();
			break;
		
	}
}

