var curDate = new Date();
var hEngine = 'http://www.hoteliers.com/wlpEngine.php?ID='; 


function hasClass(ele,cls) {
	return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
}


function addClass(ele,cls) {
	if (!this.hasClass(ele,cls)) ele.className += " "+cls;
}

function removeClass(ele,cls) {
	if (hasClass(ele,cls)) {
		var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
	ele.className=ele.className.replace(reg,' ');
	}
}

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()
{
nu = new Date();
 volgende_dag(Math.abs($('#ad').val()),(Math.abs($('#am').val())), nu.getFullYear());
 console.log(Math.abs($('#ad').val())+'-'+(Math.abs($('#am').val())-1)+'-'+nu.getFullYear());
}


function doCheckForm()
{

el = document.getElementById('hoteliers');
if (el)
{
el.innerHTML = '<iframe name="' + document.hcomForm.hTarget.value + '" src="" width="100%" height="2000" 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;
 }
}
