function IsNumeric(sText){
  var ValidChars = "0123456789.";
  var IsNumber=true;
  var Char;
 for (i = 0; i < sText.length && IsNumber == true; i++)  { 
         Char = sText.charAt(i); 
          if (ValidChars.indexOf(Char) == -1) 
        {
         IsNumber = false;
         }
        }
  return IsNumber;
 }
function isValidEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
    } 
function ismobile(string) {
  if (string.length != 10){
    return false;}
    else{
    return true;}
    
  }
function iscodpostal(string) {
  if (string.length != 6 ){
    return false;}
    else{
    return true;}
    
  }
function validateForm1(form) { //This is the name of the function
if (!isValidEmail(form.usernamelost.value))    { 
 alert("Introduceti un email valid.") 
     form.usernamelost.focus( );
     return false; 
 }

}
function v_mod_user(form) { //This is the name of the function
if (!isValidEmail(form.user_nou.value))    { 
 alert("Introduceti un email valid.") 
     form.user_nou.focus( );
     return false; 
 }
}
function v_mod_user1(form) {
if (form.sch_parola.parolav.value == "") {
   alert("Introduceti parola veche.");
   return false;
    }
}                                                               
function validateForm(form) { //This is the name of the function

if (form.username.value == "") {
   alert("Introduceti un e-mail valid.");
   form.username.focus( );
   return false;
    }
    
if (!isValidEmail(form.username.value))    { 
 alert("Introduceti un email valid.") 
     form.username.focus( );
     return false; 
 }
 
if (form.parola.value == "") {
   alert("Introduceti parola.");
   form.parola.focus( );
   return false;
    }
    
    
if (form.parola1.value == "") {
   alert("Introduceti parola.");
   form.parola1.focus( );
   return false;
    }
if (form.parola.value != form.parola1.value) {
   alert("Parola introdusa nu este valida");
   form.parola.focus( );
   return false;
    }
    
if (form.nume.value == "") {
   alert("Introduceti numele.");
   form.nume.focus( );
   return false;
    }
if (form.prenume.value == "") {
   alert("Introducei prenumele.");
   form.nume.focus( );
   return false;
    }
if (form.adresa.value == "") {
   alert("Introduceti adresa.");
   form.adresa.focus( );
   return false;
    }
if (form.telefon.value == "") {
   alert("Introduceti telefon.");
   form.telefon.focus( );
   return false;
    }
if (!ismobile(form.telefon.value)) {
   alert("telefonul contine cel putin 10 cifre.");
   form.telefon.focus( );
   return false;
    }
if (!iscodpostal(form.codpostal.value)) {
   alert("Codul postal contine cel putin 6 cifre.");
   form.telefon.focus( );
   return false;
    }
    
    
if (form.codpostal.value == "") {
   alert("Introduceti codul postal(www.coduripostale.com.");
   form.codpostal.focus( );
   return false;
    }

if ( ( form.sex_m.checked == false ) && ( form.sex2.checked == false ) ){
    alert ( "Selectati sexul: Masculin sau Feminin." );
        return false;

    }
if ( form.ziua.selectedIndex == 0 )    {
    alert ( "Please select your Age." );
        return false;
    }
if ( form.luna.selectedIndex == 0 )    {
    alert ( "Please select your Age." );
        return false;
    }
if ( form.anul.selectedIndex == 0 )    {
    alert ( "Please select your Age." );
        return false;
    }              
    
if (!IsNumeric(form.telefon.value))    { 
 alert("Telefonul contine doar numere.") 
     form.telefon.focus( );
     return false; 
 }
 if (!IsNumeric(form.codpostal.value))    { 
 alert("Codul postal contine doar numere.") 
     form.codpostal.focus( );
     return false; 
 }
     
}
function welcome(){
alert("Un e-mail cu noua parola a fost trimis la adresa specificata!")
}

