var lo;
var plo;
var tr;
var N;
function res(){
var flag=true;
	lo=document.reg.Fname.value;
	plo=lo.length;
	tr=lo.match(/[^\x00-\x80]/ig);
	if(tr!=null)plo+=tr.length
	N='iFname';
	if (plo<2){
		Su(N,'<SPAN CLASS=Err>Not enough characters, you have inputted '+plo+' character, 2-16 characters is available.</SPAN>');
		flag=false;
	}else if (plo>16){
		Su(N,'<SPAN CLASS=Err>too much characters£¬you have inputted '+plo+' character, 2-16 characters is available.</SPAN>');
		flag=false;
	}else{
		Su(N,'<SPAN CLASS=Ok>OK£¡</SPAN>');
	}
	
	lo=document.reg.SADD1.value;
	plo=lo.length;
	tr=lo.match(/[^\x00-\x80]/ig);
	if(tr!=null)plo+=tr.length
	N='iSADD1';
	if (plo<6){
		Su(N,'<SPAN CLASS=Err>Not enough characters, you have inputted '+plo+' character, 6-100 characters is available.</SPAN>');
		flag=false;
	}else if (plo>100){
		Su(N,'<SPAN CLASS=Err>too much characters£¬you have inputted '+plo+' character, 6-100 characters is available.</SPAN>');
		flag=false;
	}else{
		Su(N,'<SPAN CLASS=Ok>OK£¡</SPAN>');
	}
	
	lo=document.reg.SADD2.value;
	plo=lo.length;
	tr=lo.match(/[^\x00-\x80]/ig);
	if(tr!=null)plo+=tr.length
	N='iSADD2';
	if (plo<6){
		Su(N,'<SPAN CLASS=Err>Not enough characters, you have inputted '+plo+' character, 6-100 characters is available.</SPAN>');
		flag=false;
	}else if (plo>100){
		Su(N,'<SPAN CLASS=Err>too much characters£¬you have inputted '+plo+' character, 6-100 characters is available..</SPAN>');
		flag=false;
	}else{
		Su(N,'<SPAN CLASS=Ok>OK£¡</SPAN>');
	}
	
	lo=document.reg.Lname.value;
	plo=lo.length;
	tr=lo.match(/[^\x00-\x80]/ig);
	if(tr!=null)plo+=tr.length
	N='iLname';
	if (plo<2){
		Su(N,'<SPAN CLASS=Err>Not enough characters, you have inputted '+plo+' character, 2-16 characters is available.</SPAN>');
		flag=false;
	}else if (plo>16){
		Su(N,'<SPAN CLASS=Err>too much characters£¬you have inputted '+plo+' character, 2-16 characters is available.</SPAN>');
		flag=false;
	}else{
		Su(N,'<SPAN CLASS=Ok>OK£¡</SPAN>');
	}
	
	
	lo=document.reg.SCI.value;
	plo=lo.length;
	tr=lo.match(/[^\x00-\x80]/ig);
	if(tr!=null)plo+=tr.length
	N='iSCI';
	if (plo<4){
		Su(N,'<SPAN CLASS=Err>Not enough characters, you have inputted '+plo+' character, 4-16 characters is available</SPAN>');
		flag=false;
	}else if (plo>16){
		Su(N,'<SPAN CLASS=Err>too much characters£¬you have inputted '+plo+' character, 4-16 characters is available.</SPAN>');
		flag=false;
	}else{
		Su(N,'<SPAN CLASS=Ok>OK£¡</SPAN>');
	}
	

	lo=document.reg.SCOD.value;
	plo=lo.length;
	N='iSCOD';
	if (plo<5){
		Su(N,'<SPAN CLASS=Err>Not enough characters, you have inputted '+plo+' character, only 5 characters is avaliable,</SPAN>');
		flag=false;
	}else if (plo>5){
		Su(N,'<SPAN CLASS=Err>too much characters£¬you have inputted '+plo+' character, only 5 characters is avaliable,</SPAN>');
		flag=false;
	}else{
		Su(N,'<SPAN CLASS=Ok>OK£¡</SPAN>');
	}

	lo=document.reg.SST.value;
	N='iSST';
	if(lo!=null){
		Su(N,'<SPAN CLASS=Ok>OK£¡</SPAN>');
	}else{
		Su(N,'<SPAN CLASS=Err>Err£¡</SPAN>');
		flag=false;
	}

	lo=document.reg.SPH.value;
	plo=lo.length;
	N='iSPH';
	if (plo<6){
		Su(N,'<SPAN CLASS=Err>Not enough characters, you have inputted '+plo+' character, 2-16 characters is available.</SPAN>');
		flag=false;
	}else if (plo>12){
		Su(N,'<SPAN CLASS=Err>too much characters£¬you have inputted '+plo+' character, 2-16 characters is available.</SPAN>');
		flag=false;
	}else{
		Su(N,'<SPAN CLASS=Ok>OK£¡</SPAN>');
	}


	N='iSEM';
		if(!TestEmail(reg.SEM.value))
			{Su(N,'<SPAN CLASS=Err>Wrong e-mail address, please check it and input again.£¡</SPAN>');
			flag=false;
		}else{
			Su(N,'<SPAN CLASS=Ok>OK£¡</SPAN>');
		}	

	lo=document.reg.SSWP.value;
	plo=lo.length;
	N='iSSWP';
	if (plo<2){
		Su(N,'<SPAN CLASS=Err>Not enough characters, you have inputted '+plo+' character, 2-16 characters is available</SPAN>');
		flag=false;
	}else if (plo>16){
		Su(N,'<SPAN CLASS=Err>too much characters£¬you have inputted '+plo+' character, 2-16 characters is available.</SPAN>');
		flag=false;
	}else{
		Su(N,'<SPAN CLASS=Ok>OK£¡</SPAN>');
	}

	lo=document.reg.SSN.value;
	plo=lo.length;
	N='iSSN';
	if (plo<2){
		Su(N,'<SPAN CLASS=Err>Not enough characters, you have inputted '+plo+' character, 2-16 characters is available</SPAN>');
		flag=false;
	}else if (plo>16){
		Su(N,'<SPAN CLASS=Err>too much characters£¬you have inputted '+plo+' character, 2-16 characters is available.</SPAN>');
		flag=false;
	}else{
		Su(N,'<SPAN CLASS=Ok>OK£¡</SPAN>');
	}

	lo=document.reg.SPM.value;
	plo=lo.length;
	N='iSPM';
	if (plo<2){
		Su(N,'<SPAN CLASS=Err>Not enough characters, you have inputted '+plo+' character, 2-16 characters is available</SPAN>');
		flag=false;
	}else if (plo>16){
		Su(N,'<SPAN CLASS=Err>too much characters£¬you have inputted '+plo+' character, 2-16 characters is available.</SPAN>');
		flag=false;
	}else{
		Su(N,'<SPAN CLASS=Ok>OK£¡</SPAN>');
	}


	N='iSPD';
	if (document.reg.SPDM.value.length<=0){
		Su(N,'<SPAN CLASS=Err>Month Can not be empty</SPAN>');
		flag=false;
		}
	else if(document.reg.SPDD.value.length<=0){
		Su(N,'<SPAN CLASS=Err>Date Can not be empty</SPAN>');
		flag=false;
		}
	else if(document.reg.SPDY.value.length<=0){
		Su(N,'<SPAN CLASS=Err>Year Can not be empty</SPAN>');
		flag=false;
		}
	else{
		Su(N,'<SPAN CLASS=Ok>OK£¡</SPAN>');
	}


if (flag == false){
	return false;}
else{
	return true;}

}

function C(n){
if(n==0){
	lo=document.reg.Fname.value;
	plo=lo.length;
	tr=lo.match(/[^\x00-\x80]/ig);
	if(tr!=null)plo+=tr.length
	N='iFname';
	if (plo<2){
		Su(N,'<SPAN CLASS=Err>Not enough characters, you have inputted '+plo+' character, 2-16 characters is available.</SPAN>');
	}else if (plo>16){
		Su(N,'<SPAN CLASS=Err>too much characters£¬you have inputted '+plo+' character, 2-16 characters is available.</SPAN>');
	}else{
		Su(N,'<SPAN CLASS=Ok>OK£¡</SPAN>');
	}
}
if(n==1){
	lo=document.reg.Lname.value;
	plo=lo.length;
	tr=lo.match(/[^\x00-\x80]/ig);
	if(tr!=null)plo+=tr.length
	N='iLname';
	if (plo<2){
		Su(N,'<SPAN CLASS=Err>Not enough characters, you have inputted '+plo+' character, 2-16 characters is available.</SPAN>');
	}else if (plo>16){
		Su(N,'<SPAN CLASS=Err>too much characters£¬you have inputted '+plo+' character, 2-16 characters is available.</SPAN>');
	}else{
		Su(N,'<SPAN CLASS=Ok>OK£¡</SPAN>');
	}
}
if(n==2){
	lo=document.reg.SCI.value;
	plo=lo.length;
	tr=lo.match(/[^\x00-\x80]/ig);
	if(tr!=null)plo+=tr.length
	N='iSCI';
	if (plo<4){
		Su(N,'<SPAN CLASS=Err>Not enough characters, you have inputted '+plo+' character, 4-16 characters is available.</SPAN>');
	}else if (plo>16){
		Su(N,'<SPAN CLASS=Err>too much characters£¬you have inputted '+plo+' character, 4-16 characters is available.</SPAN>');
	}else{
		Su(N,'<SPAN CLASS=Ok>OK£¡</SPAN>');
	}
}
if(n==3){
	lo=document.reg.SCOD.value;
	plo=lo.length;
	N='iSCOD';
	if (plo<5){
		Su(N,'<SPAN CLASS=Err>Not enough characters, you have inputted '+plo+'+ character, only 5 characters is avaliable,</SPAN>');
	}else if (plo>5){
		Su(N,'<SPAN CLASS=Err>too much characters£¬you have inputted '+plo+'+ character, only 5 characters is avaliable,</SPAN>');
	}else{
		Su(N,'<SPAN CLASS=Ok>OK£¡</SPAN>');
	}
}

if(n==4){
	lo=document.reg.SST.value;
	N='iSST';
	if (lo!=null){
		Su(N,'<SPAN CLASS=Ok>OK£¡</SPAN>');
	}else{
		Su(N,'<SPAN CLASS=Err>Err£¡</SPAN>');
	}
}

if(n==5){
	lo=document.reg.SPH.value;
	plo=lo.length;
	N='iSPH';
	if (plo<6){
		Su(N,'<SPAN CLASS=Err>Not enough characters, you have inputted '+plo+' character, 6-12 characters is available.</SPAN>');
	}else if (plo>12){
		Su(N,'<SPAN CLASS=Err>too much characters£¬you have inputted '+plo+' character, 6-12 characters is available.</SPAN>');
	}else{
		Su(N,'<SPAN CLASS=Ok>OK£¡</SPAN>');
	}
}

	if(n==6){
	N='iSEM';
		if(!TestEmail(reg.SEM.value))
			{Su(N,'<SPAN CLASS=Err>Wrong e-mail address, please check it and input again.£¡</SPAN>');
		}else{
			Su(N,'<SPAN CLASS=Ok>OK£¡</SPAN>');
		}	
	}
if(n==7){
	lo=document.reg.SADD1.value;
	plo=lo.length;
	N='iSADD1';
	if (plo<6){
		Su(N,'<SPAN CLASS=Err>Not enough characters, you have inputted '+plo+' character, 6-100 characters is available.</SPAN>');
	}else if (plo>100){
		Su(N,'<SPAN CLASS=Err>too much characters£¬you have inputted '+plo+' character, 6-100 characters is available.</SPAN>');
	}else{
		Su(N,'<SPAN CLASS=Ok>OK£¡</SPAN>');
	}
}

if(n==8){
	lo=document.reg.SADD2.value;
	plo=lo.length;
	N='iSADD2';
	if (plo<6){
		Su(N,'<SPAN CLASS=Err>Not enough characters, you have inputted '+plo+' character, 6-100 characters is available.</SPAN>');
	}else if (plo>100){
		Su(N,'<SPAN CLASS=Err>too much characters£¬you have inputted '+plo+' character, 6-100 characters is available.</SPAN>');
	}else{
		Su(N,'<SPAN CLASS=Ok>OK£¡</SPAN>');
	}
}

if(n==9){
	lo=document.reg.SSWP.value;
	plo=lo.length;
	N='iSSWP';
	if (plo<2){
		Su(N,'<SPAN CLASS=Err>Not enough characters, you have inputted '+plo+' character, 6-12 characters is available.</SPAN>');
	}else if (plo>16){
		Su(N,'<SPAN CLASS=Err>too much characters£¬you have inputted '+plo+' character, 6-12 characters is available.</SPAN>');
	}else{
		Su(N,'<SPAN CLASS=Ok>OK£¡</SPAN>');
	}
}

if(n==10){
	lo=document.reg.SSN.value;
	plo=lo.length;
	N='iSSN';
	if (plo<2){
		Su(N,'<SPAN CLASS=Err>Not enough characters, you have inputted '+plo+' character, 6-12 characters is available.</SPAN>');
	}else if (plo>16){
		Su(N,'<SPAN CLASS=Err>too much characters£¬you have inputted '+plo+' character, 6-12 characters is available.</SPAN>');
	}else{
		Su(N,'<SPAN CLASS=Ok>OK£¡</SPAN>');
	}
}

if(n==11){
	lo=document.reg.SPM.value;
	plo=lo.length;
	N='iSPM';
	if (plo<2){
		Su(N,'<SPAN CLASS=Err>Not enough characters, you have inputted '+plo+' character, 6-12 characters is available.</SPAN>');
	}else if (plo>16){
		Su(N,'<SPAN CLASS=Err>too much characters£¬you have inputted '+plo+' character, 6-12 characters is available.</SPAN>');
	}else{
		Su(N,'<SPAN CLASS=Ok>OK£¡</SPAN>');
	}
}

if(n==12){
	N='iSPD';
	if (document.reg.SPDM.value.length<=0){
		Su(N,'<SPAN CLASS=Err>Month Can not be empty</SPAN>');
		}
	else if(document.reg.SPDD.value.length<=0){
		Su(N,'<SPAN CLASS=Err>Date Can not be empty</SPAN>');
		}
	else if(document.reg.SPDY.value.length<=0){
		Su(N,'<SPAN CLASS=Err>Year Can not be empty</SPAN>');
		}
	else{
		Su(N,'<SPAN CLASS=Ok>OK£¡</SPAN>');
	}
}


}


function TestEmail(s) {
	var re= /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
	return re.test(s);
}function fGoto()
{}
function Vs(n){
	arr = new Array(); 
	arr[1]="AL";
	arr[2]="AK";
	arr[3]="AZ";
	arr[4]="AR";
	arr[5]="CA";
	arr[6]="CO";
	arr[7]="CT";
	arr[8]="DE";
	arr[9]="DC";
	arr[10]="FL";
	arr[11]="GA";
	arr[12]="HI";
	arr[13]="ID";
	arr[14]="IL";
	arr[15]="IN";
	arr[16]="IA";
	arr[17]="KS";
	arr[18]="KY";
	arr[19]="LA";
	arr[20]="ME";
	arr[21]="MD";
	arr[22]="MA";
	arr[23]="MI";
	arr[24]="MN";
	arr[25]="MS";
	arr[26]="MO";
	arr[27]="MT";
	arr[28]="NE";
	arr[29]="NV";
	arr[30]="NH";
	arr[31]="NJ";
	arr[32]="NM";
	arr[33]="NY";
	arr[34]="NC";
	arr[35]="ND";
	arr[36]="OH";
	arr[37]="OK";
	arr[38]="OR";
	arr[39]="PA";
	arr[40]="RI";
	arr[41]="SC";
	arr[42]="SD";
	arr[43]="TN";
	arr[44]="TX";
	arr[45]="UT";
	arr[46]="VT";
	arr[47]="VA";
	arr[48]="WA";
	arr[49]="WV";
	arr[50]="WI";
	arr[51]="WY";
	arr[52]="Others";
	document.reg.SST.value=arr[n];
	Su("sta",arr[n]);
	C(4);
}
function Su(ids,msg){
	document.getElementById(ids).innerHTML = msg;
}
