
function doRequest(Type) {

	url = "/optielijst.php?c="+Type+"&t=bestemming";
	var HTMLId = "bestemming";
	doAjaxRequest(url, HTMLId);

	url = "/optielijst.php?c="+Type+"&t=soort";
	var HTMLId = "soort";
	doAjaxRequest(url, HTMLId);

	url = "/optielijst.php?c="+Type+"&t=reisduur";
	var HTMLId = "reisduur";
	doAjaxRequest(url, HTMLId);

}

function doLijst(t) {

	var Type = document.getElementById("Reis").value;
	var Value = document.getElementById("bestemming").value;
	url = "/optielijst.php?c="+Type+"&t="+t+"&o1="+Value;
	if(t == "reisduur") url += "&o2="+document.getElementById("soort").value;

	doAjaxRequest(url, t)	

}

function doAjaxRequest(url, HTMLId) {

	var http_request = makeHttpRequest();
	http_request.onreadystatechange = function() { 
	   if (http_request.readyState == 4) { 
		   if (http_request.status == 200) { 
			   document.getElementById(HTMLId).innerHTML = http_request.responseText;
		   } else { 
			   alert('There was a problem with the request.(Code: ' + http_request.status + ')'); 
		   } 
	   } 
	}
	http_request.open('GET', url, true);
	http_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	http_request.send(null);

}
