	function setDepartureCitySuggestion()
	{
		var departurecity=document.getElementById("departurecity");
		var departuresuggestion=document.getElementById("departuresuggestion");
		if(departuresuggestion.value!="")
		departurecity.value=departuresuggestion.value;
	}
	function setDestinationCitySuggestion()
	{
		var destinationcity=document.getElementById("destinationcity");	
		var destinationsuggestion=document.getElementById("destinationsuggestion");
		if(destinationsuggestion.value!="")
		destinationcity.value=destinationsuggestion.value;
	}
	function setOnewayDepartureCitySuggestion()
	{
		var onewaydeparturecity=document.getElementById("onewaydeparturecity");	
		var onewaydeparturesuggestion=document.getElementById("onewaydeparturesuggestions");
		if(onewaydeparturesuggestion.value!="")
		onewaydeparturecity.value=onewaydeparturesuggestion.value;
	}
	function setOnewayDestinationCitySuggestion()
	{
		var onewaydestinationcity=document.getElementById("onewaydestinationcity");	
		var onewaydestinationsuggestions=document.getElementById("onewaydestinationsuggestions");
		if(onewaydestinationsuggestions.value!="")
		onewaydestinationcity.value=onewaydestinationsuggestions.value;
	}
	function setMlDepartureCitySuggestion(leg)
	{
		var mldeparturecity=document.getElementById("mldeparturecity"+leg);
		var mldeparturesuggestions=document.getElementById("mldeparturesuggestions"+leg);
		if(mldeparturesuggestions.value!="")
		mldeparturecity.value=mldeparturesuggestions.value;
	}

	function setMlDestinationCitySuggestion(leg)
	{
		var mldestinationcity=document.getElementById("mldestinationcity"+leg);
		var mldestinationsuggestions=document.getElementById("mldestinationsuggestions"+leg);
		if(mldestinationsuggestions.value!="")
		mldestinationcity.value=mldestinationsuggestions.value;
	}
	
	function setMlDepartureCityForNextLeg(leg)
	{
		var mldestinationcity=document.getElementById("mldestinationcity"+leg);
		var mldeparturecitynextleg=document.getElementById("mldeparturecity"+(leg+1));
		
		if(mldeparturecitynextleg!=null&&mldeparturecitynextleg.value==""&&mldestinationcity!=null&&mldestinationcity.value.length==3)
		mldeparturecitynextleg.value=mldestinationcity.value;
	}
	
	function setMlDepartureDateForNextLeg(leg)
	{
		var mlcheckoutdate=document.getElementById("mlcheckoutdate"+leg);
		var mldeparturedatenextleg=document.getElementById("mldeparturedate"+(parseInt(leg)+1));
		if(mldeparturedatenextleg!=null&&mldeparturedatenextleg.value==""&&mlcheckoutdate!=null&&mlcheckoutdate.value.length>4)
		{mldeparturedatenextleg.value=mlcheckoutdate.value;}
		
	}
	
	function setMlDepartureDateForNextLeg(leg)
	{
		var mlcheckoutdate=document.getElementById("mlcheckoutdate"+leg);
		var mldeparturedatenextleg=document.getElementById("mldeparturedate"+(parseInt(leg)+1));
		if(mldeparturedatenextleg!=null&&mldeparturedatenextleg.value==""&&mlcheckoutdate!=null&&mlcheckoutdate.value.length>4)
		{mldeparturedatenextleg.value=mlcheckoutdate.value;}
		
	}
/*	
	function setMlDepartureDateForNextLegAddress(leg)
	{
		var mlacheckoutdate=document.getElementById("mlacheckoutdate"+leg);
		var mldeparturedatenextleg=document.getElementById("mldeparturedate"+(parseInt(leg)+1));
		if(mldeparturedatenextleg!=null&&mldeparturedatenextleg.value==""&&mlacheckoutdate!=null&&mlacheckoutdate.value.length>4)
		{mldeparturedatenextleg.value=mlacheckoutdate.value;}
		
	}
	*/
	function setMlCheckoutDateForPreviousLeg(leg)
	{	
		var mlcheckoutdateprevleg=document.getElementById("mlcheckoutdate"+(parseInt(leg)-1));
		var mldeparturedate=document.getElementById("mldeparturedate"+leg);
		if(mldeparturedate!=null&&mldeparturedate.value.length>4&&mlcheckoutdateprevleg!=null)
		{mlcheckoutdateprevleg.value=mldeparturedate.value;}		
	}
	
	function setMlaCitySuggestion(leg)
	{
		var mlarrivalcity=document.getElementById("mlarrivalcity"+leg);
		var mlacitysuggestions=document.getElementById("mlacitysuggestions"+leg);
		if(mlacitysuggestions.value!="")
		mlarrivalcity.value=mlacitysuggestions.value;
	}
	
	function setHairCitySuggestion()
	{
		var haircity=document.getElementById("haircity");
		var haircitysuggestions=document.getElementById("haircitysuggestions");
		if(haircitysuggestions.value!="")
		haircity.value=haircitysuggestions.value;
	}
	
	function setCairPickupcitySuggestion()
	{
		var cairpickupcity=document.getElementById("cairpickupcity");
		var cairpickupsuggestions=document.getElementById("cairpickupsuggestions");
		if(cairpickupsuggestions.value!="")
		cairpickupcity.value=cairpickupsuggestions.value;
	}

	function setCairDropoffcitySuggestion()
	{
		var cairdropoffcity=document.getElementById("cairdropoffcity");
		var cairdropoffsuggestions=document.getElementById("cairdropoffsuggestions");
		if(cairdropoffsuggestions.value!="")
		cairdropoffcity.value=cairdropoffsuggestions.value;
	}
	
	function addFlight()
	{
		var numberoflegs=document.getElementById("numberoflegs");
		numberoflegs.value=parseInt(numberoflegs.value)+1;
		document.advancedsearchform.submit()
	}
	
	function removeFlight()
	{
		var numberoflegs=document.getElementById("numberoflegs");
		numberoflegs.value=parseInt(numberoflegs.value)-1;
		document.advancedsearchform.submit()
	}
	//this is called on the multileg tab when a user checks the "Add a hotel near this airport" checkbox
	function populateHotelSearch(legnumber)
	{	
		var mladdhotel=document.getElementById("mladdhotel"+legnumber);
		if(mladdhotel.checked==true){
			var mlarrivalcity=document.getElementById("mlarrivalcity"+legnumber);
			var mlcheckindate=document.getElementById("mlcheckindate"+legnumber);
			if(mlarrivalcity!=null)
			{
				var mldestinationcity=document.getElementById("mldestinationcity"+legnumber);
				mlarrivalcity.value=mldestinationcity.value
			}
			if(mlcheckindate!=null)
			{
				var mldeparturedate=document.getElementById("mldeparturedate"+legnumber);
				mlcheckindate.value=mldeparturedate.value
			}
		}
	}
	
	function populateMLHotelCheckinDate(legnumber)
	{	
			var mldeparturedate=document.getElementById("mldeparturedate"+legnumber);
			var mlcheckindate=document.getElementById("mlcheckindate"+legnumber);
			if(mldeparturedate!=null&&mlcheckindate!=null)
			{mlcheckindate.value=mldeparturedate.value}		
	}
/*
	function toggleCarHotelOptions(legnumber)
	{	var mldestinationcity=document.getElementById("mldestinationcity"+legnumber);
		var mlpickupcarp=document.getElementById("mlpickupcarp"+legnumber);
		var mladdhotelp=document.getElementById("mladdhotelp"+legnumber);
		if(mldestinationcity.value.length<3)
		{mlpickupcarp.style.display="none"
		 mladdhotelp.style.display="none"}
		else
		{mlpickupcarp.style.display="block"
		 mladdhotelp.style.display="block"}
	}
*/
//functions for populating information between tabs	
	function populateHotelByAirportFromRoundTrip()
	{
		var destinationcity=document.getElementById("destinationcity");
		var departuredate=document.getElementById("departuredate");
		var returndate=document.getElementById("returndate");
		
		var haircity=document.getElementById("haircity");
		var haircheckindate=document.getElementById("haircheckindate");
		var haircheckoutdate=document.getElementById("haircheckoutdate");
		
		if(destinationcity!=null&&destinationcity.value.length==3&&haircity!=null)
		{haircity.value=destinationcity.value}
		
		if(departuredate!=null&&haircheckindate!=null)
		{haircheckindate.value=departuredate.value}
		
		if(returndate!=null&&haircheckoutdate!=null)
		{haircheckoutdate.value=returndate.value}
	}
	
	function clearHotelByAirportTab()
	{
		var haircity=document.getElementById("haircity");
		var haircheckindate=document.getElementById("haircheckindate");
		var haircheckoutdate=document.getElementById("haircheckoutdate");
		
		if(haircity!=null)
		{haircity.value=""}
		
		if(haircheckindate!=null)
		{haircheckindate.value=""}
		
		if(haircheckoutdate!=null)
		{haircheckoutdate.value=""}
	}
	
	function populateHotelByAirportFromOneWay()
	{
		var onewaydestinationcity=document.getElementById("onewaydestinationcity");
		var onewaydeparturedate=document.getElementById("onewaydeparturedate");
		
		var haircity=document.getElementById("haircity");
		var haircheckindate=document.getElementById("haircheckindate");
		
		if(onewaydestinationcity!=null&&onewaydestinationcity.value.length==3&&haircity!=null)
		{haircity.value=onewaydestinationcity.value}
		
		if(onewaydeparturedate!=null&&haircheckindate!=null)
		{haircheckindate.value=onewaydeparturedate.value}
	}
	
	function populateHotelByAddressFromRoundTrip()
	{
		var destinationcity=document.getElementById("destinationcity");
		var departuredate=document.getElementById("departuredate");
		var returndate=document.getElementById("returndate");
		
		//var haddrcity=document.getElementById("haddrcity");
		var haddrcheckindate=document.getElementById("haddrcheckindate");
		var haddrcheckoutdate=document.getElementById("haddrcheckoutdate");
		
		//if(destinationcity!=null&&destinationcity.value.length==3&&haddrcity!=null&&haddrcity.value.length==0)
		//{haddrcity.value=destinationcity.value}
		
		if(departuredate!=null&&haddrcheckindate!=null)
		{haddrcheckindate.value=departuredate.value}
		
		if(returndate!=null&&haddrcheckoutdate!=null)
		{haddrcheckoutdate.value=returndate.value}
	}
	
	function clearHotelByAddressTab()
	{
		var haddrcity=document.getElementById("haddrcity");
		var haddrcheckindate=document.getElementById("haddrcheckindate");
		var haddrcheckoutdate=document.getElementById("haddrcheckoutdate");
		
		if(haddrcity!=null)
		{haddrcity.value=""}
		
		if(haddrcheckindate!=null)
		{haddrcheckindate.value=""}
		
		if(haddrcheckoutdate!=null)
		{haddrcheckoutdate.value=""}
	}
	
	function populateHotelByAddressFromOneWay()
	{
		var onewaydestinationcity=document.getElementById("onewaydestinationcity");
		var onewaydeparturedate=document.getElementById("onewaydeparturedate");
		
		//var haddrcity=document.getElementById("haddrcity");
		var haddrcheckindate=document.getElementById("haddrcheckindate");
		
		//if(onewaydestinationcity!=null&&onewaydestinationcity.value.length==3&&haddrcity!=null&&haddrcity.value.length==0)
		//{haddrcity.value=onewaydestinationcity.value}
		
		if(onewaydeparturedate!=null&&haddrcheckindate!=null)
		{haddrcheckindate.value=onewaydeparturedate.value}
	}
	
	function uncheckHotelOption()
	{ 
	 var ishotelSearch=document.getElementById("ishotelSearch");
	 if(ishotelSearch!=null){
		 if(ishotelSearch.checked)
		 ishotelSearch.checked=false
	 }
	}
	
	function populateCarByAirportFromRoundTrip()
	{
		var destinationcity=document.getElementById("destinationcity");
		var departuredate=document.getElementById("departuredate");
		var returndate=document.getElementById("returndate");
		
		var cairpickupcity=document.getElementById("cairpickupcity");
		var cairdropoffcity=document.getElementById("cairdropoffcity");
		var cairpickupdate=document.getElementById("cairpickupdate");
		var cairdropoffdate=document.getElementById("cairdropoffdate");
		
		if(destinationcity!=null&&destinationcity.value.length==3&&cairpickupcity!=null)
		{cairpickupcity.value=destinationcity.value}
		
		if(destinationcity!=null&&destinationcity.value.length==3&&cairdropoffcity!=null)
		{cairdropoffcity.value=destinationcity.value}
		
		if(departuredate!=null&&cairpickupdate!=null)
		{cairpickupdate.value=departuredate.value}
		
		if(returndate!=null&&cairdropoffdate!=null)
		{cairdropoffdate.value=returndate.value}
	}
	
	function populateCarByCityFromRoundTrip()
	{
		var destinationcity=document.getElementById("destinationcity");
		var departuredate=document.getElementById("departuredate");
		var returndate=document.getElementById("returndate");
		
		//var cctycity=document.getElementById("cctycity");
		var cctypickupdate=document.getElementById("cctypickupdate");
		var cctydropoffdate=document.getElementById("cctydropoffdate");
		
		//if(destinationcity!=null&&destinationcity.value.length==3&&cctycity!=null&&cctycity.value.length==0)
		//{cctycity.value=destinationcity.value}
		
		if(departuredate!=null&&cctypickupdate!=null)
		{cctypickupdate.value=departuredate.value}
		
		if(returndate!=null&&cctydropoffdate!=null)
		{cctydropoffdate.value=returndate.value}
	}
	
	function populateCarByAirportFromOneWay()
	{
		var onewaydestinationcity=document.getElementById("onewaydestinationcity");
		var onewaydeparturedate=document.getElementById("onewaydeparturedate");
		
		var cairpickupcity=document.getElementById("cairpickupcity");
		var cairdropoffcity=document.getElementById("cairdropoffcity");
		var cairpickupdate=document.getElementById("cairpickupdate");
		
		if(onewaydestinationcity!=null&&onewaydestinationcity.value.length==3&&cairpickupcity!=null)
		{cairpickupcity.value=onewaydestinationcity.value}
		
		if(onewaydestinationcity!=null&&onewaydestinationcity.value.length==3&&cairdropoffcity!=null)
		{cairdropoffcity.value=onewaydestinationcity.value}
		
		if(onewaydeparturedate!=null&&cairpickupdate!=null)
		{cairpickupdate.value=onewaydeparturedate.value}

	}
	
	function populateCarByCityFromOneWay()
	{
		var onewaydestinationcity=document.getElementById("onewaydestinationcity");
		var onewaydeparturedate=document.getElementById("onewaydeparturedate");
		
		//var cctycity=document.getElementById("cctycity");
		var cctypickupdate=document.getElementById("cctypickupdate");
		
		//if(onewaydestinationcity!=null&&onewaydestinationcity.value.length==3&&cctycity!=null&&cctycity.value.length==0)
		//{cctycity.value=onewaydestinationcity.value}
		
		if(onewaydeparturedate!=null&&cctypickupdate!=null)
		{cctypickupdate.value=onewaydeparturedate.value}
	}
	
	function uncheckCarOption()
	{
	 var iscarSearch=document.getElementById("iscarSearch");
	 if(iscarSearch!=null){
		 if(iscarSearch.checked)
		 iscarSearch.checked=false
	 }
	}
	
	function clearCarByAirportTab()
	{
		var cairpickupcity=document.getElementById("cairpickupcity");
		var cairdropoffcity=document.getElementById("cairdropoffcity");
		var cairpickupdate=document.getElementById("cairpickupdate");
		var cairdropoffdate=document.getElementById("cairdropoffdate");
		
		if(cairpickupcity!=null)
		{cairpickupcity.value=""}
		
		if(cairdropoffcity!=null)
		{cairdropoffcity.value=""}
		
		if(cairpickupdate!=null)
		{cairpickupdate.value=""}
		
		if(cairdropoffdate!=null)
		{cairdropoffdate.value=""}
	}
	
	function clearCarByCityTab()
	{
		var cctycity=document.getElementById("cctycity");
		var cctypickupdate=document.getElementById("cctypickupdate");
		var cctydropoffdate=document.getElementById("cctydropoffdate");
		
		if(cctycity!=null)
		{cctycity.value=""}
		
		if(cctypickupdate!=null)
		{cctypickupdate.value=""}
		
		if(cctydropoffdate!=null)
		{cctydropoffdate.value=""}
	}
	
	function showHideHoursCombo(callertimecomboid,hourscomboid){
		var hourscombo=document.getElementById(hourscomboid);
		var callertimecombo=document.getElementById(callertimecomboid);
		if(hourscombo!=null&&callertimecombo!=null)
		{
			var selectedvalue=callertimecombo.options[callertimecombo.selectedIndex].value
			if(selectedvalue=='ANYTIME'||selectedvalue=='MORNING'||selectedvalue=='NOON'||selectedvalue=='EVENING')
			{	
				hourscombo.style.display="none"
			}else{
				hourscombo.style.display="inline"
			}		
		}	
	}
	//prepopulates the drop off city value with the value that's in pick up city and vice versa
	function copyPickupToDropoffLocation()
	{
		var cairpickupcity=document.getElementById("cairpickupcity");
		var cairdropoffcity=document.getElementById("cairdropoffcity");
		if(cairpickupcity!=null&&cairdropoffcity!=null)
		{cairdropoffcity.value=cairpickupcity.value}
	}
//shows/hides state combo and province combo	
//function showHideStateProvinceCombo(countrycomboid,statecomboid,provincecomboid){
 // var countrycombo=document.getElementById(countrycomboid);
//  var statecombo=document.getElementById(statecomboid);
  
 // if(countrycombo!=null){
//	var selectedcountry=countrycombo.options[countrycombo.selectedIndex].value;
//	if(statecombo!=null){
//	 if(selectedcountry=='US')
//	 {
//		statecombo.style.display="inline";		
//	 }else{
//		statecombo.style.display="none";		
//	 }
//	}
 // }
//}

function setCountryCombo(countrycomboid,statecomboid,provincecomboid){
 var countrycombo=document.getElementById(countrycomboid);
 var statecombo=document.getElementById(statecomboid);
  
 if(statecombo!=null){
	var selectedstate=statecombo.options[statecombo.selectedIndex].value;
	if(countrycombo!=null){
	 if(selectedstate!='')
	 {
		for (var i=0;i<countrycombo.options.length;i++) {
    	 if (countrycombo.options[i].value == 'US')
         {countrycombo.options[i].selected = true;
          break;}
		}		
	 }else{
		countrycombo.options[0].selected = true;	
	 }
	}
 }
}

function setStateCombo(countrycomboid,statecomboid,provincecomboid){
 var countrycombo=document.getElementById(countrycomboid);
 var statecombo=document.getElementById(statecomboid);
 if(countrycombo!=null){
	var selectedcountry=countrycombo.options[countrycombo.selectedIndex].value;
	if(statecombo!=null&&selectedcountry!='US'){
		statecombo.options[0].selected = true;	
	}
 }
}

function setHaddrCitySuggestion()
{
	var haddrcity=document.getElementById("haddrcity");
	var haddrcitysuggestions=document.getElementById("haddrcitysuggestions");
	if(haddrcitysuggestions.value!="")
	haddrcity.value=haddrcitysuggestions.value;
}

function setMLHaddrCitySuggestion(leg)
{
	var mlcity=document.getElementById("mlcity"+leg);
	var mlhaddrcitysuggestions=document.getElementById("mlhaddrcitysuggestions"+leg);
	if(mlhaddrcitysuggestions.value!="")
	mlcity.value=mlhaddrcitysuggestions.value;
}

function hideCarSearch(hide)
{	var cartitle=document.getElementById("bobcontentcar-title");
	var cartabs=document.getElementById("bobcontentcar");
	if(hide==true)
	{
		if(cartitle!=null)
		{cartitle.style.display="none";}
		if(cartabs!=null)
		{cartabs.style.display="none";}
	}else{
		if(cartitle!=null)
		{cartitle.style.display="block";}
	}
}

function hideHotelSearch(hide)
{	var hoteltitle=document.getElementById("bobcontenthotel-title");
	var hoteltabs=document.getElementById("bobcontenthotel");
	if(hide==true)
	{	if(hoteltitle!=null)
		{hoteltitle.style.display="none";}
		if(hoteltabs!=null)
		{hoteltabs.style.display="none";}
	}else{
		if(hoteltitle!=null)
		{hoteltitle.style.display="block";}
	}
}

function hideRailSearch(hide)
{	var railtitle=document.getElementById("bobcontentrail-title");
	var railtabs=document.getElementById("bobcontentrail");
	if(hide==true)
	{	if(railtitle!=null)
		{railtitle.style.display="none";}
		if(railtabs!=null)
		{railtabs.style.display="none";}
	}else{
		if(railtitle!=null)
		{railtitle.style.display="block";}
	}
}

function toggleRadiusDropdown(field,radiuscomboId){
return;
	var radiuscombo=document.getElementById(radiuscomboId);
if(field.value=="")
{
 radiuscombo.style.display="block";
}else{
 radiuscombo.style.display="none";
}

}
