// JavaScript Document

function affiche(txt)
{
	 alert(txt);
	 document.getElementById('texte_temp').innerHTML = txt;
}


function raffraichir_page()
{
	
	var adresse = 'http://'+window.location.host+window.location.pathname;
	var Num_id = document.getElementById('Liste_commerces').value;
	adresse = adresse+'?id='+Num_id;
	alert(adresse);
	window.location.href=adresse;
	window.reload();

}

function menu()
{
	// Fonction de création des cartes sur le menu
	
	var texte = ' <img src="Images-site/Menu.gif" width="148" height="600" border="0" usemap="#Map" />';
	texte += '<map name="Map" id="Map">';
	texte += '<area shape="rect" coords="4,112,135,146" href="accueil.php" />';
	texte += '<area shape="rect" coords="3,164,136,197" href="Interieurs.php" />'
	texte += '<area shape="rect" coords="3,213,136,246" href="Exterieurs.php" />'
	texte += '<area shape="rect" coords="2,265,137,297" href="References.php" />';
	texte += '<area shape="rect" coords="3,313,138,348" href="Presentation.php" />';
	texte += '<area shape="rect" coords="1,364,136,398" href="Galeries.php" />';
	texte += '<area shape="rect" coords="4,416,136,448" href="PeintureMinerale.php" />';
	texte += '<area shape="rect" coords="2,468,138,500" href="Contact.php" />';
	texte += '<area shape="rect" coords="2,525,136,559" href="Locechaf.php" target="_blank" />';
	texte += '</map>';
	

	document.write(texte);
}




function verif_champs_contact()
{
	if(document.forml.nom.value == "")
	{
		alert("Veuillez entrer votre nom");
		document.forml.nom.focus();
		return false;
	}
	if(document.forml.prenom.value == "")
	{
		alert("Veuillez entrer votre prenom");
		document.forml.prenom.focus();
		return false;
	}
	if(document.forml.tel.value == "")
	{
		alert("Veuillez entrer votre numero de telephone");
		document.forml.tel.focus();
		return false;
	}
	if(document.forml.email.value == "")
	{
		if(document.forml.boxMail.checked==true)
		{
			alert("Veuillez nous communiquer votre adresse email pour que nous puissons vous envoyer un mail de confirmation");
			document.forml.email.focus();
			return false;
		}	
	}
	if(document.forml.email.value != "" && document.forml.email.value.indexOf('@') == -1)
	{
		alert("L'adresse Email est invalide");
		document.forml.email.focus();
		return false;
	}
	
	
	
	
	// Griser bouton envoyer
	document.forml.envoyer.disabled='TRUE';
	document.forml.effacer.disabled='TRUE';
	history.go(0);
}


function declenche_commerce()
{
	var txt = 'http://'+window.location.host+window.location.pathname+'?id='+this.options[this.selectedIndex].value+'&id_cat=';
	if (document.getElementById('Liste_categorie').value!=null)
		txt += document.getElementById('Liste_categorie').value;
	alert(txt);
}

