//declaration des variable d'environnement
	var requete;


//Fonctions appelle par l'intreface d'administration
	//Fonction Generique
		function getRequete(){
			var result=requete;
			if (result == null){
				if( window.XMLHttpRequest){
				//Navigateur compatible Mozilla
					result= new XMLHttpRequest();
				}
				if(window.ActiveXObject){
				//Internet Explorer sous Windows
					result= new ActiveXObject("Microsoft.XMLHTTP");
				}
			}
			return result;
		}

//envoie d'un mail via la page contact
function envoie_mail(){
var affich_erreur;
	
	//NOM
	if($F('nom')=="")
	{
		affich_erreur="- Vous n'avez pas rentré de nom \n";
	}
	
	//EMAIL
	if($F('email')=="")
	{
		affich_erreur+="- Vous n'avez pas rentré d'email \n";
	}
	
	//TELEPHONE
	if($F('telephone')=="")
	{
		affich_erreur+="- Vous n'avez pas rentré de numéro de téléphone \n";
	}
	
	//ADRESSE
	if($F('adresse')=="")
	{
		affich_erreur+="- Vous n'avez pas rentré d'adresse \n";
	}
	
	//VILLE
	if($F('ville')=="")
	{
		affich_erreur+="- Vous n'avez pas rentré de ville \n";
	}
	
	//CODE POSTAL
	if($F('cpostal')=="")
	{
		affich_erreur+="- Vous n'avez pas rentré de code postal \n";
	}
	
	//ARRIVEE
	if($F('depuis')=="")
	{
		affich_erreur+="- Vous n'avez pas rentré de date d'arrivee \n";
	}
	
	//DEPART
	if($F('jusqua2')=="")
	{
		affich_erreur+="- Vous n'avez pas rentré de date depart \n";
	}
	
	//NOMBRE D'ENFANTS
	if($F('nbenfants')=="")
	{
		affich_erreur+="- Vous n'avez pas rentré le nombre d'adultes \n";
	}
	
	//NOMBRE D'ADULTES
	if($F('nbadultes')=="")
	{
		affich_erreur+="- Vous n'avez pas rentré le nombre d'enfants \n";
	}

//SI A PRIORI TOUT EST BON, ON EXPEDIE !
	if(affich_erreur==null)
	{
	httpObject = getRequete();
		if (httpObject != null) {
			var corps='nom=' + encodeURIComponent($F('nom'))+'&prenom=' + encodeURIComponent($F('prenom'))+'&telephone=' + encodeURIComponent($F('telephone'))+'&adresse=' +encodeURIComponent($F('adresse'))+'&ville=' + encodeURIComponent($F('ville'))+'&cpostal=' + encodeURIComponent($F('cpostal'))+'&pays=' + encodeURIComponent($F('pays'))+'&email=' + encodeURIComponent($F('email'))+'&depuis=' + encodeURIComponent($F('depuis'))+'&jusqua2=' + encodeURIComponent($F('jusqua2'))+'&nbadultes=' + encodeURIComponent($F('nbadultes'))+'&nbenfants=' + encodeURIComponent($F('nbenfants'))+'&ageenfants=' + encodeURIComponent($F('ageenfants'))+'&contenu='+encodeURIComponent($F('contenu'));
			httpObject.open("POST", "sendmail.php", true);
			httpObject.setRequestHeader("Content-type","application/x-www-form-urlencoded");
			httpObject.onreadystatechange = recup_retour;
			httpObject.send(corps);
		}
	
	}
	else
	{
		alert("Il manque des informations : \n"+affich_erreur);
	}

}

function recup_retour(){
			if (httpObject.readyState == 4 && httpObject.status == 200){
				$('page').innerHTML=httpObject.responseText;
			}
}
