﻿function valida_resgistra(){ 
   	//First name 
   	if (document.expressRegistration.FirstNameRegistration.value.length==0){ 
      	 alert("Please, enter your First Name") 
      	 document.expressRegistration.FirstNameRegistration.focus() 
      	 return false; 
   	} 
	
   	//Last name 
   	if (document.expressRegistration.LastNameRegistration.value.length==0){ 
      	 alert("Please, enter your Last Name") 
      	 document.expressRegistration.LastNameRegistration.focus() 
      	 return false; 
   	} 
   	
   	/*Country Code Phone 
   	if (document.expressRegistration.CountryCodePhoneRegistration.value.length==0){ 
      	 alert("Please, enter your Country Code Number") 
      	 document.expressRegistration.CountryCodePhoneRegistration.focus() 
      	 return false; 
   	}
   	 if ( isNaN( document.expressRegistration.CountryCodePhoneRegistration.value) ) {   
        alert("Please, enter a Number")  
        document.expressRegistration.CountryCodePhoneRegistration.focus() 
        return false  
        }	*/
   	
   	//Area Code Phone 
   	/*if (document.expressRegistration.AreaCodePhoneRegistration.value.length==0){ 
      	 alert("Por favor, escriba la clave lada") 
      	 document.expressRegistration.AreaCodePhoneRegistration.focus() 
      	 return false; 
   	}
   	 if ( isNaN( document.expressRegistration.AreaCodePhoneRegistration.value) ) {   
        alert("Por favor, numeros solamente")  
        document.expressRegistration.AreaCodePhoneRegistration.focus() 
        return false  
   }*/
   
   //Phone number 
   	if (document.expressRegistration.PhoneRegistration.value.length==0){ 
      	 alert("Por favor, escriba su telefono") 
      	 document.expressRegistration.PhoneRegistration.focus() 
      	 return false; 
   	}
   	 if ( isNaN( document.expressRegistration.PhoneRegistration.value) ) {   
        alert("Por favor, use numeros solamente sin espacios ni guiones")  
        document.expressRegistration.PhoneRegistration.focus() 
        return false  
   }
   
   //Email 
   	if (document.expressRegistration.emailRegistration.value.length==0){ 
      	 alert("Please, enter your Email") 
      	 document.expressRegistration.emailRegistration.focus() 
      	 return false; 
   	} if (!checkemail( document.expressRegistration.emailRegistration.value)) {   
        alert("Please, enter a valid Email")  
         document.expressRegistration.emailRegistration.focus() 
      	 return false; 

   } else if (!checkemail( document.expressRegistration.emailRegistration)) {   
        alert+=("Please, enter a valid Email")  
         document.expressRegistration.emailRegistration.focus() 
      	 return false; 

   }


}


  function checkemail(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
			return false;
		}
		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
			return false;
		}
		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
			return false;
		}
		if (str.indexOf(at,(lat+1))!=-1){
			return false;
		}
		if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
			return false;
		}
		if (str.indexOf(dot,(lat+2))==-1){
			return false;
		}
		if (str.indexOf(" ")!=-1){
			return false;
		}
		return true;
	}





	
