function fct_expand_collapse(item) {
	calc = document.getElementById(item);
	if(calc.style.display == 'none') {
		calc.style.display = 'block';
	} else {
		calc.style.display = 'none';
	}
}

function PopupImage(img) { 
	titre="La barri&egrave;re de Transinne"; 
	w=open("",'','width=1024,height=768,toolbar=no,scrollbars=no,resizable=no'); 
	w.document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE></HEAD>"); 
	w.document.write("<SCRIPT language=javascript>function checksize() { if (document.images[0].complete) { window.resizeTo(document.images[0].width+10,document.images[0].height+30); window.focus();} else { setTimeout('checksize()',250) } }</"+"SCRIPT>"); 
	w.document.write("<BODY onload='checksize()' onblur='window.close()' onclick='window.close()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0>");
	w.document.write("<TABLE width='100%' border='0' cellspacing='0' cellpadding='0' height='100%'><TR>");
	w.document.write("<TD valign='middle' align='center'><IMG src='images/"+img+"' border=0 alt='agrandissement' />"); 
	w.document.write("</TD></TR></TABLE>");
	w.document.write("</BODY></HTML>"); 
	w.document.close(); 
} 

function js_fct_confirm_delete(newsid) {

	if (confirm("Etes-vous sūr de vouloir supprimer ce vin ?")) {
		document.location = "index.php?action=console&a=supprimer&id=" + newsid;
	}

}

function validation_formulaire(frm) {
	var erreur = "";
	
	remise_normale(frm);
	
	nom = frm.nom;
	email = frm.email;
	message = frm.message;
	
	//validation mail
	verif_mail = /^[A-Za-z0-9\.\-_]+@[A-Za-z0-9\.\-_]+$/g;
	
	if (nom.value.length < 1) {
		erreur += "\n:: Veuillez entrer votre nom<br />";
		nom.style.backgroundColor = "#F8C894";
	}
	
	if (!verif_mail.test(email.value)) {
		erreur += "\n:: Veuillez entrer une adresse e-mail correcte<br />";
		email.style.backgroundColor = "#F8C894";
	}
	
	if (message.value.length < 1) {
		erreur += "\n:: Veuillez entrer votre message<br />";
		message.style.backgroundColor = "#F8C894";
	}
	
	//sortie // erreurs ou pas ?
	if (erreur.length > 1) {
		erreur+="<br /><br />";
		document.getElementById("champ_erreurs").innerHTML=
			"<font color=\"red\">" + erreur + "</font>";
		return false;
	}
	else {
		//ok, pas d'erreur on soumet le formulaire
		frm.submit();
	}
}

//remettre les champs a blanc apres une correction du formulaire
function remise_normale(frm) {
	frm.nom.style.backgroundColor = "#FFFFFF";
	frm.email.style.backgroundColor = "#FFFFFF";
	frm.message.style.backgroundColor = "#FFFFFF";
	document.getElementById("champ_erreurs").innerHTML="";
}

//liensovers
if (document.images) {
	lien1off = new Image(80, 76); lien1off.src = "images/logo01norm.gif";
	lien1on  = new Image(80, 76); lien1on.src = "images/logo01over.gif";
	lien2off = new Image(80, 76); lien2off.src = "images/logo02norm.gif";
	lien2on  = new Image(80, 76); lien2on.src = "images/logo02over.gif";
	lien3off = new Image(96, 76); lien3off.src = "images/logo03norm.gif";
	lien3on  = new Image(96, 76); lien3on.src = "images/logo03over.gif";
	lien4off = new Image(76, 76); lien4off.src = "images/logo04norm.gif";
	lien4on  = new Image(76, 76); lien4on.src = "images/logo04over.gif";
	
}
		
function lightup(imgName) {
   	if (document.images) {
		imgOn=eval(imgName + "on.src");
		document[imgName].src= imgOn;
  	}
}

function turnoff(imgName) {
   	if (document.images) {
		imgOff=eval(imgName + "off.src");
		document[imgName].src= imgOff;
	}
}
