function controle(){


if ((document.ff.civilite[0].checked == false)&&(document.ff.civilite[1].checked == false)&&(document.ff.civilite[2].checked == false)){
alert("Il faut cocher Mme Mlle ou M  ! ");document.ff.civilite[0].style.backgroundColor = "red";document.ff.civilite[1].style.backgroundColor = "red";document.ff.civilite[2].style.backgroundColor = "red";document.ff.civilite[0].focus();return false;}
else{document.ff.civilite[0].style.backgroundColor = "#333333";document.ff.civilite[1].style.backgroundColor = "#333333";document.ff.civilite[2].style.backgroundColor = "#333333";}



if (document.ff.nom.value== ""){alert("Il faut préciser votre nom ! \r ");document.ff.nom.focus();return false;}
//if (document.ff.email.value== ""){alert("Il faut préciser une adresse email ! \r ");document.ff.email.focus();return false;}

adresse = document.ff.email.value;taille = document.ff.email.value.length;
validelog = false;validedom = false;valideext = false;
espace=arob = adresse.lastIndexOf(" ");
arob = adresse.lastIndexOf("@");login = adresse.substring(0,arob);
pointfinal = adresse.lastIndexOf(".");extension = adresse.substring(pointfinal,taille);
domaine = adresse.substring(arob+1,pointfinal);

if (adresse.length ==0 )  {alert('Pouvez-vous indiquer une adresse email de contact ? ');validelog = false; document.ff.email.style.backgroundColor = "#F3C200";document.ff.email.focus();return false;}
//alert (arob);
if ( espace <= 0 ) {validelog = true;}else {alert(' Il ne faut pas d\'espace dans votre adresse email');validelog = false; document.ff.email.style.backgroundColor = "#F3C200";document.ff.email.focus();return false;}
if ( arob  >= 0 ) {validelog = true;}else {alert(' Adresse e-mail invalide.\nElle doit comporter un @ ');validelog = false; document.ff.email.style.backgroundColor = "#F3C200";document.ff.email.focus();return false;}
//alert (pointfinal);
if ( pointfinal > -1) {valideext = true;}else {alert('Adresse e-mail invalide.\nIl faut un nom à droite de l\'@ suivi d\'un point avant la finale.');valideext = false;document.ff.email.style.backgroundColor = "#F3C200";document.ff.email.focus();return false;}
//alert (login);
if ( login.length > 1 ) {validelog = true;}else {alert('Adresse e-mail invalide.\nAu moins 2 caractères avant l\'@');validelog = false; document.ff.email.style.backgroundColor = "#F3C200";document.ff.email.focus();return false;}
//alert (domaine);
if (domaine.length > 1 ) {validedom = true;}else {alert('Adresse e-mail invalide.\nAu moins 2 caractères après l\'@ et avant la finale.');validelog = false; document.ff.email.style.backgroundColor = "#F3C200";document.ff.email.focus();return false;}
//alert (extension);
if ( extension.length == 3 || extension.length == 4) {valideext = true;}else {alert('Adresse e-mail invalide.\nLa finale n\'est pas bonne.');valideext = false;document.ff.email.style.backgroundColor = "#F3C200";document.ff.email.focus();return false;}
//alert (espace);
if ( validelog == true && validedom == true && valideext == true ) {document.ff.email.style.backgroundColor = "#FFFFFF";}

if (document.ff.min.value== ""){alert("Il faut préciser un prix minimum envisagé pour votre achat \r ");document.ff.min.style.backgroundColor = "#F3C200";document.ff.min.focus();return false;}else{document.ff.min.style.backgroundColor = "white";}

reg = new RegExp('[^0-9]+', 'g'); 
valeur = document.ff.min.value; 
if(reg.test(valeur)){alert("La case minimum  ne doit comporter que des chiffres !");document.ff.min.focus();document.ff.min.style.backgroundColor = "#F3C200";document.ff.min.focus();return false;}else{document.ff.min.style.backgroundColor = "white";}


//if (document.ff.max.value== ""){alert("Il faut préciser un prix maximum envisagé pour votre achat \r ");document.ff.max.style.backgroundColor = "#F3C200";document.ff.max.focus();return false;}else{document.ff.max.style.backgroundColor = "white";}


var min = document.ff.min.value;
var max = document.ff.max.value;

if(max-min <0){alert("Le prix maximum envisagé doit être supérieure au prix minimum \r ");document.ff.max.style.backgroundColor = "#F3C200";document.ff.min.style.backgroundColor = "#F3C200";document.ff.max.focus();return false;}else{document.ff.max.style.backgroundColor = "white";document.ff.min.style.backgroundColor = "white";}


if((document.ff.type[0].checked == false)&&(document.ff.type[1].checked == false) &&(document.ff.type[2].checked == false) &&(document.ff.type[3].checked == false)){document.ff.type[0].style.backgroundColor = "#F3C200";document.ff.type[1].style.backgroundColor = "#F3C200";document.ff.type[2].style.backgroundColor = "#F3C200";document.ff.type[3].style.backgroundColor = "#F3C200";alert("Il faut cocher le type d'appareil souhaité ou cocher\"ne sais pas\" ");document.ff.type[0].focus();return false;}else{document.ff.type[0].style.backgroundColor = "black";document.ff.type[1].style.backgroundColor = "black";document.ff.type[2].style.backgroundColor = "black";document.ff.type[3].style.backgroundColor = "black";}

if (document.ff.but.value== ""){alert("Il faut préciser le but de votre achat ! \r ");document.ff.but.style.backgroundColor = "#F3C200";document.ff.but.focus();return false;}

if ((document.ff.mode_paiement[0].checked == false)&&(document.ff.mode_paiement[1].checked == false)){
alert("Il faut indiquer le mode de paiement souhaité ! ");document.ff.mode_paiement[0].style.backgroundColor = "red";document.ff.mode_paiement[1].style.backgroundColor = "red";document.ff.mode_paiement[0].focus();return false;}
else{document.ff.mode_paiement[0].style.backgroundColor = "black";document.ff.mode_paiement[1].style.backgroundColor = "black";}

document.ff.Submit.disabled=true;
document.ff.Submit.value="PATIENCE";

}
