<!--
var depCntryParam="";
var depAptParam="";
var depParam="United Kingdom";
var destTitle="";
var cntryCode="";
buildAirportObjects();
buildRouteObjects();
buildCountryObjects();
buildNewRouteObjects();
function hidediv()
{
getElm('countrydd').style.display="none";
getElm('airports').style.display="none";
getElm('routes').style.display="none";
}
function buildContinentDropdown()
{
document.writeln('<select name="contList" onClick="buildDestCntryList(document.routehtml.contList.value)">');
document.writeln('<option value="" selected>-select region-</option>');
for(var i=0;i<mapContinents.length;)
{
var cCode=mapContinents[i++];
var cName=mapContinents[i++];
document.writeln('<option value="'+cCode+'">'+cName+'</option>');
}
document.writeln('</select>');
}
function buildDestCntryList(chosenCont)
{
var routeDestCntry="";
var outputCountry="";
var destCntryList=new Array();
for(rObj in country)
{
if (typeof chosenCont=="undefined" | chosenCont=="")
getElm('countrydd').style.display="none";
else
{
getElm('countrydd').innerHTML="&nbsp;";
getElm('countrydd').style.display="block";
if (chosenCont==country[rObj].contntcode)
{
if (typeof destCntryList[country[rObj].name]=="undefined")
destCntryList[destCntryList.length]=country[rObj].name;
}
}
}
destCntryList.sort();
outputCountry='<select id="countryList" onChange="buildDestCityList()"><option value="" selected>-select country-</option>';
for(i=0; i<destCntryList.length; i++)
{
outputCountry+='<option value="'+destCntryList[i]+'">'+destCntryList[i]+'</option>';
}
outputCountry+='</select>';
if (typeof chosenCont!="undefined")
getElm('countrydd').innerHTML=outputCountry;
else
document.writeln(outputCountry);
}
function buildDestCityList()
{
var cntryName=getElm('countryList').value;
var outputCity="";
var destCityList=new Array();
if (typeof cntryName!="undefined")
{
for(rObj in country)
{
if(country[rObj].name==cntryName)
{
getElm('airports').innerHTML="&nbsp;";
getElm('airports').style.display="block";
cntryCode=country[rObj].code;
break;
}
}
for(rObj in airport)
{
if (airport[rObj].country==cntryCode)
{
if (typeof destCityList[airport[rObj].code]=="undefined")
destCityList[destCityList.length]=airport[rObj].code
}
}
destCityList.sort(sortComparison);
outputCity='<select name="cityList" id="cityList" onChange="buildRouteList()"><option value="" selected>-select city-</option>';
for(i=0; i<destCityList.length; i++)
{
cityCode=destCityList[i];
cityName=airport[cityCode].name;
outputCity+='<option value="'+destCityList[i]+'">'+airport[cityCode].name+'</option>';
}
outputCity+='</select>';
getElm('airports').innerHTML=outputCity;
}
else
document.writeln(outputCity);
}
function buildRouteList()
{
var outputRoute="";
var tableHead="";
getElm('routes').innerHTML="&nbsp;";
getElm('routes').style.display="block";
var routeAirportNameList=new Array();
var newRouteAirportNameList=new Array();
for(rObj in route)
{
if (getElm("cityList").value==rObj.slice(0,3))
{
if (getElm("cityList").value==rObj.slice(0,3) && rObj.slice(0,3)!="LON")
routeAirportNameList[routeAirportNameList.length]=route[rObj].arrAirport+route[rObj].carrier;
else
{
if (rObj.slice(0,3)!="LON")
routeAirportNameList[routeAirportNameList.length]=route[rObj].depAirport+route[rObj].carrier;
}
}
}
routeAirportNameList.sort(sortComparison);
if (document.routehtml.arrdep[0].checked==true){
tableHead1="To";
tableHead2="From";
}
else
{tableHead1="From";
tableHead2="To";}
outputRoute='<table width="570" cellspacing="0" cellpadding="0" borders="0"><tr><td width="10px"><img src="/cms/global/images/icons/formTopLeft.gif" width="10px" height="5px" borders="0"/></td><td width="550px" height="5px" bgcolor="#666699"></td><td width="10px"><img src="/cms/global/images/icons/formTopRight.gif" width="10px" height="5px" borders="0"/></td></tr></table><table width="570" cellspacing="0" cellpadding="3"><tr><td width="25%" class="nltabletitle" style="text-align:center;">'+tableHead1+'</td><td width="25%" class="nltabletitle" style="text-align:center;">'+tableHead2+'</td><td width="25%" style="text-align:center;" class="nltabletitle">Operated by</td><td width="25%" style="text-align:center;" class="nltabletitle">Book</td></tr></table><table width="570" class="nltablebg3" cellspacing="0" cellpadding="3">';
for(i=0; i<routeAirportNameList.length; i++)
{
outputRoute+='<tr><td width="25%" style="text-align:left; border-right:1px solid #666699;">'+airport[routeAirportNameList[i].slice(0,3)].name+'</td><td width="25%" style="text-align:left; border-right:1px solid #666699;">'+airport[getElm("cityList").value].name+'</td><td width="25%" style="text-align:left; border-right:1px solid #666699;">' + routeAirportNameList[i].slice(3,50) + '</td>';
if (document.routehtml.arrdep[0].checked==false){
outputRoute+='<td width="25%" style="text-align:center;"><a href="/main/fx/?depCountry='+airport[routeAirportNameList[i].slice(0,3)].country+'&from='+routeAirportNameList[i].slice(0,3)+'&to='+getElm("cityList").value+'" style="color:#CC0000; text-decoration:underline;">Book now</a></td></tr>';
} else {
outputRoute+='<td width="25%" style="text-align:center;"><a href="/main/fx/?depCountry='+airport[getElm("cityList").value].country+'&from='+getElm("cityList").value+'&to='+routeAirportNameList[i].slice(0,3)+'" style="color:#CC0000; text-decoration:underline;">Book now</a></td></tr>';
}
for (nrObj in newRoute) {
if (newRoute[nrObj].carrier != "XX") {
if (routeAirportNameList[i].slice(0,3) == newRoute[nrObj].depAirport && getElm("cityList").value == newRoute[nrObj].arrAirport && routeAirportNameList[i].slice(3,50) == newRoute[nrObj].carrier.slice(0,50) && document.routehtml.arrdep[0].checked==false)
{
outputRoute+='<tr bgcolor="#FFFFFF" style="color:#000076"><td colspan="4" style="text-align:left;">'+newRoute[nrObj].comment+'</td></tr>';
}
if (routeAirportNameList[i].slice(0,3) == newRoute[nrObj].arrAirport && getElm("cityList").value == newRoute[nrObj].depAirport && routeAirportNameList[i].slice(3,50) == newRoute[nrObj].carrier.slice(0,50) && document.routehtml.arrdep[0].checked==true)
{
outputRoute+='<tr bgcolor="#FFFFFF" style="color:#000076"><td colspan="4" style="text-align:left;">'+newRoute[nrObj].comment+'</td></tr>';
}
}
}
}
if (outputRoute=="")
outputRoute+='<div class="maintextintroerror">Sorry, there are no listings for any journey originating/terminating at this airport';
outputRoute+='</table></div>';
getElm('routes').innerHTML=outputRoute;
}
function sortComparison(a,b)
{
x=a.slice(0,3);
y=b.slice(0,3);
if (airport[x].name < airport[y].name) return -1;
if (airport[x].name > airport[y].name) return 1;
return 0;
}
