var curDate = new Date();
var hEngine = 'http://www.hoteliers.com/wlpEngine.php?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);

 if (! theMonth == 0 && ! 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('hoteliers');
if (el)
{
el.innerHTML = '<iframe name="' + document.hcomForm.hTarget.value + '" src="" width="100%" height="700" frameborder="0">';
}
document.hcomForm.target = document.hcomForm.hTarget.value;
document.hcomForm.action = 'http://www.hoteliers.com/wlpEngine.php?ID=' + document.hcomForm.hotelID.value + '&lang=nl';
document.hcomForm.submit();
}

function checkDDate()
{
 theMonth = document.hcomForm.dm.options.selectedIndex;
 theDay = parseInt(document.hcomForm.dd.options.selectedIndex);
 dInMonth = dInM(theMonth);
 
 if (theDay > dInMonth)
 {
  document.hcomForm.dd.options.selectedIndex = theDay = dInMonth;
 }
}


/********************************************************************/

function dInM2(mon)
	{           
    	if (mon == 2)
        	{
             Year = curDate2.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 getNDay2()
{
theMonth = document.hcomForm2.am.options.selectedIndex;
theDay = parseInt(document.hcomForm2.ad.options.selectedIndex);

 if (! theMonth == 0 && ! theDay == 0)
 {
  dInMonth = dInM2(theMonth);
  
  if (theDay > dInMonth)
  {
	document.hcomForm2.ad.options.selectedIndex = theDay = dInMonth;
  }
  newDay = theDay + 1;
  newMonth = theMonth;
  
  if (newDay > dInMonth)
  {
            newDay = 1;
            newMonth = theMonth + 1;
            if (newMonth > 12)
            {
				newMonth = 1;
            }
  }
document.hcomForm2.dd.selectedIndex = newDay;
document.hcomForm2.dm.selectedIndex = newMonth;
 }
}


function doCheckForm2() {
	form1 = document.hcomForm
	form2 = document.hcomForm2
	for (i=0; i<form2.length; i++) {
		form1[i].value = form2[i].value
	}	
	doCheckForm()
}

function checkDDate2()
{
 theMonth = document.hcomForm2.dm.options.selectedIndex;
 theDay = parseInt(document.hcomForm2.dd.options.selectedIndex);
 dInMonth = dInM(theMonth);
 
 if (theDay > dInMonth)
 {
  document.hcomForm2.dd.options.selectedIndex = theDay = dInMonth;
 }
}

/*********************************/

function opvraagreservering() {
	document.getElementById('datumopvraag').style.display= 'block'
}
