// window.onload=montre;
function montre(id) {
	var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
	if (d) {d.style.display='block';}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function VerifMail(TheMail) {
	ChaineReg=/^[a-z0-9._-]+@[a-z0-9.-]{2,}[.][a-z]{2,3}$/;
 	if (ChaineReg.exec(TheMail.toLowerCase()) == null) return false; else return true;
}

function focusIdent() {
	if (document.getElementById("log_ep_iel").value == "identifiant") document.getElementById("log_ep_iel").value = "";
}

function validerEPiel () {
	if (verifEPiel()==true) document.getElementById("frmEPiel").submit(); 
}

function verifEPiel()	{
	var retour = true;
	if (document.getElementById("mdp_ep_iel").value.length < 1) {
		document.getElementById("mdp_ep_iel").focus();
		document.getElementById("mdp_ep_iel").style.backgroundColor = "#FFFDD0";
		retour = false;
	}
	if (document.getElementById("log_ep_iel").value.length < 1) {
		document.getElementById("log_ep_iel").focus();
		document.getElementById("log_ep_iel").style.backgroundColor = "#FFFDD0";
		retour = false;
	}
	return retour;
}

function verifReturn(evt) {
	var keycode = evt.keyCode ? evt.keyCode : evt.which ? evt.which : evt.charCode;
	if (keycode==13) { validerEPiel(); }
}

function focusNLInscription() {
	if (document.getElementById("email_inscription_nl").value == "e-mail") document.getElementById("email_inscription_nl").value = "";
}
function blurNLInscription() {
	if (document.getElementById("email_inscription_nl").value == "") document.getElementById("email_inscription_nl").value = "e-mail";
}

function validerNLInscription () {
	if (verifNLInscription()==true) {
		var myAjax = new Ajax.Request('includes/ajax_inscription_nl.php', { method: 'get', parameters: 'email_inscription_nl='+document.getElementById("email_inscription_nl").value, onComplete: showResponseNL }); 
	}
}

function verifNLInscription()	{
	var retour = true;
	var bgErr = "#FFFDD0";
	if (VerifMail(document.getElementById("email_inscription_nl").value)==false) {
		document.getElementById("email_inscription_nl").focus();
		document.getElementById("email_inscription_nl").style.backgroundColor = bgErr;
		retour = false;
	}
	return retour;
}

function verifReturnNLInscription(evt) {
	var keycode = evt.keyCode ? evt.keyCode : evt.which ? evt.which : evt.charCode;
	if (keycode==13) { validerNLInscription(); }
}

function showResponseNL(originalRequest) {
	if (originalRequest.responseText.length>0) alert(originalRequest.responseText);
}


function goSearchIel () {
	document.getElementById("frmSearchIel").submit();
}

function focusSearch() {
	if (document.getElementById("searchIel").value == "recherche sur le site") document.getElementById("searchIel").value = "";
}

function blurSearch() {
	if (document.getElementById("searchIel").value == "") document.getElementById("searchIel").value = "recherche sur le site";
}