// JavaScript Document
      
      function couleur(obj) {
      obj.style.backgroundColor = "#FFFFFF";
      }
      
      function ouvre_popup(page) {
       window.open(page,"PopUp","menubar=no, status=no, toolbar=no, location=no, scrollbars=no, resizable=no menubar=no, width=600, height=350");
      }

      function ouvre_popup2(page) {
       window.open(page,"PopUp","menubar=no, status=no, toolbar=no, location=no, scrollbars=no, resizable=no menubar=no, width=600, height=478");
      }
      
      function ouvre_gmap(page) {
       window.open(page,"PopUp","menubar=no, status=no, toolbar=no, location=no, scrollbars=no, resizable=no menubar=no, width=500, height=500");
      }
      
      function ouvre_popup4(page) {
       window.open(page,"PopUp","menubar=no, status=no, toolbar=no, location=no, scrollbars=yes, resizable=no menubar=no, width=1020, height=600");
      }
      
      function check() {
      	var msg = "";
      
      		if (document.formulaire.mail.value != "")	{
      		indexAroba = document.formulaire.mail.value.indexOf('@');
      		indexPoint = document.formulaire.mail.value.indexOf('.');
      		if ((indexAroba < 0) || (indexPoint < 0))		{
      		document.formulaire.mail.style.backgroundColor = "#EF5858";
      			msg += "Le mail est incorrect\n";
      		}
      	}
      	else	{
      		document.formulaire.mail.style.backgroundColor = "#EF5858";
      		msg += "Veuillez saisir votre mail.\n";
      	}
      
      if (document.formulaire.nom.value == "")	{
      		msg += "Veuillez saisir votre nom\n";
      		document.formulaire.nom.style.backgroundColor = "#EF5858";
      	}
      
      if (document.formulaire.prenom.value == "")	{
      		msg += "Veuillez saisir votre prenom\n";
      		document.formulaire.prenom.style.backgroundColor = "#EF5858";
      	}
      
      if (document.formulaire.ville.value == "")	{
      		msg += "Veuillez saisir votre ville\n";
      		document.formulaire.ville.style.backgroundColor = "#EF5858";
      	}
      
      if (document.formulaire.message.value == "")	{
      		msg += "Veuillez saisir un message\n";
      		document.formulaire.message.style.backgroundColor = "#EF5858";
      	}
      	
      	if (msg == "") return(true);
      	else	{
      		alert(msg);
      		return(false);
      	}
      }
      
      function check2() {
      	var msg = "";
      
      		if (document.envoiami.mail_ami.value != "")	{
      		indexAroba = document.envoiami.mail_ami.value.indexOf('@');
      		indexPoint = document.envoiami.mail_ami.value.indexOf('.');
      		if ((indexAroba < 0) || (indexPoint < 0))		{
      		document.envoiami.mail_ami.style.backgroundColor = "#EF5858";
      			msg += "Le mail est incorrect\n";
      		}
      	}
      	else	{
      		document.envoiami.mail_ami.style.backgroundColor = "#EF5858";
      		msg += "Veuillez saisir votre mail.\n";
      	}
      	
      	if (msg == "") return(true);
      	else	{
      		alert(msg);
      		return(false);
      	}
      }
      
      function check3() {
      	var msg = "";
      
      		if (document.newsletter.mail_news.value != "")	{
      		indexAroba = document.newsletter.mail_news.value.indexOf('@');
      		indexPoint = document.newsletter.mail_news.value.indexOf('.');
      		if ((indexAroba < 0) || (indexPoint < 0))		{
      		document.newsletter.mail_news.style.backgroundColor = "#EF5858";
      			msg += "Le mail est incorrect\n";
      		}
      	}
      	else	{
      		document.newsletter.mail_news.style.backgroundColor = "#EF5858";
      		msg += "Veuillez saisir votre mail.\n";
      	}
      	
      	if (msg == "") return(true);
      	else	{
      		alert(msg);
      		return(false);
      	}
      }

      function check6() {
      	var msg = "";
      
      		if (document.form.mail.value != "")	{
      		indexAroba = document.form.mail.value.indexOf('@');
      		indexPoint = document.form.mail.value.indexOf('.');
      		if ((indexAroba < 0) || (indexPoint < 0))		{
      		document.form.mail.style.backgroundColor = "#EF5858";
      			msg += "Le mail est incorrect\n";
      		}
      	}
      	else	{
      		document.form.mail.style.backgroundColor = "#EF5858";
      		msg += "Veuillez saisir votre mail.\n";
      	}
      
      if (document.form.nom.value == "")	{
      		msg += "Veuillez saisir votre nom\n";
      		document.form.nom.style.backgroundColor = "#EF5858";
      	}
      
      if (document.form.prenom.value == "")	{
      		msg += "Veuillez saisir votre prenom\n";
      		document.form.prenom.style.backgroundColor = "#EF5858";
      	}
      
      if (document.form.adresse.value == "")	{
      		msg += "Veuillez saisir votre adresse\n";
      		document.form.adresse.style.backgroundColor = "#EF5858";
      	}
      
      if (document.form.cp.value == "")	{
      		msg += "Veuillez saisir votre code postal\n";
      		document.form.cp.style.backgroundColor = "#EF5858";
      	}
      
      if (document.form.ville.value == "")	{
      		msg += "Veuillez saisir votre ville\n";
      		document.form.ville.style.backgroundColor = "#EF5858";
      	}
      
      if (document.form.pays.value == "")	{
      		msg += "Veuillez saisir votre pays\n";
      		document.form.pays.style.backgroundColor = "#EF5858";
      	}
      
      if (document.form.tel.value == "")	{
      		msg += "Veuillez saisir votre téléphone\n";
      		document.form.tel.style.backgroundColor = "#EF5858";
      	}
      
      if(document.form.agree.checked == false){
		   msg += "Veuillez cocher les conditions générales de ventes\n";
	    }
      
      if(document.form.pers.value == "0"){
		   msg += "Merci de spécifier le nombre de personnes.\n";
		   document.form.pers.style.backgroundColor = "#EF5858";
	    }
 	
    	if(msg == ""){ return(true); }
    	else	{
    		alert(msg);
    		return(false);
    	}
      }

      function check4() {
      var msg = "";
      var resultat = "";
      
      var debut = document.getElementById('divCalendar_debut_lbl').innerHTML;
      var fin = document.getElementById('divCalendar_fin_lbl').innerHTML;
     
      var DureeDebut = Date.parse(debut);
      var DureeFin = Date.parse(fin);
      
      if (DureeFin<DureeDebut){
      resultat = 2;
      }
      else if (DureeFin==DureeDebut){
      resultat = 2;
      }
       
      if(resultat==2){
        msg += "Attention la date d'arrivé est supérieure ou égale à la date de départ\n";
      }
        
      if (msg == "") return(true);
      else	{
      		alert(msg);
      		alert(debut);
      		alert(fin);
      		return(false);
      }
      }
      
      function check5() {
      	var msg = "";
      
      		if (document.reference.ref_bien.value == "")	{
      		msg += "Choisir une référence\n";
      		document.reference.ref_bien.style.backgroundColor = "#EF5858";
      	}
      	
      	if (msg == "") return(true);
      	else	{
      		alert(msg);
      		return(false);
      	}
      }

function CalcTotal(){
	var NbPers = eval(document.getElementById('pers').value - document.getElementById('enf').value)
	var TotalKs = eval(document.getElementById('Ks').value * document.getElementById('nbKitsimple').value);
	var TotalKd = eval(document.getElementById('Kd').value * document.getElementById('nbKitdouble').value);
	var TotalLb = eval(document.getElementById('Lbb').value * document.getElementById('nbLitBB').value);
	var TotalCh = eval(document.getElementById('Ch').value * document.getElementById('nbChaiseHaute').value);
	var TotalTs = eval(document.getElementById('Ts').value * NbPers);
	document.getElementById('Kitsimple').value = TotalKs;
	document.getElementById('Kitdouble').value = TotalKd;
	document.getElementById('ChaiseHaute').value = TotalCh;
	document.getElementById('litBB').value = TotalLb;
	document.getElementById('Prixpers').value = TotalTs.toFixed(2);
	var pTotal = eval(parseFloat(document.getElementById('Prix').value) + parseFloat(TotalKd) + parseFloat(TotalKs) + parseFloat(document.getElementById('litBB').value) + parseFloat(document.getElementById('ChaiseHaute').value) + parseFloat(TotalTs));
	document.getElementById('Total').value = pTotal.toFixed(2);
	var Acpte =  pTotal/4;
	document.getElementById('acompte').value = Acpte.toFixed(2);
}

