var gDateDetail = "SUMMARY";
var gDateRange = "RANGE1";
$(pageSetup);
function pageSetup() {
try {
var fromCode = getQueryValue("from").toLowerCase();
if(fromCode) {
$("#dep option[@value='" + fromCode + "']").attr("selected", "selected");
outputData();
$("#deals").click(function() {setFocus("DEALS");});
$("#dealsTab").click(function() {setFocus("DEALS");});
$("#hotels").click(function() {setFocus("HOTELS");});
$("#hotelsTab").click(function() {setFocus("HOTELS");});
hideAll();
$("#arr").change(function () {
outputData();
});
$("#arr").keyup(function() {
outputData();
});
outputData();
$("#dep").change(function () {
outputCosts();
});
$("#dep").keyup(function() {
outputCosts();
});
$("input[@name='travelDateSelect']").click(function() {
outputCosts();
});
outputCosts()
}
}
catch(e) {
alert(e.toString());
}
}
function isPostPin() {
var isPostpin = false;
if(document.nav_form.logintype.value != 'public') {
isPostpin = true;
}
return(isPostpin);
}
function hideAll()
{
$("#hotel01, #hotel02, #hotel03, #hotel04, #hotel05, #hotel06, #hotel07, #hotel09, #hotel10, #hotel11, #hotel12, #hotel13, #hotel14, #hotel15, #hotel16, #hotel17, #hotel18, #hotel19, #hotel20, #hotel21, #hotel22, #hotel23, #ssAberdeen, #ssGlasgow, #ssEdinburgh, #ssLondon, #ssNewcastle, #ssManchester, #ssOxford, #ssCambridge, #ssYork").hide();
}
function hideAllFares()
{
$("#cityDiv div.samplePrices").hide();
$("#jfkWTP, #iadWTP, #atlWTP, #bwiWTP, #bosWTP, #ordWTP, #ewrWTP, #denWTP, #dfwWTP, #iahWTP, #laxWTP, #miaWTP, #mcoWTP, #phlWTP, #phxWTP, #sfoWTP, #seaWTP, #tpaWTP, #yycWTP, #yvrWTP, #yulWTP, #yyzWTP").hide();
}
function outputData()
{
if($("#arr option:selected").val() != "NON")
{
var hotelCity;
hotelCity = $("#arr option:selected").val();
if (hotelCity == "lon")
{
hideAll();
$("#hotel01, #hotel02, #hotel03, #hotel04, #hotel05, #hotel06, #hotel07, #hotel09, #hotel10, #ssLondon").show();
}
else
if (hotelCity == "man")
{
hideAll();
$("#hotel22").show();
$("#hotel23, #ssManchester").show();
}
else
if (hotelCity == "cam")
{
hideAll();
$("#hotel11, #ssCambridge").show();
}
else
if (hotelCity == "oxf")
{
hideAll();
$("#hotel12, #ssOxford").show();
}
else
if (hotelCity == "yor")
{
hideAll();
$("#hotel13, #ssYork").show();
}
else
if (hotelCity == "abe")
{
hideAll();
$("#hotel14, #hotel15, #ssAberdeen").show();
}
else
if (hotelCity == "new")
{
hideAll();
$("#hotel16, #hotel17, #ssNewcastle").show();
}
else
if (hotelCity == "edi")
{
hideAll();
$("#hotel18, #hotel19, #ssEdinburgh").show();
}
else
if (hotelCity == "gla")
{
hideAll();
$("#hotel20, #hotel21, #ssGlasgow").show();
}
}
}
function outputCosts()
{
hideAllFares();
var departureCity="";
var departureTimeSpan="";
if($("#dep option:selected").val() != "NON")
{
departureTimeSpan = $("input[@name='travelDateSelect']:checked").val();
departureCity = $("#dep option:selected").val();
$("#"+departureCity+" ."+departureTimeSpan).show();
$("#"+departureCity+"WTP").show();
}
}
function setFocus(item) {
switch(item) {
case "DEALS" : {
$("#deals").css("z-index", "2");
$("#hotels").css("z-index", "1");
$("#dealsTab").html("<p>Sale fares to the UK</p>");
$("#hotelsTab").html("<p>View FREE* hotels</p>");
break;
}
case "HOTELS" : {
$("#deals").css("z-index", "1");
$("#hotels").css("z-index", "2");
$("#dealsTab").html("<p>View fares to the UK</p>");
$("#hotelsTab").html("<p>FREE* hotel nights</p>");
break;
}
}
}

