/* - - - - - - - - - - - - - - - - - - - - - - -
 JavaScript
 jeudi 13 décembre 2007 17:40:30
 HAPedit 3.1.11.111
 - - - - - - - - - - - - - - - - - - - - - - - */

  savefocus="SOCIETE";
  first=true;

  function initfocus(myform) {
       myform.elements["SOCIETE"].focus();
       //testfocus(myform,"SOCIETE");
  }

  function testEmail(email) { /* test xxxx@xxx.ext*/
           nn=email.search("@");
           if (nn>0) {
              tab=email.split("@");
              ext=tab[1];
              nn=email.split(".").length;
              if (nn>0) return true;
              else return false;
           }
           else return false;
  }

  function testfocus(myform,champ) {

        var c1=myform.elements[savefocus];
        var c2=myform.elements[champ];
        addstr="_focus";
        addlen=addstr.length;
        add1=c1.className.substr(c1.className.length-addlen,c1.className.length);
        add2=c2.className.substr(c2.className.length-addlen,c2.className.length);
        if (add2!=addstr) c2.className=c2.className+addstr;
        if (add1==addstr) c1.className=c1.className.substr(0,c1.className.length-addlen);
        //alert(c2.className);
        savefocus=champ;

  }

  /* ---- vérification du formulaire du contact ----*/
  function check_contact(myform) {

         test1=(myform.elements["NOM"].value!='');
         test2=(myform.elements["SOCIETE"].value!='');
         test3=(myform.elements["TEL"].value!='');
         test4=testEmail(myform.elements["EMAIL"].value);

         if (test1 && test2 && test3 && test4) {
            Valider(myform,'');
         }
         else {
              if (!test4) message("adresse email incorrecte !");
              else message("Merci de remplir tous les champs obligatoires");
         }
  }
