function isNum (num) {
	var reg=/^\d{1,20}$/;
    if(num.match(reg)){
		return true;
    } else {
		return false;
	}
}

function isEmail (str) {
	var mail = new RegExp( /^[_a-z0-9]+@+([_a-z0-9]+\.)+[a-z0-9]{2,3}$/);
	if(mail.test(str)) return true;
  	return false;
}

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function isChinese (str) {
	var chinesechr = new RegExp(/^[\u4E00-\u9FA5]*$/);
	if (chinesechr.test(str)) {
		return true;
	} else {
		return false;
	}
}

function isEnglish (str) {
	var eng = new RegExp(/^[a-z]*$/);
	if (eng.test(str)) {
		return true;
	} else {
		return false;
	}
}

function isEnglish2 (str) {
	var eng = new RegExp(/^[a-zA-Z]+[a-z0-9A-Z.,-]*$/);
	var eng2 = new RegExp(/\s/);
	if ((eng.test(str))||(eng2.test(str))){
		return true;
	} else {
		return false;
	}
}


//function isIdentification (str) {
//	var ide = new RegExp(/^\d{15}$/);
//	var ide2 = new RegExp(/^\d{10}$/);
//	if ((ide.test(str)) ||(ide2.test(str))){
//		return true;
//	} else {
//		return false;
//	}
//}

//check id
function Check1(str)
{
  $check1=str.value.substring(0,1); 
if (($check1!='A')&&($check1!='B')&&($check1!='C')&&($check1!='D')&&($check1!='E') 
&&($check1!='F')&&($check1!='G')&&($check1!='H')&&($check1!='I')&&($check1!='J') 
&&($check1!='K')&&($check1!='L')&&($check1!='M')&&($check1!='N')&&($check1!='O') 
&&($check1!='P')&&($check1!='Q')&&($check1!='R')&&($check1!='S')&&($check1!='T') 
&&($check1!='U')&&($check1!='V')&&($check1!='W')&&($check1!='X')&&($check1!='Y') 
&&($check1!='Z')&&($check1!='a')&&($check1!='b')&&($check1!='c')&&($check1!='d') 
&&($check1!='e')&&($check1!='f')&&($check1!='g')&&($check1!='h')&&($check1!='i') 
&&($check1!='j')&&($check1!='k')&&($check1!='l')&&($check1!='m')&&($check1!='n') 
&&($check1!='o')&&($check1!='p')&&($check1!='q')&&($check1!='r')&&($check1!='s') 
&&($check1!='t')&&($check1!='u')&&($check1!='v')&&($check1!='w')&&($check1!='x') 
&&($check1!='y')&&($check1!='z')) 
return (false); 
} 

// check id second

function Check2(str){
$check2=str.value.substring(1,2); 
if (($check2!='1')&&($check2!='2')) 
return (false); 

}

//check 3
function Check3(str){
$d1=str.value.substring(2,3); 
$d2=str.value.substring(3,4); 
$d3=str.value.substring(4,5); 
$d4=str.value.substring(5,6); 
$d5=str.value.substring(6,7); 
$d6=str.value.substring(7,8); 
$d7=str.value.substring(8,9); 
$d8=str.value.substring(9,10); 

if ((($d1!='1')&&($d1!='2')&&($d1!='3')&&($d1!='4')&&($d1!='5') 
&&($d1!='6')&&($d1!='7')&&($d1!='8')&&($d1!='9')&&($d1!='0'))|| 
(($d2!='1')&&($d2!='2')&&($d2!='3')&&($d2!='4')&&($d2!='5') 
&&($d2!='6')&&($d2!='7')&&($d2!='8')&&($d2!='9')&&($d2!='0'))|| 
(($d3!='1')&&($d3!='2')&&($d3!='3')&&($d3!='4')&&($d3!='5') 
&&($d3!='6')&&($d3!='7')&&($d3!='8')&&($d3!='9')&&($d3!='0'))|| 
(($d4!='1')&&($d4!='2')&&($d4!='3')&&($d4!='4')&&($d4!='5') 
&&($d4!='6')&&($d4!='7')&&($d4!='8')&&($d4!='9')&&($d4!='0'))|| 
(($d5!='1')&&($d5!='2')&&($d5!='3')&&($d5!='4')&&($d5!='5') 
&&($d5!='6')&&($d5!='7')&&($d5!='8')&&($d5!='9')&&($d5!='0'))|| 
(($d6!='1')&&($d6!='2')&&($d6!='3')&&($d6!='4')&&($d6!='5') 
&&($d6!='6')&&($d6!='7')&&($d6!='8')&&($d6!='9')&&($d6!='0'))|| 
(($d7!='1')&&($d7!='2')&&($d7!='3')&&($d7!='4')&&($d7!='5') 
&&($d7!='6')&&($d7!='7')&&($d7!='8')&&($d7!='9')&&($d7!='0'))|| 
(($d8!='1')&&($d8!='2')&&($d8!='3')&&($d8!='4')&&($d8!='5') 
&&($d8!='6')&&($d8!='7')&&($d8!='8')&&($d8!='9')&&($d8!='0'))) 
return (false);  

}

//check 4
function Check4(str){
if (($check1=='A')||($check1=='a')){ $bk=1;} 
if (($check1=='B')||($check1=='b')){ $bk=10;} 
if (($check1=='C')||($check1=='c')){ $bk=19;} 
if (($check1=='D')||($check1=='d')){ $bk=28;} 
if (($check1=='E')||($check1=='e')){ $bk=37;} 
if (($check1=='F')||($check1=='f')){ $bk=46;} 
if (($check1=='G')||($check1=='g')){ $bk=55;} 
if (($check1=='H')||($check1=='h')){ $bk=64;} 
if (($check1=='I')||($check1=='i')){ $bk=39;} 
if (($check1=='J')||($check1=='j')){ $bk=73;} 
if (($check1=='K')||($check1=='k')){ $bk=82;} 
if (($check1=='L')||($check1=='l')){ $bk=2;} 
if (($check1=='M')||($check1=='m')){ $bk=11;} 
if (($check1=='N')||($check1=='n')){ $bk=20;} 
if (($check1=='O')||($check1=='o')){ $bk=48;} 
if (($check1=='P')||($check1=='p')){ $bk=29;} 
if (($check1=='Q')||($check1=='q')){ $bk=38;} 
if (($check1=='R')||($check1=='r')){ $bk=47;} 
if (($check1=='S')||($check1=='s')){ $bk=56;} 
if (($check1=='T')||($check1=='t')){ $bk=65;} 
if (($check1=='U')||($check1=='u')){ $bk=74;} 
if (($check1=='V')||($check1=='v')){ $bk=83;} 
if (($check1=='W')||($check1=='w')){ $bk=21;} 
if (($check1=='X')||($check1=='x')){ $bk=3;} 
if (($check1=='Y')||($check1=='y')){ $bk=12;} 
if (($check1=='Z')||($check1=='z')){ $bk=30;} 

$sum=$bk+($check2*8)+($d1*7)+($d2*6)+($d3*5)+($d4*4)+($d5*3)+($d6*2)+($d7*1)+($d8*1); 
if(($sum%10)!=0) 
return (false); 

}

