// JavaScript Document
//Browser Support Code
function ajaxCityFunction(prefix, val){
	var ajaxRequest;  // The variable that makes Ajax possible!
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	}
	catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e){
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e){
				// Something went wrong
				alert("This function requires the use of Javascript. Please enable Javascript from the Tools menu of your web browser. We apologize for any inconvenience.");
				return false;
			}
		}
	}

	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4  && ajaxRequest.status == 200){
			document.getElementById('searchboxcars').innerHTML = ajaxRequest.responseText;
		}

		if(ajaxRequest.readyState!=4){
			document.getElementById("searchboxcars").innerHTML= '<img style="position:relative; top:110px; left:180px;" alt="loading information" title="loading information" src="http://obelisk/webroot/mike-car-hire/images/rotation.gif" /><font style="position:relative; top:130px; left:100px; color:#666666; font-family: Arial, Verdana, Lucidia Grande; font-size: 11px;">Loading cities...please wait.</font>';
		}
	}
	var cid = document.getElementById('country_cars').value;
	
  var pday = document.getElementById('pickupday').value
  var pmonth = document.getElementById('pickupmonth').value
  var pyear = document.getElementById('pickupyear').value
  
  var dday = document.getElementById('dropoffday').value
  var dmonth = document.getElementById('dropoffmonth').value
  var dyear = document.getElementById('dropoffyear').value

	var queryString = "?country_cars=" + cid + "&pday=" + pday + "&pmonth=" + pmonth + "&pyear=" + pyear + "&dday=" + dday + "&dmonth=" + dmonth + "&dyear=" + dyear + "&rannum=" + Math.random();
	ajaxRequest.open("GET", prefix + "ucch.org/includes/searchbox-cars.php" + queryString, true);
	ajaxRequest.send(null);
}// JavaScript Document

