// JavaScript Document
    /*Vérifier le remplissage des champs*/
    /************************************/
    function IsInteger(s)  //Vérifier valeur = entier
    {
    	for (var i = 0; i < s.length; i++) {
    		var c = s.charAt(i);
    		if (!((c >= "0") && (c <= "9"))) {
    			return false;
    		}
    	}
    	return true;
    }
    function verif_email(email)  //Vérifier syntaxe mail
    {
    	var place = email.indexOf("@",1);
    	var point = email.indexOf(".",place+1);
    	return ((place > -1) && (email.length >2) && (point > 1));
    }
    function controle_fiche(paiement)  //Vérifier saisie générale des champs
    {
        validity = true;
        $alert_msg="";
        /*Champs tous complets*/
        if(   document.form_fiche.email.value=="" || 
              document.form_fiche.nom.value=="" || document.form_fiche.prenom.value=="" || 
              document.form_fiche.adresse.value=="" || document.form_fiche.postal.value=="" || 
              document.form_fiche.ville.value=="" || 
              (document.form_fiche.tel_domicile.value=="" && document.form_fiche.tel_portable.value=="") || 
              document.form_fiche.media.value=="")
        {
              $alert_msg+="Veuillez remplir les champs obligatoires\n";
              validity = false;
        }

        if( document.form_fiche.email.value=="" ) $alert_msg+="Email manquant - ";
        if( document.form_fiche.nom.value=="" ) $alert_msg+="Nom manquant - ";
        if( document.form_fiche.prenom.value=="" ) $alert_msg+="Prenom manquant - "; 
        if( document.form_fiche.adresse.value=="" ) $alert_msg+="Adresse manquante - ";
        if( document.form_fiche.postal.value=="" ) $alert_msg+="Code postal manquant - ";
        if( document.form_fiche.ville.value=="" ) $alert_msg+="Ville manquante - ";
        if( (document.form_fiche.tel_domicile.value=="" && document.form_fiche.tel_portable.value=="") ) 
          $alert_msg+="Téléphone manquant - ";
        if( document.form_fiche.media.value=="" ) $alert_msg+="\"Vous nous avez connu\" manquant - ";
        
        
        /*Code postal correcte*/
        if(document.form_fiche.postal.value.length>0)
          if( !IsInteger(document.form_fiche.postal.value) || document.form_fiche.postal.value.length!=5)
          {
            $alert_msg+="Votre code postal est incorrect - ";
            validity = false;
          }
        /*Format d'email correct*/
        if(document.form_fiche.email.value!="")
        {
          if (!verif_email(document.form_fiche.email.value))
          {
		        validity=false;
		        $alert_msg+="Le format de votre mail est incorrect - ";
          }
        }
        /*Numéro de fax correct*/
        /*if(document.form_fiche.fax.value.length>0)
        {
         if( !IsInteger(document.form_fiche.fax.value) || document.form_fiche.fax.value.length<8)
         {
            validity=false;
            $alert_msg+="Le numéro du fax est incorrect - ";
         }
        }*/
        /*Numéro de téléphone correct*/
        if(document.form_fiche.tel_domicile.value.length>0)
        {
          if(!IsInteger(document.form_fiche.tel_domicile.value) || document.form_fiche.tel_domicile.value.length!=10)
          {
            validity=false;
            $alert_msg+="Le téléphone du domicile est incorrect - ";
          }
        }
        if(document.form_fiche.tel_portable.value.length>0)
        {
         if(!IsInteger(document.form_fiche.tel_portable.value) || document.form_fiche.tel_portable.value.length!=10)
         {
            validity=false;
            $alert_msg+="Le téléphone portable est incorrect - ";
         }
        }
        /*Conditions acceptées*/
        if (document.form_fiche.cond_vente.checked==false)
         {
            validity=false;
            $alert_msg+="\n\n*Vous n'avez pas accepté les conditions de vente au bas du formulaire*";
         }
    
        if ($alert_msg!="")
        {
          alert(""+$alert_msg+"");
        }
        else
        {
          document.form_fiche.type_paie.value=paiement;
          document.form_fiche.action="reglement.php";
          document.form_fiche.submit();
        }
        return validity;
    }            

