<!-- 
<!-- BANNERS -->
function banner486(){
}
function pop(){
}

var flightsURL="http://clk.atdmt.com/BRM/go/112310981/direct/01/";
var carsURL="http://clk.atdmt.com/BRM/go/112310980/direct/01/";
var hotelsURL="http://clk.atdmt.com/BRM/go/112310982/direct/01/";

<!-- Flight Search -->
function ValidateFlights(){
	if (document.inputform.sDestinationCode.value == ""){
		alert("Please enter a destination");
		document.inputform.sDestinationCode.focus();
		return false;
	}else{
		window.location=flightsURL;
		return false;		
	}
}

function SetDatesFlights() {
  	var objDD1 = document.getElementById("iOutboundMonthYear");
		BuildMonthYear(objDD1);
  	var objDD2 = document.getElementById("iReturnMonthYear");
		BuildMonthYear(objDD2);
		
		var outDay = document.getElementById("iOutboundDay")
		var retDay =  document.getElementById("iReturnDay")
		
		var nowDate = new Date();
		var iMonth = nowDate.getMonth();
	 	var iYear = nowDate.getFullYear();
		var iDaysThisMonth = 32 - new Date(iYear, iMonth, 32).getDate();

  	//Set the days for Flights
  	var iDay = addDays(nowDate,7);

  	outDay.selectedIndex = iDay.getDate()-1;
	  //If the day is less than today then we've moved on to the next month for departures.		 
  	if (parseInt(outDay.value) < parseInt(nowDate.getDate())){
  		objDD1.selectedIndex = 1;}
	  //A three day stay is usually mandatory.
  	var iTemp = parseInt(outDay.value) + 3
  	if (iTemp > iDaysThisMonth) {
  		retDay.selectedIndex = iTemp - iDaysThisMonth -1;}
  	else {
  		retDay.selectedIndex = iTemp - 1;
  	}
  	//If the day is less than today then we've moved on to the next month for returns.	
  	if (parseInt(retDay.value) < parseInt(nowDate.getDate())){
  		objDD2.selectedIndex = 1;}
}


<!-- Carhire Search -->
function ValidateCars(theForm){
	if (theForm.pickup.value == "") 
		{alert("Please enter a pick-up city.");
		theForm.pickup.focus();
		return false;}
	
	if (theForm.dropoff.value == "") 
		{alert("Please enter a drop-off city.");
		theForm.dropoff.focus();
		return false;}
	
	//Ensure the pick-up day isn't in the past
	if (!DateInThePast(theForm.pDay.selectedIndex +1,theForm.pickupMonthYear.value,0))
		{alert("Pick-up date cannot be in the past.");
		theForm.pickupMonthYear.focus();
		return false;}
	
	//We can't hire out cars at less than 7 days notice.
	if (!DateInThePast(theForm.pDay.selectedIndex +1,theForm.pickupMonthYear.value,7))
		{alert("We must have at least 7 days notice before pick-up date.");
		theForm.pickupMonthYear.focus();
		return false;}
	
	//Ensure the drop-off day is after the pick-up day.
		var pickupdate = new Date(theForm.pickupMonthYear.options[theForm.pickupMonthYear.selectedIndex].value.substr(2,4),theForm.pickupMonthYear.options[theForm.pickupMonthYear.selectedIndex].value.substr(0,2)-1,theForm.pDay.options[theForm.pDay.selectedIndex].value);
		var dropoffdate = new Date(theForm.dropoffMonthYear.options[theForm.dropoffMonthYear.selectedIndex].value.substr(2,4),theForm.dropoffMonthYear.options[theForm.dropoffMonthYear.selectedIndex].value.substr(0,2)-1,theForm.dDay.options[theForm.dDay.selectedIndex].value);
	if (pickupdate >= dropoffdate)
		{alert("Drop-off day must be later than the Pick-up date.");
		theForm.pickupMonthYear.focus();
		return false;}
	
	//Ensure the drop-off day is after the pick-up day.
		var pickupdate = new Date(theForm.pickupMonthYear.options[theForm.pickupMonthYear.selectedIndex].value.substr(2,4),theForm.pickupMonthYear.options[theForm.pickupMonthYear.selectedIndex].value.substr(0,2)-1,theForm.pDay.options[theForm.pDay.selectedIndex].value);
		var dropoffdate = new Date(theForm.dropoffMonthYear.options[theForm.dropoffMonthYear.selectedIndex].value.substr(2,4),theForm.dropoffMonthYear.options[theForm.dropoffMonthYear.selectedIndex].value.substr(0,2)-1,theForm.dDay.options[theForm.dDay.selectedIndex].value);
	if (pickupdate >= dropoffdate)
		{alert("Drop-off day must be later than the Pick-up date.");
		theForm.pickupMonthYear.focus();
		return false;}
		
	window.location=carsURL;
	return false;
}

function SetDatesCars(){
	var objDD1 = document.getElementById("pickupMonthYear");	
	BuildMonthYear(objDD1);
	var objDD2 = document.getElementById("dropoffMonthYear");
	BuildMonthYear(objDD2);

	//Set the days for Cars
	//We can't hire out cars at less than 7 days notice.
	var nowDate = new Date();
 	var iDay = addDays(nowDate,7);

	var chf = document.inputform
	chf.pDay.selectedIndex = iDay.getDate()-1;
	chf.dDay.selectedIndex = iDay.getDate();

	if (parseInt(iDay.getDate()) < parseInt(nowDate.getDate()))
	{
		chf.pickupMonthYear.selectedIndex = chf.pickupMonthYear.selectedIndex + 1;
	}
	chf.dropoffMonthYear.selectedIndex = chf.pickupMonthYear.selectedIndex;
}


<!-- Hotel Search -->

function ValidateHotels(){
  if (document.inputform.sAreaName.value == "") 
  	{alert("Please enter a Destination");
  	document.inputform.sAreaName.focus();
  	return false;}
  if (!DateInThePast(document.inputform.iCheckInDay.value,document.inputform.iCheckInMonthYear.value,0))
  	{alert("Arrival date cannot be in the past!");
  	document.inputform.iCheckInDay.focus();
  	return false;}

	window.location=hotelsURL;
	return false;
}

function SetDatesHotels(){
  	var objDD1 = document.getElementById("iCheckInMonthYear");
		BuildMonthYear(objDD1);

		//Set date to 7 days
		var nowDate = new Date();
 		var iDay = addDays(nowDate,7);

  	var chf = document.inputform
  	chf.iCheckInDay.selectedIndex = iDay.getDate()-1;
  
  	if (parseInt(iDay.getDate()) < parseInt(nowDate.getDate())){
			chf.iCheckInMonthYear.selectedIndex = chf.iCheckInMonthYear.selectedIndex + 1;}
}

<!-- Generic Function -->

function BuildMonthYear(oMY) {
  //Set the Months
		
  	var nowDate = new Date();
  	var iMonth = nowDate.getMonth();
  	var iYear = nowDate.getFullYear();
  	var month_name = new Array ("Jan ","Feb ","Mar ","Apr ","May ","Jun ","Jul ","Aug ","Sep ","Oct ","Nov ","Dec ");
  	var sMonth, sMonthYear
  	var iDaysThisMonth = 32 - new Date(iYear, iMonth, 32).getDate();
  	for(i=0;i<12;i++)
  	{
  		iMonth = parseInt(iMonth + 1);
  		if (iMonth > 12)
  			{iYear = parseInt(iYear +1); iMonth = 1;}
  		sMonth = String(iMonth) + String(iYear)
  		if (sMonth.length < 6)
  			{sMonth = "0" + sMonth;}
  		sMonthYear = month_name[iMonth-1] + " " + iYear		
  
  		var newOpt = new Option(sMonthYear, sMonth,false,false);
  		oMY.options[oMY.options.length] = newOpt;
  	}
}

function DateInThePast(dd,mmyy,days){
  var x = new Date();
  var y = new String(mmyy);
  x.setDate(dd); x.setMonth(y.slice(0,2)-1); x.setFullYear(y.slice(2,6));
  var nowDate = new Date();
  strDate = new Date(addDays(nowDate,days));
  
  if (x < strDate)
  	return false;
  else
  	return true;
}

function addDays(myDate,days) {
    return new Date(myDate.getTime() + days*24*60*60*1000);
}

function yesterday(){
	var now = new Date();	
	var Yesterday = new Date(now - (86400000*1));//subtract a day's n half worth of ms
	var curr_date = Yesterday.getDate();
	var curr_month = Yesterday.getMonth();
	var curr_year = Yesterday.getFullYear();
	return (curr_date + " " + month_name[curr_month]+ " " + curr_year);
}
-->