var secretNumber;
secretNumber = Math.round(Math.random()*1000000);
function secretImg() {
    secretString = ""+secretNumber;
    if (document.myform) {
        document.myform.codeCheck.value=secretNumber;
        for (i=0;i<secretString.length;i++) {
            document.images['s'+i].src=staticpath+"img/form/s"+secretString.charAt(i)+".gif";
        }
    }
}

onload=secretImg;

function checkContactForm() {
      if (document.myform.name.value == "") {
          alert("\nLe champ Nom est obligatoire.\n\n"+"Indiquez votre nom.");
          document.myform.name.focus();
          return false;
      } else if (document.myform.email.value == "") {
          alert("\nLe champ E-mail est obligatoire.\n\n"+"Indiquez votre adresse e-mail.");
          document.myform.email.focus();
          return false;
      } else if (! isValidEmail(document.myform.email.value)) {
          alert("\n"+"Vérifiez votre adresse e-mail.");
          document.myform.email.focus();
          return false;
      } else if (document.myform.code.value != secretNumber) {
          alert("\nLe code de sécurité n'est pas correct.\n\n"+"Veuillez le réindiquer");
          document.myform.code.focus();
          return false;
      }
    if (document.myform.typeabuse) {
          if (document.myform.typeabuse.selectedIndex == 0) {
              alert("\n"+"Merci de selectionner un sujet !");
              document.myform.typeabuse.focus();
              return false;
          }
    }
      if (this.msgMandatory && msgMandatory == 'true') {
            if (document.myform.message.value == "") {
                alert("\n"+"Merci de remplir le champs 'message'.");
                document.myform.message.focus();
                return false;
            }
      }
      return true;
}
