
function validationMail(obj)
 {
   var email   = obj.value;
   var verif   =  new RegExp("^[.a-zA-Z0-9_-]+@[.a-zA-Z0-9_-]{3,}[.][a-zA-Z]{2,4}$");
   if (verif.exec(email) == null)
      {
        return false;
      }
      else
      {
        return true;
      }  
 }

function verifierNom(nom)
 {
   var champs   = this.document.getElementById(nom).value;
   var verif = new RegExp("^[a-zA-Z]{1}+[ -.a-zA-Z]+[a-zA-Z]{1}+$");
   if (verif.exec(champs) == null)
      {
        this.document.getElementById(nom).style.backgroundColor="#ff0000";
        return false;
      }
      else
      {
         this.document.getElementById(nom).style.backgroundColor="#c5b390";
        return true;
      }  
 }
 
function verifierPws(nom)
 {
   var champs = this.document.getElementById(nom).value;
   var verif = new RegExp("^[-.#@!:?,;\$/\\&a-zA-Z0-1]+$");
   if (verif.exec(champs) == null)
      {
        this.document.getElementById(nom).style.backgroundColor="#ff0000";
        return false;
      }
      else
      {
         this.document.getElementById(nom).style.backgroundColor="#c5b390";
        return true;
      }  
 }
 
 function ChampVide(nom) {

  if (this.document.getElementById(nom).value=="") {
     this.document.getElementById(nom).style.backgroundColor="#ff0000";
   return false;
  }else{
     this.document.getElementById(nom).style.backgroundColor="#c5b390";
  return true
   }
 }
 
 function IsNumberString(NumStr)
{var regEx = new RegExp("^[0-9]+$");
var ret=false;
if (regEx.test(NumStr)) ret=true;
return ret;
}

 
function Validation() {
tmpVerif=true;
 if (!ChampVide("nom")) { tmpVerif = false; }
 if (!ChampVide("prenom")) { tmpVerif = false; }
 if (!ChampVide("pseudo")) { tmpVerif = false; }
 if (!ChampVide("pws")) { tmpVerif = false; }
 if (!ChampVide("adr1")) { tmpVerif = false; }
 if (!ChampVide("cp")) { tmpVerif = false; }
 if (!ChampVide("ville")) { tmpVerif = false; }
 if (!ChampVide("email")) { tmpVerif = false; }
 if (!ChampVide("nomRoyaume")) { tmpVerif = false; }
 if (!ChampVide("nomRoi")) { tmpVerif = false; }
 if (!ChampVide("nomDruide")) { tmpVerif = false; }
 if (!ChampVide("code")) { tmpVerif = false; }
 
 if (!tmpVerif) {
   alert("Certains champs obligatoires ne sont pas remplis !");
   return false;
 }
 
 var myStr = new String();

 if (!validationMail(this.document.getElementById("email"))) {
   alert("l'adresse email semble ne pas être valide !");
   this.document.getElementById("email").style.backgroundColor="#ff0000";
   return false;
  }

 myStr=this.document.getElementById("pws").value;
 if (myStr.length<6) {
   alert("le mot de passe est trop court (6 caractères minimum) !");
   this.document.getElementById("pws").style.backgroundColor="#ff0000";
   return false;
  }
  
 this.document.getElementById("inscription").submit();
} 
