function ChgImg(img,new_img){
	img.src = new_img;
}

function AffBloc(id){
	bloc = window.document.getElementById(id);
	if (bloc) bloc.style.display = "block";	
}

function EffBloc(id){
	bloc = window.document.getElementById(id);
	if (bloc) bloc.style.display = "none";	
}

function EffBlocs(p1,p2,p3,p4){
	
}

function GetHaut(id){
	bloc = window.document.getElementById(id);
	if (bloc) return bloc.offsetHeight;	
}

function GetLarg(id){
	bloc = window.document.getElementById(id);
	if (bloc) return bloc.offsetWidth;	
}

function HautBloc(id,haut){
	bloc = window.document.getElementById(id);
	if (bloc) bloc.style.height = haut+"px";
}

function LargBloc(id,larg){
	bloc = window.document.getElementById(id);
	if (bloc) bloc.style.width = larg+"px";
}

function impPage(p1,p2,p3,p4,varGet){
	tblGet = varGet.split("&");
	otGet = "";
	for (i=0;i<tblGet.length;i++){
		if (tblGet[i].indexOf("p1")==-1 && tblGet[i].indexOf("p2")==-1 && tblGet[i].indexOf("p3")==-1 && tblGet[i].indexOf("p4")==-1){
			otGet+= "&"+tblGet[i];
		} 
	}
	lkImp = "imprimer.php?p1="+p1+"&p2="+p2+"&p3="+p3+"&p4="+p4;
	if (otGet.length>0) lkImp+= otGet;
	window.open(lkImp,'impression','location=no, menubar=no, resizable=yes, status=no, toolbar=no, scrollbars=yes, top=5, left=5, width=580, height=400');
}

function rechPh(){
	window.location.href = '?p1=7&p2=0&p3=0&p4=0&nmc=' + document.getElementById('nmc').value;
	//else alert("Merci de préciser un numéro ou un mot-clé");
}

function affServ(nomMn,valOp){
	valOp = new String(valOp);
	valOp = valOp.split("-");
	idSr = valOp[0];
	nbSr = valOp[1];
	if (nbSr>1){
		alert("Merci de préciser l'intitulé de votre service dans le nouveau menu déroulant");
		document.getElementById(nomMn).style.display = "none";
		document.getElementById('mn_s'+idSr).style.display = "block";
	}
	else document.getElementById('id_serv').value = idSr;
}

function verifCtnMail(adrMail){
	if (adrMail.indexOf("@anfa-auto.fr")==-1 && adrMail.indexOf("@asfa-auto.fr")==-1 && adrMail.indexOf("@gnfa-auto.fr")==-1){
		alert("Seules les adresses e-mail du groupe ANFA-ASFA-GNFA sont autorisées");
		return false;
	}
	return true;
}

function verifForm(formulaire){
	nbElmt = formulaire.length;
	num = 0;
	for (i=0;i<nbElmt;i++){
		if (formulaire[i].value=="") num++;
	}
	if (num>0){
		alert("Tous les champs du formulaire doivent être renseignés");
		return false;
	}
	return true;
}

function verifIdMailER(formulaire){
	if (verifForm(formulaire)){
		return verifCtnMail(formulaire.adr_mail.value);	
	}
	return false;	
}

function verifInscrER(formulaire){
	if (verifForm(formulaire)){
		if (formulaire.id_serv.value==0){
			alert("Merci de préciser votre service");
			return false;
		}
		else return verifCtnMail(formulaire.adr_mail.value);
	}
	return false;
}

function verifPh(debut,fin){
	for (i=debut;i<fin;i++){
		idPh = "ph_" + i;
		if (document.getElementById(idPh).checked) return true;
	}
	alert("Merci de sélectionner une photo au préalable");
	return false;
}