function validateCarsHire()
{
    //alert("Ciao!");
	//return;
	var obj, e = false;
	
	/* Check that the dates are valid */
	
	var now, today, fromDate, toDate;
	
	now = new Date();
	
	/* Construct a string for today's date */
	
	today = String(now.getFullYear());
	
	if(now.getMonth()<10)
		today += "0" + String(now.getMonth()+1);
	else
		today += String(now.getMonth()+1);
		
	if(now.getDate()<10)
		today += "0" + String(now.getDate());
	else
		today += String(now.getDate());
		
	/* Construct a string for the collection date */
		
	obj = document.getElementById('CollectYear');	
	fromDate = String(obj.options[obj.selectedIndex].value);
	
	if(document.getElementById('CollectMonth').value<10)
		fromDate += "0" + String(document.getElementById('CollectMonth').value);
	else
		fromDate += String(document.getElementById('CollectMonth').value);
	
	if(document.getElementById('CollectDay').value<10)
		fromDate += "0" + String(document.getElementById('CollectDay').value);
	else
		fromDate += String(document.getElementById('CollectDay').value);
		
	/* Construct a string for the return date */
		
	obj = document.getElementById('ReturnYear');	
	toDate = String(obj.options[obj.selectedIndex].value);
	
	if(document.getElementById('ReturnMonth').value<10)
		toDate += "0" + String(document.getElementById('ReturnMonth').value);
	else
		toDate += String(document.getElementById('ReturnMonth').value);
	
	if(document.getElementById('ReturnDay').value<10)
		toDate += "0" + String(document.getElementById('ReturnDay').value);
	else
		toDate += String(document.getElementById('ReturnDay').value);
		
	/* Make sure the collection date isn't later than the return date */
	
	if(parseInt(toDate) <= parseInt(fromDate))
	{
		obj = document.getElementById('CollectDay');
		obj.focus();
		e = "The return date must be later than the collection date.";
	}
	
	/* Make sure the collection date is not in the past */
	
	if(parseInt(fromDate) <= parseInt(today))
	{
		obj = document.getElementById('CollectDay');
		obj.focus();
		e = "Please select bookings for future days only.";
	}
	
	/* Check that the collection day suits the month */
	
	var nYear, nMonth, nDay, maxDay;
	
	nYear = parseInt(fromDate.substr(0,4));
	nMonth = parseInt(fromDate.substr(4,2));
	nDay = parseInt(fromDate.substr(6,2));
	
	/* check for leap years */
	if((nYear % 4 == 0) && ((nYear % 100 != 0) || (nYear % 400 == 0)))
	{
		maxDay = new Array(31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
	}
	else
	{
		maxDay = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
	}
	
	if (nDay > maxDay[nMonth-1])
	{
		document.getElementById('CollectDay').focus();
		e = "The collection date has an invalid day for the month."
	}
	
	/* Check that the return day suits the month */
	
	nYear = parseInt(toDate.substr(0,4));
	nMonth = parseInt(toDate.substr(4,2));
	nDay = parseInt(toDate.substr(6,2));
	
	/* check for leap years */
	if((nYear % 4 == 0) && ((nYear % 100 != 0) || (nYear % 400 == 0)))
	{
		maxDay = new Array(31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
	}
	else
	{
		maxDay = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
	}
	
	if (nDay > maxDay[nMonth-1])
	{
		document.getElementById('ReturnDay').focus();
		e = "The return date has an invalid day for the month."
	}

	/* Check the age of the driver */
	
	obj = document.getElementById('Age');
	
	if(!obj.value)
	{
		obj.focus();
		e = "Please enter the driver's age.";
	}
	else
	{
		if(!((obj.value>17) && (obj.value<80)))
		{
			obj.focus();
			e = "Driver's age must be between 17 and 80 years";
		}
	}
	
	/* Check they have selected a collection depot */
	
	obj = document.getElementById('CollectDepot');
	
	if(obj.selectedIndex==0)
	{
		obj.focus();
		e = "Please select the depot you will be hiring from.";
	}
	
	/* Check they have selected a location */
	obj = document.getElementById('LocationCar');
	
	if(obj.selectedIndex==0)
	{
		obj.focus();
		e = "Please select the location you will be hiring in.";
	}
	/* If there was an error then display error message */
	if(e)
	{
		alert(e);
		//return false;
	}
	else
	{
	    document.forms['carsHireForm'].submit();
		//return true;
	}

}


