function cboCountries_onchange() {
	var szSelected = window.document.frmCarType.cboCountries.options[window.document.frmCarType.cboCountries.selectedIndex].value;

	window.document.frmCarType.txtCountry.value = window.document.frmCarType.cboCountries.options[window.document.frmCarType.cboCountries.selectedIndex].text;

	if(szSelected!='$$NULL$$')
	{
		if(szSelected=='$$OTHER$$'){
			window.open('http://www.holidayautos.co.uk/aff/issta');
			return;
		}
		//window.document.frmCarType.action = "carhirecriteria.asp";
	}
	
		window.document.frmCarType.action = "cars.asp";
		window.document.frmCarType.submit();
}

function isDate(dtDay,dtMth,dtYr)
{
	var dtDate = new Date(dtDay + " " + dtMth + " " + dtYr);
		if (dtDate.getDate() != dtDay)
			return false;
		else
			return true;
}


function changeSelection(source,target)
{
	target.selectedIndex = source.selectedIndex;
}

function Next(iMin,iMax) {
	var frm = window.document.frmCarType;
	var szError = "";

	var iIndex = -1;
	var szSelected = window.document.frmCarType.cboLocation.options[window.document.frmCarType.cboLocation.selectedIndex].value;
	
	for(i=0;i<aLocations.length;i++)
	{
		if(aLocations[i].code == szSelected)
			iIndex = i;
	}

	if(iIndex==-1)
		szError+= "\n - Please select a Location";

	var dtOut = new Date(frm.dtOutDay.options[frm.dtOutDay.selectedIndex].value + " " + frm.dtOutMth.options[frm.dtOutMth.selectedIndex].value + " " + frm.dtOutYr.options[frm.dtOutYr.selectedIndex].value + " " + frm.cboPickUpTm.options[frm.cboPickUpTm.selectedIndex].value);
	var dtIn = new Date(frm.dtInbDay.options[frm.dtInbDay.selectedIndex].value + " " + frm.dtInbMth.options[frm.dtInbMth.selectedIndex].value + " " + frm.dtInbYr.options[frm.dtInbYr.selectedIndex].value + " " + frm.cboDropTm.options[frm.cboDropTm.selectedIndex].value);
	var dtDateOutVal = isDate(frm.dtOutDay.options[frm.dtOutDay.selectedIndex].value, frm.dtOutMth.options[frm.dtOutMth.selectedIndex].value, frm.dtOutYr.options[frm.dtOutYr.selectedIndex].value);
	var dtDateInVal = isDate(frm.dtInbDay.options[frm.dtInbDay.selectedIndex].value, frm.dtInbMth.options[frm.dtInbMth.selectedIndex].value, frm.dtInbYr.options[frm.dtInbYr.selectedIndex].value);
	var dtNow = new Date();
	
	if (dtDateOutVal==false) 
		szError+="\n - The date of pick up you have selected is invalid, please try again";	
	
	if (dtDateInVal==false) 
		szError+="\n - The date of return you have selected is invalid, please try again";	
	
	if(DaysDelta(dtNow,dtOut)>=0)
		szError+="\n - For booking within 3 days of departure - Please call our reservations call centre";
	if(DaysDelta(dtOut,dtNow)<=2)
		szError+="\n - For booking within 3 days of departure - Please call our reservations call centre";
	if(frm.cboLocation.options[frm.cboLocation.selectedIndex].value == '$$NULL$$')
		szError+="\n - Pick up location must be selected";
	
	if(DaysDelta(dtIn,dtOut)<3)
		szError+="\n - Car Hire Bookings must be at least 3 days duration, for shorter bookings please contact our reservations call center";
	
	if(isNaN(frm.cboAge.value))
		szError+="\n - Age must be a valid number";
	else
	{
		if(frm.cboAge.value < iMin || frm.cboAge.value > iMax)
			szError+="\n - Age must be between " + iMin + " and " + iMax;
	}
	if(szError!="")
	{
		alert("Some of the fields have not been completed correctly, they are as follows:\n" + szError);
		return;
	}

	window.document.frmCarType.txtCity.value = aLocations[iIndex].city;
	window.document.frmCarType.action = "carhireresults.asp";
	window.document.frmCarType.submit();
}

/*
function Next()
{
		window.document.frmCarType.action = "carhirecriteria.asp";
		window.document.frmCarType.submit();
}
*/