// (C) 2006 by hoteliers.com 
var curDate = new Date();
var lang = 'nl';
var hEngine = 'http://www.hoteliers.com/wlpREngine.php?lang=' + lang + '&ID='; 

function dInM(mon)
{ 
if (mon == 2)
{
Year = curDate.getFullYear();
if(Math.round(Year/4) == Year/4)
{
if(Math.round(Year/100) == Year/100)
{
if(Math.round(Year/400) == Year/400)
return 29;
else return 28;
}
else return 29;
}
return 28;
}
else if (mon == 4 || mon == 6 || mon == 9 || mon == 11)
{
return 30;
}
return 31;
}

function getNDay() {

theMonth = document.hcomForm.am.options.selectedIndex;
theDay = parseInt(document.hcomForm.ad.options.selectedIndex);
// The original script wouldn't work in january (month 0 in JS)
if (! theDay == 0) {
 dInMonth = dInM(theMonth);
 if (theDay > dInMonth) {
  document.hcomForm.ad.options.selectedIndex = theDay = dInMonth;
 }
 newDay = theDay + 1;
 newMonth = theMonth;

 if (newDay > dInMonth) {
  newDay = 1;
  newMonth = theMonth + 1;
  if (newMonth > 12) {
   newMonth = 1;
  }
 }
 
 document.hcomForm.dd.selectedIndex = newDay;
 document.hcomForm.dm.selectedIndex = newMonth;
 }
}


function doCheckForm()
{
el = document.getElementById('hotdiv');
if (el) {
  h = document.getElementById('bodycontainingcell').offsetHeight;
  h = h ? h + 'px' : '100%';
	el.innerHTML = '<iframe name="' + document.hcomForm.hTarget.value + '" id="theactualiframe" src="http://www.hoteliers.com/wlpREngine.php?ID=' + document.hcomForm.hotelID.value + '&lang=' + lang + '" width="100%" style="height: ' + h + '" frameborder="0" style="margin: 0; padding: 0;" scrolling="auto" onload="doExpandTheCalender()">';
	el = document.getElementById('snippet_right');
  if (el) {
    el.parentNode.removeChild(el); 
    document.getElementById('bodycontainingcell').width = '600';
  }
}

document.hcomForm.target = document.hcomForm.hTarget.value;
document.hcomForm.action = 'http://www.hoteliers.com/wlpREngine.php?ID=' + document.hcomForm.hotelID.value + '&lang=' + lang;
document.hcomForm.submit();

}

function checkDDate()
{
theMonth = document.hcomForm.dm.options.selectedIndex + 1;
theDay = document.hcomForm.dd.options.selectedIndex + 1;
dInMonth = dInM(theMonth);
if (theDay > dInMonth)
{
theDay = dInMonth;
document.hcomForm.dd.options.selectedIndex = dInMonth - 1;
}
} 

