<!-- // (C) 2006 by hoteliers.com // 
var curDate = new Date();
var hEngineC = 'http://www.hoteliers.com/cwlpEngine.php?ID=';  // coorparate
var hEngine = 'http://www.hoteliers.com/wlpEngine.php?ID=';     // default

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);
theMonth = document.hcomForm.am.value;
theDay = parseInt(document.hcomForm.ad.value);
if (! theMonth == 0 && ! theDay == 0)
{
dInMonth = dInM(theMonth);
if (theDay > dInMonth)
{
// document.hcomForm.ad.options.selectedIndex = theDay = dInMonth;
document.hcomForm.ad.value = theDay = dInMonth;
}
newDay = theDay + 1;
newMonth = theMonth;
if (newDay > dInMonth)
{
newDay = 1;
newMonth = theMonth + 1;
if (newMonth > 12)
{
newMonth = 1;
}
}

}
}


function doCheckForm()
{

	document.location.href = "http://www.securereservations.eu/hotels_search/search_hotels.asp?hotelid=678&taal=nl&vvv=&booktemplate=1";


	el = document.getElementById('hotdiv');
	if (el)
	{
		el.innerHTML = '<iframe name="' + document.hcomForm.hTarget.value + '" src="" width="740" height="300" frameborder="0">';
	}
	
	// aanpassen
	var date= document.hcomForm.datepicker.value;
	// alert(date);
	// 19/09/2009
	document.hcomForm.am.value = am = date.split("/")[1];
	document.hcomForm.ad.value = ad = date.split("/")[0];

	// am = document.hcomForm.am.options.selectedIndex; 
	// ad = document.hcomForm.ad.options.selectedIndex; 
	// am = document.hcomForm.am.value;
	//alert(am);
	theMonth = am;
	theDay = parseInt(ad);

	document.hcomForm.target = document.hcomForm.hTarget.value;
// alert("target: " + document.hcomForm.target);
 //alert("hEngine:" + hEngine);

	// lang=en lang=nl
	// promocode
	// hkey 

// <input name="hckey" type="hidden" id="hckey" value="6d745c2df1c2a0b2ae4bbdc20b0bce89"> // 350ba5fe85a244b147b2a3f82f6248c2 corp
// <input name="mAction" type="hidden" id="mAction" value="check">  //doublecheck for corp
	
	//
	var pass = document.hcomForm.passwd.value;

	// default engine
	document.hcomForm.action = hEngine + document.hcomForm.hotelID.value;
	document.hcomForm.hckey.value = "6d745c2df1c2a0b2ae4bbdc20b0bce89";
	document.hcomForm.mAction.value = "check";

	if(pass.length>0)
 	{
        	// use corp
		document.hcomForm.action = hEngineC + document.hcomForm.hotelID.value;
		document.hcomForm.hckey.value = "350ba5fe85a244b147b2a3f82f6248c2";
		document.hcomForm.mAction.value = "login";
		document.hcomForm.mAction.value = "doublecheck";
	}				
	
	// document.hcomForm.action = hEngine + document.hcomForm.hotelID.value;
	// am = 8;
	// ad = 4;
	document.hcomForm.action = document.hcomForm.action + "&am=" + am;
	document.hcomForm.action = document.hcomForm.action + "&ad=" + ad;

	// set language 
	// http://www.hoteliers.com/cwlpEngine.php?ID=576&am=8&ad=4&lang=nl
	var lang = document.hcomForm.lang.value;
	document.hcomForm.action = document.hcomForm.action + "&lang=" + lang;

//		alert("mAction: " + document.hcomForm.mAction.value);
//	alert("hckey: " + document.hcomForm.hckey.value);

	// alert("action: " + document.hcomForm.action);
	document.hcomForm.submit(); 
}
