function isEng(text){
     for(j=0;j<=(text.length-1);j++){
		ok=false;	
	//===== A-Z ======
	for(i=65;i<=90;i++){	
	   if(text.substring(j,j+1)==String.fromCharCode(i)){
		ok=true;
		//alert("ok= "+String.fromCharCode(i));
	   }
	}
	//===== a-z ======
	for(i=97;i<=122;i++){
	   if(text.substring(j,j+1)==String.fromCharCode(i)){
		ok=true;
   		//alert("ok= "+String.fromCharCode(i));
	   }
	}
	if(text.substring(j,j+1)=='_'){
		ok=true;
   		//alert("ok= "+String.fromCharCode(i));
	}
	if(text.substring(j,j+1)=='-'){
		ok=true;
   		//alert("ok= "+String.fromCharCode(i));
	}
	if(text.substring(j,j+1)=='&'){
		ok=true;
   		//alert("ok= "+String.fromCharCode(i));
	}
	//===== if not in set =========
	if(ok==false){
	   //alert("กรุณากรอก Username เป็นภาษาอังกฤษเท่านั้น!");
	   return false;	
	}	
 }//exit for j
//alert("text ok!");
return true;
}//end textOK

function isMail(text){
     for(j=0;j<=(text.length-1);j++){
		ok=false;
	//===== 0-9 ======
	for(i=48;i<=57;i++){
	   if(text.substring(j,j+1)==String.fromCharCode(i)){
		ok=true;
		//alert("ok= "+String.fromCharCode(i));
	   }
	}
	//===== A-Z ======
	for(i=65;i<=90;i++){	
	   if(text.substring(j,j+1)==String.fromCharCode(i)){
		ok=true;
		//alert("ok= "+String.fromCharCode(i));
	   }
	}
	//===== a-z ======
	for(i=97;i<=122;i++){
	   if(text.substring(j,j+1)==String.fromCharCode(i)){
		ok=true;
   		//alert("ok= "+String.fromCharCode(i));
	   }
	}
	if(text.substring(j,j+1)=='_'){
		ok=true;
   		//alert("ok= "+String.fromCharCode(i));
	}
	if(text.substring(j,j+1)=='@'){
		ok=true;
   		//alert("ok= "+String.fromCharCode(i));
	}
	if(text.substring(j,j+1)=='.'){
		ok=true;
   		//alert("ok= "+String.fromCharCode(i));
	}
	//===== if not in set =========
	if(ok==false){
	   //alert("กรุณากรอก Username เป็นภาษาอังกฤษเท่านั้น!");
	   return false;	
	}	
 }//exit for j
//alert("text ok!");

as=text.indexOf('@');
dot=text.indexOf('.');
if(as < 0){
	return false;
}
if(dot < 0){
	return false;
}
if(dot <= as){
	return false;
}
if(dot-1 == as ){
	return false;
}

return true;
}//end textOK

function isNum(text){
   for(j=0;j<=(text.length-1);j++){
	ok=false;
	//===== 0-9 ======
	for(i=48;i<=57;i++){
	   if(text.substring(j,j+1)==String.fromCharCode(i)){
		ok=true;
		//alert("ok= "+String.fromCharCode(i));
	   }
	}	 
	//===== if not in set =========
	if(ok==false){
	   return false;	
	}	
   }//exit for j
		//alert("num ok!");
   return true;
}//end numOK


function isURL(text){
     for(j=0;j<=(text.length-1);j++){
		ok=false;
	//===== 0-9 ======
	for(i=48;i<=57;i++){
	   if(text.substring(j,j+1)==String.fromCharCode(i)){
		ok=true;
	   }
	}
	//===== A-Z ======
	for(i=65;i<=90;i++){	
	   if(text.substring(j,j+1)==String.fromCharCode(i)){
		ok=true;
	   }
	}
	//===== a-z ======
	for(i=97;i<=122;i++){
	   if(text.substring(j,j+1)==String.fromCharCode(i)){
		ok=true;
	   }
	}
	//==== speciel char ===
	if(text.substring(j,j+1)==':'){
		ok=true;
	}
	if(text.substring(j,j+1)=='/'){
		ok=true;
	}
	if(text.substring(j,j+1)=='.'){
		ok=true;
	}
	if(text.substring(j,j+1)=='-'){
		ok=true;
	}
	if(text.substring(j,j+1)=='_'){
		ok=true;
	}
	//===== if not in set =========
	if(ok==false){
	   return false;	
	}	
 }//exit for j
 return true;
}// end isURL