function voorloopnul (getal) {
     if (getal < 10) return ('0' + getal);
     return getal;
     }


//ajax aanvraag
var xmlhttp, alerted
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
  try {
  xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")
 } catch (e) {
  try {
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
  } catch (e) {
   alert("Je browser moet Microsofts XML parsers beschikbaar hebben")
  }
 }
@else
 alert("Je browser moet minstens JScript 5 ondersteunen.")
 xmlhttp=false
 alerted=true
@end @*/
if (!xmlhttp && !alerted)
	{
	try
		{
		xmlhttp = new XMLHttpRequest();
		}
	catch (e)
		{
		alert("Je hebt een browser nodig die het XMLHttpRequest object ondersteunt.")
		}
	}

function goajax(arg)
	{
			document.getElementById('verleden').style.display = 'none';
			var datum = new Date();
			var vandaag = parseFloat(datum.getYear() + '' + voorloopnul((datum.getMonth()+1)) + '' + voorloopnul(datum.getDate()));

			var jaarmaand = document.rooms.checkin_year_month.value;
			var mySplitResult = jaarmaand.split("-");
			
			
			var kiesdat = parseFloat(mySplitResult[0] + '' + '' + voorloopnul(mySplitResult[1]) + '' + voorloopnul(document.rooms.checkin_monthday.value));	
			if ( vandaag > kiesdat)
			{
			document.getElementById('verleden').style.display = 'block';	
			return;
			}	
		
	document.getElementById('wait').style.display = 'block';	
		if (arg == 2) {
			document.getElementById('wait').style.display = 'none';
			document.getElementById('showrooms').style.display = 'none';
			document.getElementById('beschikbaar').style.display = 'block';
		}
		else {
		
	document.getElementById('beschikbaar').style.display = 'none';	
	aanvraag = "taal=" + document.rooms.taal.value + "&checkin_monthday=" + document.rooms.checkin_monthday.value + "&checkin_year_month=" + document.rooms.checkin_year_month.value + "&interval=" + document.rooms.interval.value + "&hotel_id=" + document.rooms.hotelid.value + "&currencycode=" + document.rooms.currencycode.value + "&latitude=" + document.rooms.latitude.value + "&longitude=" + document.rooms.longitude.value; 
	url = 'http://www.hotel-traveling.com/roomfeed.php';	
	//alert(aanvraag)
	
if (xmlhttp)
		{
		xmlhttp.open("POST", url, true);
		xmlhttp.onreadystatechange = RSchange
		xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlhttp.setRequestHeader('Connection', 'close');
		xmlhttp.setRequestHeader('Cache-Control', 'no-cache');
		xmlhttp.send(aanvraag);
		}
}

function RSchange()
	{
	if (xmlhttp.readyState == 4)
		{
			document.getElementById('wait').style.display = 'none';
			//alert(xmlhttp.responseText);
			document.getElementById('room').innerHTML = xmlhttp.responseText;
		}
	}
	}