// JavaScript Document
function affiche(index)
{
			/*document.getElementById("menu"+index).className='liste_menua';*/
			document.getElementById("menu"+index).className='visible';
			document.getElementById("lien"+index).setAttribute("onclick","cache("+index+")");
			document.getElementById("lien"+index).onclick= function(){cache(index);}
}
function cache(index)
{
			document.getElementById("menu"+index).className='masquer';
			document.getElementById("lien"+index).setAttribute("onclick","affiche("+index+")");
			document.getElementById("lien"+index).onclick= function(){affiche(index);}
}

var tab0 = new Array();

tab0[0]="XV7E";
tab0[1]="P3M2";
tab0[2]="1DNL";
tab0[3]="T834";
tab0[4]="9WR8";
tab0[5]="Q5D9";
tab0[6]="AJM2";
tab0[7]="GH51";

var ch=Math.round(Math.random()*7);
var gif="<img src=\"http://www.piertec.fr/captcha/"+ch+".gif\" alt=\"captcha\">";
var valcaptcha="<input type=\"hidden\" name=\"valeur\" id=\"valeur\" value=\""+tab0[ch]+"\" class=\"champ\">";

function testchamps()
{
 if ((document.contact_form.email.value.length==0)||((document.contact_form.email.value.indexOf("@")==-1)||(document.contact_form.email.value.indexOf(".",document.contact_form.email.value.indexOf("@"))==-1)||(document.contact_form.email.value.indexOf(".",document.contact_form.email.value.indexOf("@"))==document.contact_form.email.value.indexOf("@")+1)||(document.contact_form.email.value.lastIndexOf(".")+1==document.contact_form.email.value.length)||(document.contact_form.email.value.indexOf("..") !=-1)))
{
 alert("L'adresse email n'est pas valide");
 return false; 
}
else if (document.contact_form.nom.value.length==0)
{
alert ("Veuillez nous indiquer votre nom");
return false;
}
else if (document.contact_form.prenom.value.length==0)
{
alert ("Veuillez nous indiquer votre prénom");
return false;
}
else if (document.contact_form.adresse.value.length==0)
{
alert ("Veuillez nous indiquer votre adresse.");
return false;
}
else if (document.contact_form.cp.value.length==0)
{
alert ("Veuillez nous indiquer votre code postal.");
return false;
}
else if (document.contact_form.ville.value.length==0)
{
alert ("Veuillez nous indiquer votre ville.");
return false;
}
else if (document.contact_form.produit.value.length==0)
{
alert ("Veuillez nous indiquer le produit concerné.");
return false;
}
else if ((document.contact_form.contenu.value.length==0))
	{

     alert("Veuillez remplir le champ Message.");
     return false; 

	}
else if ((document.contact_form.captcha.value!=document.contact_form.valeur.value))
{
	alert("Le code tapé ne correspond pas à celui affiché.");
     return false; 
}
else 
 {
 return true;
 }

}
