function toggleDisplay(tg) {

	switch(tg) {
	case 'flights':
		document.getElementById('OpodoQuickSearch').style.backgroundImage = 'url(http://promos.opodo.co.uk/travel/skins/default/images/bg_flightsMultiple300x250.jpg)';
		document.getElementById('OpodoQuickFlightSearch').style.display = 'block';
		document.getElementById('OpodoQuickDPSearch').style.display = 'none'
		document.getElementById('OpodoQuickHotelSearch').style.display = 'none';
		document.getElementById('OpodoQuickCarSearch').style.display = 'none';
		break
	case 'DP':
		document.getElementById('OpodoQuickSearch').style.backgroundImage = 'url(http://promos.opodo.co.uk/travel/skins/default/images/bg_DP.jpg)';
		document.getElementById('OpodoQuickFlightSearch').style.display = 'none';
		document.getElementById('OpodoQuickDPSearch').style.display = 'block'
		document.getElementById('OpodoQuickHotelSearch').style.display = 'none';
		document.getElementById('OpodoQuickCarSearch').style.display = 'none';
		break
	case 'hotel':
		document.getElementById('OpodoQuickSearch').style.backgroundImage = 'url(http://promos.opodo.co.uk/travel/skins/default/images/bg_hotelsMultiple300x250.jpg)';
		document.getElementById('OpodoQuickFlightSearch').style.display = 'none';
		document.getElementById('OpodoQuickDPSearch').style.display = 'none'
		document.getElementById('OpodoQuickHotelSearch').style.display = 'block';
		document.getElementById('OpodoQuickCarSearch').style.display = 'none';
		break    
	case 'cars':
		document.getElementById('OpodoQuickSearch').style.backgroundImage = 'url(http://promos.opodo.co.uk/travel/skins/default/images/bg_carsMultiple300x250.jpg)';
		document.getElementById('OpodoQuickFlightSearch').style.display = 'none';
		document.getElementById('OpodoQuickDPSearch').style.display = 'none'
		document.getElementById('OpodoQuickHotelSearch').style.display = 'none';
		document.getElementById('OpodoQuickCarSearch').style.display = 'block';
		break
	}
}


var monthDays=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
var months = new Array(new month(0,"Gen"), new month(1,"Feb"),new month(2,"Mar"),new month(3,"Apr"),new month(4,"Mag"), new month(5,"Giu"), new month(6,"Lug"), new month(7,"Ago"), new month(8,"Set"), new month(9,"Ott"), new month(10,"Nov"), new month(11,"Dic"));

function month(i,name) {
rightnow = new Date();
	var thisyear = rightnow.getFullYear();
	var nextyear = thisyear + 1;
	var a = "<option value=\"";
	(i<rightnow.getMonth()) ? a +=nextyear : a +=thisyear;
	(i<9) ? a += "0"+(i+1) : a +=(i+1);
	a += "\">"+name+" 0";
	(i<rightnow.getMonth()) ? a +=(nextyear-2000) : a +=(thisyear-2000);
	a += "</option>\n";
	this.option = a;
}
																		
function validReturnDate(formName, elementArray) {
		firstDay = eval('document.' + formName + '.' + elementArray[0] + ".options[" + 'document.' + formName + '.' + elementArray[0] + '.selectedIndex].value');
		firstMonth = eval('document.' + formName + '.' + elementArray[1] + ".options[" + 'document.'	+ formName + '.' + elementArray[1] + '.selectedIndex].value');
		firstYear = firstMonth.substr(0,4);
		secondDay = eval('document.' + formName + '.' + elementArray[2] + ".options[" + 'document.'	+ formName + '.' + elementArray[2] + '.selectedIndex].value');
		secondMonth = eval('document.' + formName + '.' + elementArray[3] + ".options[" + 'document.'	+ formName + '.' + elementArray[3] + '.selectedIndex].value');
		secondYear = secondMonth.substr(0,4);
		if ((validMonthDay(firstDay, firstMonth, firstYear))&& (validMonthDay(secondDay, secondMonth, secondYear))){
			outboundDate = createDate(firstDay, firstMonth);
			returnDate = createDate(secondDay, secondMonth);
			return ((outboundDate.valueOf() <= returnDate.valueOf()) && (outboundDate.valueOf() > rightnow.valueOf()) ) ? true : false;
		} else {
			return false;
		}	
}

function isLeapYear(year) {
	return (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0));
}

function validMonthDay(dayVal, monthVal, yearVal){
	var error = 0;
	if ((monthVal.substr(4,2) == 4)||(monthVal.substr(4,2) == 6)||(monthVal.substr(4,2) == 9)||(monthVal.substr(4,2) == 11)){
		if (dayVal>30) error = 1;
	} else if (monthVal.substr(4,2) == 2) {
		if (isLeapYear(yearVal)){ 
			if (dayVal>29) error = 1;
		} else {
			if (dayVal>28) error = 1;
		}
	} else {
		if (dayVal>31) error = 1;
	}
	return (error == 1) ? false : true;	
}

function createDate(day, monthYear) {
	dayVal = day;
	monthYearVal = monthYear;
	x = dayVal.substr(0,1);
	(x == "0") ? day = parseInt(dayVal.substr(1,1)) : day = parseInt(dayVal.substr(0,2));
	
	y = monthYearVal.substr(4,1);
	(y == "0") ? month = parseInt(monthYearVal.substr(5,1)) : month = parseInt(monthYearVal.substr(4,2));
	
	year = parseInt(monthYearVal.substr(0,4));
	if (year < 1900) year = year + 1900;
	newDate = new Date(year, month-1, day);
	return newDate;
}

var monthLengths = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];

function isLeapYear(year) {
	return ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0);
}

var rightnow = new Date();

function isNull(val){return(val==null);}

function changeDate(objMonth, objDate, adoptMonth, adoptDate, difference) {
	maxDays = monthLengths[(rightnow.getMonth() + objMonth.selectedIndex) % 12];
	if ( (objMonth.selectedIndex == 1) && (isLeapYear(objMonth.value.substring(0, 4))) ) maxDays="29";

	var oldSelect = objDate.selectedIndex;
	if (oldSelect > maxDays-1) oldSelect = maxDays-1;
	
	objDate.length = 0;
	for (d=0;d<maxDays;d++) 
	{
	    objDate[d] = new Option((d+1),(((d+1)<10)?"0"+(d+1):d+1));
	}

	objDate.selectedIndex = oldSelect;

	if (difference > 0 || difference == undefined)
	{
	    var priMonth = objMonth;
	    var priDate = objDate;
	    var secMonth = adoptMonth;
	    var secDate = adoptDate;
	}
	else
	{
	    var secMonth = objMonth;
	    var secDate = objDate;
	    var priMonth = adoptMonth;
	    var priDate = adoptDate;
	}
		
	if (secMonth != undefined)
	{
	    if (priMonth.value > secMonth.value)
	    {
		secMonth.selectedIndex = priMonth.selectedIndex;
	    }
	    if (priMonth.value == secMonth.value && priDate.value > secDate.value)
	    {
	        secDate.selectedIndex = priDate.selectedIndex;		
	    }
	}	

}


// flights /////////////////////////////////////////////////////////////////////////////////////////
function flightSearchSubmit(buttonValue){

		if (submitform == false) return false;
		
		
//		document.flightSearch.whereTo.value = buttonValue;
//		document.flightSearch.BE_QUICK_SEARCH_FLAG.value = true;
		
		var datesArray= new Array('departureDay', 'departureMonth', 'returnDay', 'returnMonth');
		var formName = 'flightSearch';
		firstDay = eval('document.' + formName + '.' + datesArray[0] + ".options[" + 'document.' + formName + '.' + datesArray[0] + '.selectedIndex].value');
		firstMonth = eval('document.' + formName + '.' + datesArray[1] + ".options[" + 'document.' + formName + '.' + datesArray[1] + '.selectedIndex].value');
		firstYear=firstMonth.substr(0,4);
		secondDay = eval('document.' + formName + '.' + datesArray[2] + ".options[" + 'document.' + formName + '.' + datesArray[2] + '.selectedIndex].value');
		secondMonth = eval('document.' + formName + '.' + datesArray[3] + ".options[" + 'document.'	+ formName + '.' + datesArray[3] + '.selectedIndex].value');
		secondYear=secondMonth.substr(0,4);
		
		if((document.flightSearch.departureAirport.value.length > 0 && document.flightSearch.arrivalAirport.value.length > 0)) {
			if(!validMonthDay(firstDay, firstMonth, firstYear)) {

				alert("Please enter a valid departure date");
				return false;
			} else { 
				if(!validMonthDay(secondDay, secondMonth, secondYear)){
					alert("Please enter valid return and departure dates");
					return false;
				} else { 
					if (validReturnDate(formName, datesArray)){
						return true;
					} else {
						alert("Please enter valid return and departure dates");
						return false;
					}
				}
			}
		} else {
			alert("Please enter a valid Departure and Arrival City");
			document.getElementById("cityDepart").style.color="#FF3300";
			document.getElementById("cityArrive").style.color="#FF3300";
			return false;
		}
}


function initFlights() {
	tomorrow = new Date(rightnow.getTime()+(86400000));
	document.flightSearch.departureDay.selectedIndex = tomorrow.getDate()-1;
	then = new Date(tomorrow.getTime()+(604800000))
	document.flightSearch.returnDay.selectedIndex = then.getDate()-1;
	document.flightSearch.returnMonth.selectedIndex = (then.getMonth() - tomorrow.getMonth()) % 12;
	var oldDepartIndex = document.flightSearch.departureDay.selectedIndex;
	document.flightSearch.departureDay.selectedIndex = oldDepartIndex;
	var oldReturnIndex = document.flightSearch.returnDay.selectedIndex;
	document.flightSearch.returnDay.selectedIndex = oldReturnIndex;
	if(tomorrow.getDate()-1 == 0){
	document.flightSearch.departureMonth.selectedIndex = (then.getMonth()+1 - tomorrow.getMonth())
	document.flightSearch.returnMonth.selectedIndex = (then.getMonth()+1 - tomorrow.getMonth())
	}	
	    
}


// DP /////////////////////////////////////////////////////////////////////////////////////////////
var mDays = new Array(31,28,31,30,31,30,31,31,30,31,30,31)	
	function calcDay(frm,nm,nm2){
 dateVal = document.forms[frm].elements[nm].options[document.forms[frm].elements[nm].selectedIndex].value;
 monthVal = document.forms[frm].elements[nm2].options[document.forms[frm].elements[nm2].selectedIndex].value;
 var isLeapYear = (((monthVal.substr(0,4) % 4 == 0) && (monthVal.substr(0,4) % 100 != 0)) || (monthVal.substr(0,4) % 400 == 0));
 mDays[1] = (isLeapYear)?29:28;
 if(dateVal > mDays[monthVal.substr(4,2)-1]){
  setDDValue(document.forms[frm].elements[nm],mDays[monthVal.substr(4,2)-1]);
  dateVal = document.forms[frm].elements[nm].options[document.forms[frm].elements[nm].selectedIndex].value;
  }
 }
function setDDValue(oDropDown, sValue){
 for(var iIndex=0; iIndex<oDropDown.options.length; ++iIndex){
  if(oDropDown.options[iIndex].value == sValue){
   oDropDown.selectedIndex = iIndex;
   break;
   }
  }
 }

function frmCheckSubmit(){
	var f1 = document.frm
	//var f2 = document.frm
	monthYear = f1.outboundDateMonthYear.options[f1.outboundDateMonthYear.selectedIndex].value;
	dayVal = f1.outboundDateDate.options[f1.outboundDateDate.selectedIndex].value;
	monthVal= monthYear.substr(4,2);
	yearVal = monthYear.substring(0,4);
				
	secMonthYear = f1.returnDateMonthYear.options[f1.returnDateMonthYear.selectedIndex].value;
	secDayVal = f1.returnDateDate.options[f1.returnDateDate.selectedIndex].value;
	secMonthVal = secMonthYear.substr(4,2);
	secYearVal = secMonthYear.substring(0,4);
	
	var date = new Date(yearVal, monthVal-1, dayVal);
	var secdate = new Date(secYearVal, secMonthVal-1, secDayVal);
	var theDate = date.getDate();
	var theSecDate = secdate.getDate();
	var DCity = f1.originInput.value;
	var ACity = f1.destination.value;
	
			if (DCity==0) {
				alert("Please enter a destination (From) name");
				f1.originInput.focus();
				return false;
			}
			if (ACity==0) {
				alert("Please enter a destination (To) name");
				f1.destination.focus();
				return false;
			}
	
	
			if (!((rightnow.valueOf() < date.valueOf()) && (date.valueOf() < secdate.valueOf()))) {
				alert("Please enter valid return and departure dates");
				return false;			
			} else {
				f1.submit();
				return false;	
			}
 }
	
function opodoInit() {
		var f1 = document.frm
		tomorrow = new Date(rightnow.getTime()+(604800000));
		for(d=0;d<31;d++) f1.outboundDateDate[d] = new Option(d+1,((d<10)?"0"+(d+1):d+1));
		for(d=0;d<31;d++) f1.returnDateDate[d] = new Option(d+1,((d<10)?"0"+(d+1):d+1));
		f1.outboundDateDate.selectedIndex = tomorrow.getDate()-1;
		if(tomorrow.getDate()-1 >6){f1.outboundDateMonthYear.selectedIndex = 0}
		else{f1.outboundDateMonthYear.selectedIndex = 1}
		then = new Date(tomorrow.getTime()+(604800000));
		f1.returnDateDate.selectedIndex = then.getDate()-1;
		if(then.getDate()-1 >13){f1.returnDateMonthYear.selectedIndex = 0}
		else{f1.returnDateMonthYear.selectedIndex = 1}
		stopMouseWheel()
}

function generateInfantRoomAllocation(){
	var searchForm = document.forms['frm'];
	if (searchForm == null){
		searchForm = document.forms['frm'];
	}
	var inputName = 'roomAllocations[0].adultQuantity';
	var infantRoomAllocation = 'roomAllocations[0].infantQuantity';
	var totalTravellers=parseInt(searchForm[inputName].value);
	generateOption(searchForm[infantRoomAllocation], parseInt(searchForm[inputName].value));
}
function generateOption(elem, num){
	var prevSelectedVal = elem.value;

	elem.length = 0;
	for (var i=0; i<=num; i++){
		var option = document.createElement('option');
		option.value = i;
		option.innerHTML = i;
		if (i==prevSelectedVal){
			option.selected = "true";
		}
		elem.appendChild(option);
		if (prevSelectedVal < elem.length){
			elem.selectedIndex = prevSelectedVal;
		} else {
			elem.selectedIndex = elem.length - 1;
		}
	}
}

function stopMouseWheel(){
if (window.attachEvent && document.getElementsByTagName) {
	var  sel = document.getElementsByTagName("select");
	for (i=0; i<sel.length; ++i) {
			sel[i].attachEvent('onmousewheel', function() {return false;});
		}
	}
}
function copyDestinationName() {
	var destinationList = document.getElementById('destination');
	var destElement = document.getElementById('destinationInput');
	var toCopy = destinationList.options[destinationList.selectedIndex];
	destElement.value = toCopy.innerHTML;
}


// hotels /////////////////////////////////////////////////////////////////////////////////////////
function setDest() {
	document.hotelOutput.destinationNameCheck.value = document.hotelOutput.destinationName.value;
}

function hotelSubmit(){
	var f1 = document.hotel
	var f2 = document.hotelOutput
	monthYear = f1.checkInDateB.options[f1.checkInDateB.selectedIndex].value;
	dayVal = f1.checkInDateA.options[f1.checkInDateA.selectedIndex].value;
	monthVal= monthYear.substr(4,2);
	yearVal = monthYear.substring(0,4);
				
	secMonthYear = f1.depDateB.options[f1.depDateB.selectedIndex].value;
	secDayVal = f1.depDateA.options[f1.depDateA.selectedIndex].value;
	secMonthVal = secMonthYear.substr(4,2);
	secYearVal = secMonthYear.substring(0,4);
		
	if (document.hotelOutput.destinationNameCheck.value == "") {
		alert("Please enter a destination");
		document.getElementById("hotelSearch").style.color="#FF3300";
		//document.getElementById("destinationName").focus();
		//document.getElementById("destinationName").select();
		return false;			
	}
	
	var date = new Date(yearVal, monthVal-1, dayVal);
	var secdate = new Date(secYearVal, secMonthVal-1, secDayVal);
	var theDate = date.getDate();
	var theSecDate = secdate.getDate();
	var aCity = f2.destinationName.value;
	if (secdate <= date) {
		alert("Please enter valid arrival and departure dates");
		return false;			
	}
	if (aCity==0) {
		alert("Please enter a city name");
		document.getElementById("hotelSearch").style.color="#FF3300";
		return false;
	}
	if ((rightnow > date)||(rightnow > secdate)) {
		alert("Please enter valid arrival and departure dates");
		return false;			
	}
	if ((theDate == null)&&(theSecdate == null)) {
		alert("Please enter valid arrival and departure dates");
		return false;
	} 
	if ((dayVal != theDate)||(secDayVal != theSecDate)) { 
		alert("Please enter valid arrival and departure dates");
		return false;	
	} else {
		f2.checkInDate.value = monthYear + dayVal;
		f2.checkOutDate.value = secMonthYear + secDayVal;
		f2.submit();
		return false;
	}
 }
	
function initHotels() {
	var f1 = document.hotel;
	tomorrow = new Date(rightnow.getTime()+(86400000));
	for(d=0;d<31;d++) {
		f1.checkInDateA[d] = new Option(d+1,((d<10)?"0"+(d+1):d+1));
		f1.depDateA[d] = new Option(d+1,((d<10)?"0"+(d+1):d+1));
	}
	f1.checkInDateA.selectedIndex = tomorrow.getDate()-1;
	then = new Date(tomorrow.getTime()+(172800000));
	f1.depDateA.selectedIndex = then.getDate()-1;

	then = new Date(tomorrow.getTime()+(604800000))
	f1.depDateA.selectedIndex = then.getDate()-1;
	f1.depDateB.selectedIndex = (then.getMonth() - tomorrow.getMonth()) % 12;
}


// cars /////////////////////////////////////////////////////////////////////////////////////////
function initCars(){

    if(document.carSearchFormBean.pickUpDateForm.value==""){
		sevendays = new Date(rightnow.getTime());
		document.carSearchFormBean.pickDate.selectedIndex = sevendays.getDate();
		then = new Date(sevendays.getTime()+(60480000));
		document.carSearchFormBean.dropDate.selectedIndex = then.getDate()-1;
		document.carSearchFormBean.dropMonth.selectedIndex = (then.getMonth() - sevendays.getMonth()) % 12;
	}else{
		var pickup=document.carSearchFormBean.pickUpDateForm.value;
		var drop=document.carSearchFormBean.dropOffDateForm.value;
		var pmonth=parseInt(pickup.slice(4,6),10);
		var pday=parseInt(pickup.slice(6,8),10);
		var ptime=parseInt(pickup.slice(8,10),10);
		document.carSearchFormBean.pickMonth.selectedIndex=pmonth-1;
		document.carSearchFormBean.pickDate.selectedIndex=pday-1;
		document.carSearchFormBean.pickHour.selectedIndex=ptime;
		var dmonth=parseInt(drop.slice(4,6),10);
		var dday=parseInt(drop.slice(6,8),10);
		var dtime=parseInt(drop.slice(8,10),10);
		document.carSearchFormBean.dropMonth.selectedIndex=dmonth-1;
		document.carSearchFormBean.dropDate.selectedIndex=dday-1;
		document.carSearchFormBean.dropHour.selectedIndex=dtime;
	}

	changeDate(document.carSearchFormBean.pickMonth, document.carSearchFormBean.pickDate);
	changeDate(document.carSearchFormBean.dropMonth, document.carSearchFormBean.dropDate);
}
function setPickLoc() {
	document.carSearchFormBean.destination1.value = document.carSearchFormBean.searchString.value;
}
function setDropLoc() {
	document.carSearchFormBean.destination2.value = document.carSearchFormBean.searchStringDrop.value;
}
function submitCheck() {
    if (document.carSearchFormBean.age.selectedIndex!=0){
    	var day = parseInt(document.carSearchFormBean.pickDate.options[document.carSearchFormBean.pickDate.selectedIndex].value,10);
    	var monthVal = new String(document.carSearchFormBean.pickMonth.options[document.carSearchFormBean.pickMonth.selectedIndex].value);
    	var month = parseInt(monthVal.slice(4),10);
    	var year = parseInt(monthVal.slice(0,4),10);
    	var pickupDate = new Date(year,month-1,day,12,0,0,0);
    	day = parseInt(document.carSearchFormBean.dropDate.options[document.carSearchFormBean.dropDate.selectedIndex].value,10);
    	monthVal = new String(document.carSearchFormBean.dropMonth.options[document.carSearchFormBean.dropMonth.selectedIndex].value);
    	month = parseInt(monthVal.slice(4),10);
    	year = parseInt(monthVal.slice(0,4),10);

		var dropoffDate = new Date(year,month-1,day,12,0,0,0);
    	if (pickupDate>dropoffDate || pickupDate<rightnow) {
	    	if (pickupDate>dropoffDate) {
	    		alert("Please check your drop-off date");
	    		document.getElementById("returnDate").style.color="#FF3300";
	    	}
	    	if (pickupDate<rightnow) {
	    		alert("Please check your pick-up date");
	    		document.getElementById("outboundDate").style.color="#FF3300";
	    	}
    		return false;
    	} else {
			document.carSearchFormBean.pickUpDateForm.value=""+pickupDate.getFullYear()+
			(((pickupDate.getMonth()+1)<10)?"0"+(pickupDate.getMonth()+1):(pickupDate.getMonth()+1))+
				((pickupDate.getDate()<10)?"0"+pickupDate.getDate():pickupDate.getDate())+
				((pickupDate.getHours()<10)?"0"+pickupDate.getHours():pickupDate.getHours())
				+((pickupDate.getMinutes()<10)?"0"+pickupDate.getMinutes():pickupDate.getMinutes());
			document.carSearchFormBean.dropOffDateForm.value=""+dropoffDate.getFullYear()+
			(((dropoffDate.getMonth()+1)<10)?"0"+(dropoffDate.getMonth()+1):(dropoffDate.getMonth()+1))+
				((dropoffDate.getDate()<10)?"0"+dropoffDate.getDate():dropoffDate.getDate())+
				((dropoffDate.getHours()<10)?"0"+dropoffDate.getHours():dropoffDate.getHours())+
				((dropoffDate.getMinutes()<10)?"0"+dropoffDate.getMinutes():dropoffDate.getMinutes());

			if (document.carSearchFormBean.destination2.value=="") {
				document.carSearchFormBean.destination2.value = document.carSearchFormBean.destination1.value;
			}
			document.carSearchFormBean.destination1.value=escape(document.carSearchFormBean.destination1.value);
			document.carSearchFormBean.destination2.value=escape(document.carSearchFormBean.destination2.value);
			return true;
        }
    }
}

function validateAge() {
	var valid = (document.carSearchFormBean.age.selectedIndex != 0);
	if (valid == false) {
		alert("You must enter a driver age");
		document.getElementById("driverAge").style.color="#FF3300";
	}
	return valid;
}

function validatePickup() {
	var valid = (document.carSearchFormBean.destination1.value != "");
	if (valid == false) {
		alert("You must enter a pick up destination");
		document.getElementById("pickupDest").style.color="#FF3300";
	}
	return valid;
}

function validateForm() {
	document.getElementById("driverAge").style.color="#000000";
	document.getElementById("pickupDest").style.color="#000000";
	document.getElementById("returnDate").style.color="#000000";
	document.getElementById("outboundDate").style.color="#000000";
	return ( validateAge() ) && ( validatePickup() ) && ( submitCheck() );
}


/* ------- LM-DP ------- */


                var nonValidReturnDateDP = '';

                // This function checks to see if the user has entered a short haul destination .
                // If so, the direct flight only check box is checked.
                function checkShortHaul(destination){
                        var shortHaulDestinations='Aberdeen,Aix-en-Provence,Algarve,Alicante,Amsterdam,Andorra,Antalya,Athens,Barcelona,Belfast,Benalmadena,Benidorm,Berlin,Biarritz,Bilbao,Bologna,Bordeaux,Bruges,Brussels,Budapest,Bulgaria,Cannes,Capri,Cologne,Copenhagen,Corfu,Cork,Crete,Disneyland &amp;reg; ResortParis,Dortmund,Dublin,Dubrovnik,Dusseldorf,Edinburgh,Faro,Frankfurt,Galway,Geneva,Glasgow,Halkidiki,Hamburg,Helsinki,Innsbruck,Istanbul,Kefalonia,Kos,Krakow,Larnaca,Leeds,Lefkas,Limerick,Lisbon,London,Lyon,Madeira,Madrid,Malaga,Mallorca,Manchester,Marbella,Marseille,Menorca,Milan,Monaco,Montreal,Munich,Nantes,Naples,Newcastle ,New York,Nice,Palermo,Palma de Mallorca,Paris,Perugia,Porto,Prague,Reykavik,Rhodes,Riga,Rome,Rotterdam,Salzburg,Santa Monica,Santorini,Sardinia,Seville,Sicily,Siena,Sorrento,St Julians,Stockholm,Tallinn,Torremolinos,Toulouse,Turin,Valencia,Venice,Verona,Vienna,Warsaw,Zagreb,Zurich'
                        var depAirport='LON,LGW,LHR';
                        var destinationsArray = shortHaulDestinations.split(',') ;
                        var destinationsDropdown = document.getElementById('destination');
                        var destination = destinationsDropdown.options[destinationsDropdown.selectedIndex].text;
                        var departureDropdown = document.getElementById('departurePoint');
                        var departurePoint = departureDropdown.options[departureDropdown.selectedIndex].value;
                        for (i=0;i<=destinationsArray.length;i++){
                                if (destination.indexOf(destinationsArray[i])!=-1 && depAirport.indexOf(departurePoint)!=-1){
//                                        document.getElementById('direct_flights').checked=true;
                                        break;
                                }else{
//                                        document.getElementById('direct_flights').checked=false;
                                }
                        }
                }
                // DP / Endeca destination mappings passed to packaging_scripts_frontier.js
                endecaDestinations={'Agadir':'Agadir','Algarve':'Algarve','Alicante':'Alicante','Andorra':'Andorra','Antalya':'Antalya','Antigua':'Antigua','Bahamas':'Bahamas','Barbados':'Barbados','Benalmadena':'Benalmadena','Benidorm':'Benidorm','Bodrum':'Bodrum','Brazil':'Brazil','Cancun':'Cancun','Capri':'Capri','Corfu':'Corfu','Crete':'Crete','Dalaman':'Dalaman','Djerba':'Djerba','Dominican Republic':'Dominican Republic','Egypt':'Egypt','Fez':'Fez','Fuerteventura':'Fuerteventura','Gambia':'Gambia','Goa':'Goa','Gran Canaria':'Gran Canaria','Grenada':'Grenada','Halkidiki':'Halkidiki','Hammamet':'Hammamet','Hurghada':'Hurghada','India':'India','Kefalonia':'Kefalonia','Kenya':'Kenya','Kos':'Kos','Limassol':'Limassol','Lefkas':'Lefkas','Luxor':'Luxor','Madeira':'Madeira','Maldives':'Maldives','Menorca':'Menorca','Mombassa':'Mombassa','Porto':'Porto','Puerto Rico':'Puerto Rico','Rhodes':'Rhodes','Santorini':'Santorini','Sardinia':'Sardinia','Seychelles':'Seychelles','Sharm El Sheikh':'Sharm El Sheikh','Skiathos':'Skiathos','St Julians':'St Julians','St Kitts and Nevis':'St Kitts and Nevis','St Lucia':'St Lucia','Tahiti':'Tahiti','Tanzania':'Tanzania','Thailand':'Thailand','Tobago':'Tobago','Torremolinos':'Torremolinos','Trinidad and Tobago':'Trinidad and Tobago','Tunisia':'Tunisia','Vietnam':'Vietnam','Zakynthos':'Zakynthos'};
                // Month names passed to packaging_scripts_frontier.js
                differentHotelDateMonths=new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')
                var cookieFormName='searchForm';

function flightPrepSubmit()
{
    if (document.getElementById('departureAirport_hidden').value == '' && document.getElementById('departureAirport').value.length == 3) document.getElementById('departureAirport_hidden').value = document.getElementById('departureAirport').value;
    if (document.getElementById('arrivalAirport_hidden').value == '' && document.getElementById('arrivalAirport').value.length == 3) document.getElementById('arrivalAirport_hidden').value = document.getElementById('arrivalAirport').value;
    submitform = true;
    document.flightSearch.submit();
}
					    
function dateChangeTrigger(){
}
