<!--

function getbanner(type){
	if(type=='header'){
		document.write('<a href="http://www.airline-network.co.uk/specialoffers/SpecialOffers.aspx?id=66663b61-08e9-4b45-a18b-1009a213638a&partner=freetraffic&adgroup=www.miami-traveller-information.co.uk/468_banner"><img src="images/468banner.jpg" border="0px"></a>');
	}
	if(type=='right'){
		document.write('<a href="http://www.airline-network.co.uk/index.asp?partner=freetraffic&adgroup=www.flight-seeker.co.uk/sky_banner"><img src="http://www.miami-traveller-information.co.uk/images/sky_banner.jpg" border="0px"></a>');
	}
}


	var hotelurl="http://wizard.airline-network.co.uk/anhotels/hotel.asp?";

	function searchHotels(){
		if (ValidateHotel()){
			var me = document.inputform
			var qs="areaName="+me.sAreaName.value;
			var monthyear = me.iCheckInMonthYear.options[me.iCheckInMonthYear.selectedIndex].text.replace(/\s+/g, '');
			qs=qs+"&checkInDate=" + me.iCheckInDay.options[me.iCheckInDay.selectedIndex].value + monthyear;
  		qs=qs+"&numOfNights=" + me.iNoNights.options[me.iNoNights.selectedIndex].value;
  		qs=qs+"&numOfAdult=" + me.iNoAdults.options[me.iNoAdults.selectedIndex].value;
  		qs=qs+"&numOfChildren=" + me.iNoChildren.options[me.iNoChildren.selectedIndex].value;
			winfeatures="height=600px,width=800px,toolbar=1,titlebar=1,status=1,menubar=1,scrollbars=1,resizable=1,location=1,menubar=1";
  		winHotel=window.open(hotelurl+qs,"",winfeatures);
  		winHotel.focus;
		}
		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;}
		
}

function ValidateHotel(){
  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;}
  return true;
}

var month_name = new Array ("Jan ","Feb ","Mar ","Apr ","May ","Jun ","Jul ","Aug ","Sep ","Oct ","Nov ","Dec ");

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()-1;

	if (parseInt(iDay.getDate()) < parseInt(nowDate.getDate()))
	{
		chf.pickupMonthYear.selectedIndex = chf.pickupMonthYear.selectedIndex + 1;
	}
	chf.dropoffMonthYear.selectedIndex = chf.pickupMonthYear.selectedIndex;
}

function SetDatesFlights() {

//Set the Months
	var objDD1 = document.getElementById("iOutboundMonthYear");
	var objDD2 = document.getElementById("iReturnMonthYear");
	var nowDate = new Date();
	var iMonth = nowDate.getMonth();
	var iYear = nowDate.getFullYear();

	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);
		objDD1.options[objDD1.options.length] = newOpt;
		var	newOpt = new Option(sMonthYear, sMonth,false,false);
		objDD2.options[objDD2.options.length] = newOpt;
	}
//Set the days for Flights
	var iDay = nowDate.getDate();
	iDay = addDays(nowDate,7);
	document.inputform.iOutboundDay.selectedIndex = iDay.getDate()-1;
//If the day is less than today then we've moved on to the next month for departures.		

if (parseInt(document.inputform.iOutboundDay.value) < parseInt(nowDate.getDate())){
	document.inputform.iOutboundMonthYear.selectedIndex = 1;}
//A three day stay is usually mandatory.
	var iTemp = parseInt(document.inputform.iOutboundDay.value) + 3
	if (iTemp > iDaysThisMonth - 1) {
		document.inputform.iReturnDay.selectedIndex = iTemp - iDaysThisMonth -1;}
	else {
		document.inputform.iReturnDay.selectedIndex = iTemp - 1;
	}
//If the day is less than today then we've moved on to the next month for returns.	
	if (parseInt(document.inputform.iReturnDay.value) < parseInt(nowDate.getDate())){
	document.inputform.iReturnMonthYear.selectedIndex = 1;}

}

function ValidateFlights(){
if (document.inputform.sDestinationCode.value == "") 
	{alert("Please enter a destination");
	document.inputform.sDestinationCode.focus();
	return false;}
}

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);
}

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;
  	}
}
-->
