function affCalendar(chps)
{
	urlCalendar = "";
	document.getElementById("calendardu").style.visibility = 'hidden';
	document.getElementById("calendardu").innerHTML = "";
	//document.getElementById("calendarau").style.visibility = 'hidden';
	//document.getElementById("calendarau").innerHTML = "";
	if(document.getElementById("du"))
	{
		if(document.getElementById("du").value != " jj/mm/aaaa" && document.getElementById("du").value != "")
		{
			urlCalendar = "/_includes/asp/calendar.asp?chps="+chps+"&dateLimite="+document.getElementById("du").value;
		}else{
			urlCalendar = "/_includes/asp/calendar.asp?chps="+chps;
		}
	}else{
		urlCalendar = "/_includes/asp/calendar.asp?chps="+chps;
	}
	//alert(urlCalendar);
	loadPage(urlCalendar,'calendar'+chps);
}

function select_date(dat,cible){
	document.getElementById(cible).value=dat;
	document.getElementById("calendar"+cible).style.visibility = 'hidden';
	document.getElementById("calendar"+cible).innerHTML = "";
}

function closeCalendar(cible)
{
	document.getElementById("calendar"+cible).style.visibility = 'hidden';
	document.getElementById("calendar"+cible).innerHTML = "";
}

function validFormCalendar(chps)
{
	loadPage("/_includes/asp/calendar.asp?chps="+chps+"&START_MONTH="+document.getElementById("START_MONTH").options[document.getElementById("START_MONTH").selectedIndex].value+"&START_YEAR="+document.getElementById("START_YEAR").options[document.getElementById("START_YEAR").selectedIndex].value,"calendar"+chps);
}

function loadPage(url,cible)
{
	//Changement du contenu
	var xhr_object = null; 
	document.getElementById(cible).innerHTML = 'Chargement...';
	document.getElementById(cible).style.visibility = 'visible';
	//document.getElementById(cible).innerHTML = "";
 
	if(window.XMLHttpRequest) // Firefox 
	   xhr_object = new XMLHttpRequest(); 
	else if(window.ActiveXObject) // Internet Explorer 
	   xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); 
	else { // XMLHttpRequest non supporté par le navigateur 
	   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
	   return; 
	} 
 
	xhr_object.open("GET", url, true);
	
	xhr_object.onreadystatechange = function() 
	{ 
	   if(xhr_object.readyState == 4)
	   {
	   		document.getElementById(cible).innerHTML = xhr_object.responseText;
			document.getElementById(cible).style.visibility = 'visible';
		}
	} 
	 
	xhr_object.send(null); 
}

function validRechMotResa()
{
	msgalertMot = ""
	msgalertMot2 = ""

	if (document.getElementById("du").value == "")
	{
		msgalertMot = msgalertMot + "- Arrival date\n"
	}else{
		
		var tabMonth=new Array;
		tabMonth[0] = "01";
		tabMonth[1] = "02";
		tabMonth[2] = "03";
		tabMonth[3] = "04";
		tabMonth[4] = "05";
		tabMonth[5] = "06";
		tabMonth[6] = "07";
		tabMonth[7] = "08";
		tabMonth[8] = "09";
		tabMonth[9] = "10";
		tabMonth[10] = "11";
		tabMonth[11] = "12";		
		
		jourResa = document.getElementById("du").value		
		dateJour = new Date();
		heureJour = dateJour.getHours()+"."+dateJour.getMinutes()+dateJour.getSeconds();
		valJour = dateJour.getDate()+"/"+tabMonth[dateJour.getMonth()]+"/"+dateJour.getFullYear();
		if(valJour.length == 9)
		{
			valJour = "0"+valJour	
		}
		
		if (jourResa == valJour  && heureJour >16)
		{
			msgalertMot2 = "If you want to make a booking for the same day you do need to make your reservation before 4.00 PM (local time of the hotel).\n Should you wish to book your room after this deadline, please ring the hotel on: +33 (0)1 44 07 30 40."
		}	
		
		jourTest = getDate(jourResa);
				
		if (jourTest < dateJour)
		{
			msgalertMot = "- Arrival date (dd/mm/yyyy)\n";
		}
	}
	
	if (document.getElementById("nb_nuit").value == "")
	{
		msgalertMot = msgalertMot + "- Number of night\n"
	}else{
		nbNuit = document.getElementById("nb_nuit").value
		if (nbNuit > 15)
		{
			msgalertMot2 = "Should you wish to book a room  for more than 15 days,\n  contact the hotel direct (mail, fax or phone)"
		}	
	}
	
	if (document.getElementById("nb_pers").value == "")
	{
		msgalertMot = msgalertMot + "- Number of person(s)\n"
	}else{
		nbPers = document.getElementById("nb_pers").value
		if (nbPers > 6)
		{
			msgalertMot2 = "Pour toute réservation de plus de 6 personnes veuillez\n vous adresser directement à l'hôtel (par mail, fax ou téléphone)\n"
		}	
	}
	
	
	if (msgalertMot2 != "")
	{
		alert(msgalertMot2)
		return false;	
	}else{		
		if(msgalertMot != "")
		{
			msgalertMot = "Champs vide(s) :\n"+msgalertMot
			alert(msgalertMot)
			return false;
		}
		else
		{
			return true;
		}
	}
}

function choixMois(id_chb,nb_nuit,nb_pers){
	window.open('/popup_pack.asp?id_chb='+id_chb+'&nb_nuit='+nb_nuit+'&nb_pers='+nb_pers,'','resizable=no,location=no, width=320, height=200, menubar=no, status=no, scrollbars=yes, menubar=no, top=125, left=150');
}

function verifDatePack(jourResa)
{
	msgalertMot = "";
	
	var tabMonth=new Array;
	tabMonth[0] = "01";
	tabMonth[1] = "02";
	tabMonth[2] = "03";
	tabMonth[3] = "04";
	tabMonth[4] = "05";
	tabMonth[5] = "06";
	tabMonth[6] = "07";
	tabMonth[7] = "08";
	tabMonth[8] = "09";
	tabMonth[9] = "10";
	tabMonth[10] = "11";
	tabMonth[11] = "12";		
		
	dateJour = new Date();
	dayJour = parseInt(dateJour.getDate()+3).toString();
	monthJour = parseInt(tabMonth[dateJour.getMonth()]).toString();
	yearJour = parseInt(dateJour.getFullYear()).toString();

	if(dayJour.length == 1)
	{
		dayJour = "0"+dayJour	
	}
		
	dayResa = jourResa.substring(0,2);
	monthResa = jourResa.substring(3,5);
	yearResa = jourResa.substring(6,10);
	
	if(dayResa.length == 1)
	{
		dayResa = "0"+dayResa	
	}
		
	codeJour = yearJour+""+monthJour+""+dayJour
	codeResa = yearResa+""+monthResa+""+dayResa

	if(parseInt(codeJour) >= parseInt(codeResa))
	{
		msgalertMot = "If you want to book a package you should make your reservation at least 72 hours before your arrival.\n Should you wish to book your room after this deadline, please ring the hotel on: +33 (0)1 44 07 30 40."
	}	
	
	if (msgalertMot != "")
	{
		alert(msgalertMot)
		return false;	
	}else
	{
		return true;
	}
}

function getDate(strDate)
{	  
	day = strDate.substring(0,2);
	month = strDate.substring(3,5);
	year = strDate.substring(6,10);
	d = new Date(0);
	d.setDate(day);
	d.setMonth(month-1);
	d.setFullYear(year); 
	return d;  
  }