


<!--
// *** Your Referrer ID here
var strReferrerId = "5THTLCH";

// *** language of your choice here .. 
// *** pls refer to readMe.txt.
// *** Default value is 1, which is English.
var intLangID = 1;

var default_pickUp = new Date();
default_pickUp.setDate(default_pickUp.getDate() + 4);
var default_dropOff = new Date(default_pickUp);
default_dropOff.setDate(default_dropOff.getDate() + 7);

var aryMonthNames = ["January","February","March","April","May","June", "July", "August", "September", "October", "November", "December"];

function icauto_submit()
{
		if (icauto_validForm())
		{
			the_url = "http://www.carquoteinternational.com/miniQuote.asp?";
			the_url = the_url + "Referrer=";
			the_url = the_url + strReferrerId;
			the_url = the_url + "&LangID=" + intLangID;
			the_url = the_url + "&ColDay=";
			the_url = the_url + document.rental_car.cboPickUpDay.value;
			the_url = the_url + "&ColMonth=";
			the_url = the_url + document.rental_car.cboPickUpMonth.value;
			the_url = the_url + "&ColYear=";
			the_url = the_url + document.rental_car.cboPickUpYear.value;
			the_url = the_url + "&RtnDay=";
			the_url = the_url + document.rental_car.cboDropOffDay.value;
			the_url = the_url + "&RtnMonth=";
			the_url = the_url + document.rental_car.cboDropOffMonth.value;
			the_url = the_url + "&RtnYear=";
			the_url = the_url + document.rental_car.cboDropOffYear.value;
			the_url = the_url + "&Location=";
			the_url = the_url + document.rental_car.txtLocation.value;
			the_url = the_url + "&Cat=";
			the_url = the_url + document.rental_car.cboVehCat.value;
			the_url = the_url + "&RtnTime=";
			the_url = the_url + document.rental_car.cboDropOffTime.value;
			the_url = the_url + "&ColTime=";					
			the_url = the_url + document.rental_car.cboPickupTime.value;			
			the_url = the_url + "&Express=0";
			
			window.location = the_url;
		}
}

function icauto_validForm()
{
		var dToday = new Date();
		var dayConst = 24 * 60 * 60 * 1000;
		
		var pYY	= parseInt(document.rental_car.cboPickUpYear.value); 
		var pMM = parseInt(document.rental_car.cboPickUpMonth.value);
		var pDD = parseInt(document.rental_car.cboPickUpDay.value);
			
		var dYY = parseInt(document.rental_car.cboDropOffYear.value);
		var dMM = parseInt(document.rental_car.cboDropOffMonth.value);
		var dDD = parseInt(document.rental_car.cboDropOffDay.value);
			
		var fromDate = new Date(pYY, pMM, pDD);
		var toDate = new Date(dYY, dMM, dDD);

		// valid collection date?
		if (fromDate.getMonth() != pMM) {
			alert('Invalid Pick-up Date');
			return false;
		} // end if
			
		// valid return date?
		if (toDate.getMonth() != dMM) {
			alert('Invalid Drop-off Date');
			return false;
		} // end if

		// is to date earlier than end date?
		if (fromDate > toDate)
		{
			alert("Sorry, you can't drop off your car before picking it up!");
			return false;
		}
		// is col/rtn date before today's date (hour added to dates to allow for latency)?
		else if (fromDate < dToday)
		{
			alert("Sorry, the booking dates you entered are in the past!");
			return false;
		}
		// are dates the same?
		else if (fromDate.getDate() == toDate.getDate() &&
					fromDate.getMonth() == toDate.getMonth() &&
					fromDate.getYear() == toDate.getYear())
		{
			alert('Collection and Return dates cannot be the same!');
			return false;
		}
		// is car hire > 60 days?
		else if (((toDate - fromDate) / dayConst) > 60)
		{
			alert('Sorry, maximum car hire is 60 days!');
			return false;
		}
		// is location text blank?
		else if (document.rental_car.txtLocation.value=="")
		{
			alert("Please choose a location!");
			document.rental_car.txtLocation.focus();
			return false;
		}
		// all is well?
		else
		{
			document.rental_car.strFromDate.value=fromDate.toString();
			document.rental_car.strToDate.value=toDate.toString();
			return true;
		}
} // end function...

//-->



