// JavaScript Document

function verifMail(form_id,email,amail){
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   	var address = document.forms[form_id].elements[email].value;
	if(reg.test(address) == false) {
      alert(amail);
      return false;
   }
}

function changerPhoto(photo){
	document.getElementById("intermediaire").src="image-fiche-"+tab[photo];
	document.getElementById("normal").href="image-zoom-"+tab[photo];
}


function verif(contact,anom,aprenom,amail,aobj,amsg){ 
	var nom = document.contact.nom.value;
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   	var address = document.contact.mail.value;

	if (document.contact.nom.value == "")
	{
		alert (anom);
		document.contact.nom.focus();
		return;
	}
	if(document.contact.prenom.value == "")
	{
		alert (aprenom);
		document.contact.prenom.focus();
		return;
	}
	if(reg.test(address) == false) {
      alert(amail);
      return;
   }
	if(document.contact.obj.value=="")
	{ 
		alert (aobj); 
		document.contact.obj.focus();
		return; 
	}
	if(document.contact.msg.value=="")
	{ 
		alert (amsg); 
		document.contact.msg.focus();
		return; 
	}
	else document.contact.submit();
}

function ouAcheter(pays,langue){
	document.location.href="/distributeurs.php?langue="+langue+"&idP="+pays;
}
 
function rechDistrib(selected,langue){
	if (document.distributeur.idP.value==""){
		var strGet="";
	}
	else{
		var strGet="?langue="+langue+"&idP="+document.distributeur.idP.value;
	}
	var cpt=0;
	if (selected=="p"){
		if (document.distributeur.idD){
			document.distributeur.idD.value="";
		}
		if (document.distributeur.idV){
			document.distributeur.idV.value="";
		}
	}
	if (selected=="d"){
		if (document.distributeur.idV){
			document.distributeur.idV.value="";
		}
	}
	if (document.distributeur.idD && document.distributeur.idP.value!=""){
		strGet=strGet+"&idD="+document.distributeur.idD.value;
	}
	if (document.distributeur.idV && document.distributeur.idP.value!=""){
		strGet=strGet+"&idV="+document.distributeur.idV.value;
	}
	document.location.href="distributeurs.php"+strGet;
}

function openPrint(pPage)
{
	window.open(pPage,'_blank','width=700,height=600,scrollbars=yes');
}
