function emailCheck (emailStr) {
  var emailPat=/^(.+)@(.+)$/;
  var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
  var validChars="\[^\\s" + specialChars + "\]";
  var quotedUser="(\"[^\"]*\")";
  var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
  var atom=validChars + '+';
  var word="(" + atom + "|" + quotedUser + ")";
  var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
  var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
  var matchArray=emailStr.match(emailPat);

  if (matchArray==null) {
    return false;
  }
  
  var user=matchArray[1];
  var domain=matchArray[2];

  if (user.match(userPat)==null) {
    return false;
  }

  var IPArray=domain.match(ipDomainPat);
  
  if (IPArray!=null) {
     for (var i=1;i<=4;i++) {
	 if (IPArray[i]>255) {
	        return false;
	 }
     }
     return true;
  }

  var domainArray=domain.match(domainPat)

  if (domainArray==null) {
	return false;
  }

  var atomPat=new RegExp(atom,"g");
  var domArr=domain.match(atomPat);
  var len=domArr.length;

  if ((domArr[domArr.length-1].length<2) || (domArr[domArr.length-1].length>3)) {
    return false;
  }

  if (len<2) {
    return false;
  }

 return true;
}

function verif() {
		 var k=0;
		 var Chaine=new String('Attention:\n');
		 var VNom=document.contact.nom.value;
		 var VPrenom=document.contact.prenom.value; 
		 var VEmail=document.contact.email.value;
		 var VAdresse=document.contact.adresse.value;
		 var VCP=document.contact.CP.value;
		 var VVille=document.contact.ville.value;
		 var VPays=document.contact.pays.value;
		 var VObjet=document.contact.objet.value;
		 var VMessage=document.contact.message.value;

		if (VObjet=="")
                {
                        Chaine +='Vous devez indiquer un objet\n';
                        k=k+1;
                }
                if (VMessage=="")
                {
                        Chaine +='Vous devez indiquer un message\n';
                        k=k+1;
                                }
		if (VNom=="")
    		{
      			Chaine +='Vous devez indiquer un nom\n';
	    		k=k+1;
    		}
    		if (VPrenom=="")
    		{
      			Chaine +='Vous devez indiquer un prénom\n';
	    		k=k+1;
				}  
    		if (VEmail=="" || !emailCheck(VEmail))
    		{
      			Chaine +='Vous devez indiquer un email correct\n';
	    		k=k+1;
		}    
		if (VAdresse=="")
                {
                        Chaine +='Vous devez indiquer une adresse\n';
                        k=k+1;
                }
	
		if (VCP=="")
                {
                        Chaine +='Vous devez indiquer un code postal\n';
                        k=k+1;
                }
		if (VVille=="")
                {
                        Chaine +='Vous devez indiquer une ville\n';
                        k=k+1;
                }
		if (VPays=="")
                {
                        Chaine +='Vous devez indiquer un pays\n';
                        k=k+1;
                }
	 
    
    if (k!=0)
    {
      alert (Chaine);
      return false;
    } else {
      return true;
    }

}

function selectcontact() {
	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="RPF") {
		document.contact.contact.length=4;
		document.contact.contact.options[0].text="PUBLICITE";
		document.contact.contact.options[0].value="s-pacheco@pyc.fr";
		 document.contact.contact.options[1].text="REDACTION";
                document.contact.contact.options[1].value="p-lemercier@pyc.fr";
		 document.contact.contact.options[2].text="MAQUETTE/INFOS TECHNIQUES";
                document.contact.contact.options[2].value="a-lefevre@pyc.fr";
		 document.contact.contact.options[3].text="ABONNEMENT";
                document.contact.contact.options[3].value="d-andre@pyc.fr";
	}
	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="Clim Pratique") {
                document.contact.contact.length=4;
                document.contact.contact.options[0].text="PUBLICITE";
                document.contact.contact.options[0].value="s-pacheco@pyc.fr";
                 document.contact.contact.options[1].text="REDACTION";
                document.contact.contact.options[1].value="h-haentjens@pyc.fr";
                 document.contact.contact.options[2].text="MAQUETTE/INFOS TECHNIQUES";
                document.contact.contact.options[2].value="a-lefevre@pyc.fr";
                 document.contact.contact.options[3].text="ABONNEMENT";
                document.contact.contact.options[3].value="d-andre@pyc.fr";
        }
	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="UCF Info") {
                document.contact.contact.length=4;
                document.contact.contact.options[0].text="PUBLICITE";
                document.contact.contact.options[0].value="s-pacheco@pyc.fr";
                 document.contact.contact.options[1].text="REDACTION";
                document.contact.contact.options[1].value="s-wilson@pyc.fr";
                 document.contact.contact.options[2].text="MAQUETTE/INFOS TECHNIQUES";
                document.contact.contact.options[2].value="a-lefevre@pyc.fr";
                 document.contact.contact.options[3].text="ABONNEMENT";
                document.contact.contact.options[3].value="d-andre@pyc.fr";
        }

	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="SALLES PROPRES") {
                document.contact.contact.length=4;
                document.contact.contact.options[0].text="PUBLICITE";
                document.contact.contact.options[0].value="mc-jugan@pyc.fr";
                 document.contact.contact.options[1].text="REDACTION";
                document.contact.contact.options[1].value="b-cany@pyc.fr";
                 document.contact.contact.options[2].text="MAQUETTE/INFOS TECHNIQUES";
                document.contact.contact.options[2].value="d-thimon@pyc.fr";
                 document.contact.contact.options[3].text="ABONNEMENT";
                document.contact.contact.options[3].value="d-andre@pyc.fr";
        }

	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="MDS") {
                document.contact.contact.length=4;
                document.contact.contact.options[0].text="PUBLICITE";
                document.contact.contact.options[0].value="v-lepape@pyc.fr";
                 document.contact.contact.options[1].text="REDACTION";
                document.contact.contact.options[1].value="jf-aubry@pyc.fr";
                 document.contact.contact.options[2].text="MAQUETTE/INFOS TECHNIQUES";
                document.contact.contact.options[2].value="a-lefevre@pyc.fr";
                 document.contact.contact.options[3].text="ABONNEMENT";
                document.contact.contact.options[3].value="d-andre@pyc.fr";
        }

	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="TB") {
                document.contact.contact.length=3;
                document.contact.contact.options[0].text="PUBLICITE";
                document.contact.contact.options[0].value="mc-jugan@pyc.fr";
                 document.contact.contact.options[1].text="REDACTION";
                document.contact.contact.options[1].value="y-meyer@pyc.fr";
                 document.contact.contact.options[2].text="MAQUETTE/INFOS TECHNIQUES";
                document.contact.contact.options[2].value="d-thimon@pyc.fr";
        }

	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="MF") {
                document.contact.contact.length=3;
                document.contact.contact.options[0].text="PUBLICITE";
                document.contact.contact.options[0].value="jf-lecloirec@pyc.fr";
                 document.contact.contact.options[1].text="REDACTION";
                document.contact.contact.options[1].value="y-meyer@pyc.fr";
                 document.contact.contact.options[2].text="MAQUETTE/INFOS TECHNIQUES";
                document.contact.contact.options[2].value="d-thimon@pyc.fr";
        }

	 if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="TRT") {
                document.contact.contact.length=3;
                document.contact.contact.options[0].text="PUBLICITE";
                document.contact.contact.options[0].value="jf-lecloirec@pyc.fr";
                 document.contact.contact.options[1].text="REDACTION";
                document.contact.contact.options[1].value="b-becherini@pyc.fr";
                 document.contact.contact.options[2].text="MAQUETTE/INFOS TECHNIQUES";
                document.contact.contact.options[2].value="d-thimon@pyc.fr";
        }

	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="ETANCHEITE1") {
                document.contact.contact.length=3;
                document.contact.contact.options[0].text="PUBLICITE";
                document.contact.contact.options[0].value="jf-lecloirec@pyc.fr";
                 document.contact.contact.options[1].text="REDACTION";
                document.contact.contact.options[1].value="b-cany@pyc.fr";
                 document.contact.contact.options[2].text="MAQUETTE/INFOS TECHNIQUES";
                document.contact.contact.options[2].value="d-thimon@pyc.fr";
        }

	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="ARSEG INFO") {
                document.contact.contact.length=4;
                document.contact.contact.options[0].text="PUBLICITE";
                document.contact.contact.options[0].value="c-garaud@pyc.fr";
                 document.contact.contact.options[1].text="REDACTION";
                document.contact.contact.options[1].value="k-franciscus@pyc.fr";
                 document.contact.contact.options[2].text="MAQUETTE/INFOS TECHNIQUES";
                document.contact.contact.options[2].value="d-thimon@pyc.fr";
                 document.contact.contact.options[3].text="ABONNEMENT";
                document.contact.contact.options[3].value="d-andre@pyc.fr";
        }

	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="SNEFCCA") {
                document.contact.contact.length=3;
                document.contact.contact.options[0].text="PUBLICITE";
                document.contact.contact.options[0].value="s-pacheco@pyc.fr";
                 document.contact.contact.options[1].text="MAQUETTE/INFOS TECHNIQUES";
                document.contact.contact.options[1].value="a-lefevre@pyc.fr";
        	document.contact.contact.options[2].text="COMMANDE";
                document.contact.contact.options[2].value="d-andre@pyc.fr";
	}

	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="UCF") {
                document.contact.contact.length=3;
                document.contact.contact.options[0].text="PUBLICITE";
                document.contact.contact.options[0].value="s-pacheco@pyc.fr";
                 document.contact.contact.options[1].text="MAQUETTE/INFOS TECHNIQUES";
                document.contact.contact.options[1].value="a-lefevre@pyc.fr";
                document.contact.contact.options[2].text="COMMANDE";
                document.contact.contact.options[2].value="d-andre@pyc.fr";
        }

	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="ASPEC") {
                document.contact.contact.length=2;
                document.contact.contact.options[0].text="PUBLICITE";
                document.contact.contact.options[0].value="mc-jugan@pyc.fr";
                 document.contact.contact.options[1].text="MAQUETTE/INFOS TECHNIQUES";
                document.contact.contact.options[1].value="d-thimon@pyc.fr";
        }

	 if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="METALLIERS") {
                document.contact.contact.length=2;
                document.contact.contact.options[0].text="PUBLICITE";
                document.contact.contact.options[0].value="jf-lecloirec@pyc.fr";
                 document.contact.contact.options[1].text="MAQUETTE/INFOS TECHNIQUES";
                document.contact.contact.options[1].value="d-thimon@pyc.fr";
        }

	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="BIBLE DU TT") {
                document.contact.contact.length=3;
                document.contact.contact.options[0].text="PUBLICITE";
                document.contact.contact.options[0].value="jf-lecloirec@pyc.fr";
                 document.contact.contact.options[1].text="MAQUETTE/INFOS TECHNIQUES";
                document.contact.contact.options[1].value="d-thimon@pyc.fr";
                document.contact.contact.options[2].text="COMMANDE";
                document.contact.contact.options[2].value="d-andre@pyc.fr";
        }
	
	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="A3TS") {
                document.contact.contact.length=2;
                document.contact.contact.options[0].text="PUBLICITE";
                document.contact.contact.options[0].value="jf-lecloirec@pyc.fr";
                 document.contact.contact.options[1].text="MAQUETTE/INFOS TECHNIQUES";
                document.contact.contact.options[1].value="d-thimon@pyc.fr";
        }

	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="ARSEG") {
                document.contact.contact.length=2;
                document.contact.contact.options[0].text="PUBLICITE";
                document.contact.contact.options[0].value="c-garaud@pyc.fr";
                 document.contact.contact.options[1].text="MAQUETTE/INFOS TECHNIQUES";
                document.contact.contact.options[1].value="d-thimon@pyc.fr";
        }

	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="GUIDE DES PRESTATAIRES") {
                document.contact.contact.length=2;
                document.contact.contact.options[0].text="PUBLICITE";
                document.contact.contact.options[0].value="c-garaud@pyc.fr";
                 document.contact.contact.options[1].text="MAQUETTE/INFOS TECHNIQUES";
                document.contact.contact.options[1].value="d-thimon@pyc.fr";
        }

	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="PDF") {
                document.contact.contact.length=2;
                document.contact.contact.options[0].text="PUBLICITE";
                document.contact.contact.options[0].value="s-pacheco@pyc.fr";
                 document.contact.contact.options[1].text="MAQUETTE/INFOS TECHNIQUES";
                document.contact.contact.options[1].value="d-andre@pyc.fr";
        }

	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="PDC") {
                document.contact.contact.length=2;
                document.contact.contact.options[0].text="PUBLICITE";
                document.contact.contact.options[0].value="s-pacheco@pyc.fr";
                 document.contact.contact.options[1].text="MAQUETTE/INFOS TECHNIQUES";
                document.contact.contact.options[1].value="d-andre@pyc.fr";
        }

	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="GUIDE BPF") {
                document.contact.contact.length=2;
                document.contact.contact.options[0].text="PUBLICITE";
                document.contact.contact.options[0].value="mc-jugan@pyc.fr";
                 document.contact.contact.options[1].text="MAQUETTE/INFOS TECHNIQUES";
                document.contact.contact.options[1].value="d-andre@pyc.fr";
        }

	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="PRESTATIONS") {
                document.contact.contact.length=1;
                document.contact.contact.options[0].text="Jean-Christophe RAVEAU";
                document.contact.contact.options[0].value="jc-raveau@pyc.fr";
        }

	 if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="FROID") {
                document.contact.contact.length=1;
                document.contact.contact.options[0].text="Contact";
                document.contact.contact.options[0].value="s-pacheco@pyc.fr";
        }

	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="FROID") {
                document.contact.contact.length=1;
                document.contact.contact.options[0].text="Contact";
                document.contact.contact.options[0].value="s-pacheco@pyc.fr";
        }

	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="GENIE CLIMATIQUE") {
                document.contact.contact.length=1;
                document.contact.contact.options[0].text="Contact";
                document.contact.contact.options[0].value="s-pacheco@pyc.fr";
        }

	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="SERVICES GENERAUX") {
                document.contact.contact.length=1;
                document.contact.contact.options[0].text="Contact";
                document.contact.contact.options[0].value="c-garaud@pyc.fr";
        }

	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="ULTRAPROPRETE") {
                document.contact.contact.length=1;
                document.contact.contact.options[0].text="Contact";
                document.contact.contact.options[0].value="mc-jugan@pyc.fr";
        }

	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="AGROALIMENTAIRE") {
                document.contact.contact.length=1;
                document.contact.contact.options[0].text="Contact";
                document.contact.contact.options[0].value="v-lepape@pyc.fr";
        }

	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="FERMETURE ET PROTECTION SOLAIRE") {
                document.contact.contact.length=1;
                document.contact.contact.options[0].text="Contact";
                document.contact.contact.options[0].value="mc-jugan@pyc.fr";
        }

	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="METALLURGIE") {
                document.contact.contact.length=1;
                document.contact.contact.options[0].text="Contact";
                document.contact.contact.options[0].value="jf-lecloirec@pyc.fr";
        }

	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="METALLERIE") {
                document.contact.contact.length=1;
                document.contact.contact.options[0].text="Contact";
                document.contact.contact.options[0].value="jf-lecloirec@pyc.fr";
        }

	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="ETANCHEITE2") {
                document.contact.contact.length=1;
                document.contact.contact.options[0].text="Contact";
                document.contact.contact.options[0].value="jf-lecloirec@pyc.fr";
        }

	if (document.contact.produit.options[document.contact.produit.selectedIndex].value=="OFFRES") {
                document.contact.contact.length=1;
                document.contact.contact.options[0].text="Contact";
                document.contact.contact.options[0].value="a-lefevre@pyc.fr";
        }

	

}

