var af_interval, scrollCount = Array(2), scrollInterval = Array(2), currentScroll = Array(Array(0, 0, 0, 0), Array(0, 0, 0, 0)), oldScroll = Array(0, 0), weatherHidden = true, af_top = 5, odd = Array(2), tags = Array("arrivals", "departs"), actionTags = Array(2); section_open = 0; var airfares = 1, airfare_height = 21; $(document).ready(function() { airfares = $("#airfare_wd_list tr").size(); airfare_height = airfares * 21; $("table#airfare_wd_list tr td:nth-child(2)").addClass("alignRight"); $("table#airfare_wd_list tr td:nth-child(3)").addClass("fareType"); for (i = 0; i < 2; i++) { actionTags[i] = "div." + tags[i] + ".Scroll"; var a = ".rTable" + i + " table." + tags[i] + ".homepage tr", b = "div.rTable" + i, c = $(a + ":eq(0)").html(); c = '<div class="' + tags[i] + ' ScrollTop">' + c + "</div>"; var e = ""; $(a + ":eq(1) th").each(function(d) { e += ' \n<div class="c' + d + '">' + $(this).text() + "</div>" }); e = ' \n<div class="' + tags[i] + ' ScrollHead container">' + e + "\n</div>"; var h = $(a).size(), f = ""; for (k = 2; k < h - 1; k++) { var g = ""; $(a + ":eq(" + k + ") td").each(function(d) { g += ' \n<div class="c' + d + '">' + $(this).text() + "</div>" }); f += '\n<div class="' + tags[i] + ' Scroll">' + g + "\n</div>" } f = '\n<div id="scrollup' + i + '">' + f + "\n</div>"; $(b).html(c + e + f + "\n"); odd[i] = SetUpScrollCells(i); $(tags[i]).each(function(d) { $(this).css("top", (d + currentScroll[i]) * 21 + "px") }); ScrollRotate(i); scrollInterval[i] = setInterval("ScrollRotate(" + i + ")", 5E3); af_interval = setInterval(af_rotate, 550); $("#prompt").hover(function() { clearInterval(af_interval) }, function() { }) } $(".showBigWeather").click(function() { toggleWeather(); return false }); $(".weatherSwap_wrapper").click(function() { toggleWeather(); return false }); $("#useHelveticaFont").click(function() { $("body").css("font-family", "'Helvetica Neue'"); return false }); $("#useAvenirFont").click(function() { $("body").css("font-family", "Avenir"); return false }); $("#useArialFont").click(function() { $("body").css("font-family", "Arial"); return false }); $("#useVerdanaFont").click(function() { $("body").css("font-family", "Verdana"); return false }); $("#useTrebuchetFont").click(function() { $("body").css("font-family", "'Trebuchet MS'"); return false }) }); function ScrollRotate(a) { for (k = 0; k < 4; k++) currentScroll[a][k] = (oldScroll[a] + 1 + k) % scrollCount[a]; $(actionTags[a] + ":eq(" + oldScroll[a] + ")").animate({ top: -21 }, "normal", function() { $(this).css("top", "80px") }); for (k = 0; k < 4; k++) $(actionTags[a] + ":eq(" + currentScroll[a][k] + ")").show().animate({ top: 21 * k }, "normal"); fixStripes(a, oldScroll[a]); oldScroll[a] = currentScroll[a][0] } function fixStripes(a, b) { if (odd[a]) $(actionTags[a] + ":eq(" + b + ")").hasClass("alt") ? $(actionTags[a] + ":eq(" + b + ")").removeClass("alt") : $(actionTags[a] + ":eq(" + b + ")").addClass("alt") } function SetUpScrollCells(a) { $(actionTags[a] + ":even").addClass("alt"); $(actionTags[a] + " div").each(function(b) { $(this).addClass("c" + b % 6) }); scrollCount[a] = $(actionTags[a]).size(); return scrollCount[a] % 2 != 0 } function toggleWeather() { if (weatherHidden) { $("div#nav").css({ "z-index": "0" }); $(".weatherSwap").css({ left: "160px", "z-index": "2000" }); $(".weatherSwap_wrapper").css({ position: "absolute", width: "100%", background: "url(images/grey_465359_50.png)", height: "100%", left: "0", top: "0", "z-index": "1000" }) } else { $("div#nav").css("z-index", "1"); $(".weatherSwap").css({ left: "-2000px", "z-index": "0" }); $(".weatherSwap_wrapper").css({ position: "relative", width: "0", background: "none", height: "0", left: "-200px", top: "-170px", "z-index": "0" }) } weatherHidden = !weatherHidden; return false } function af_rotate() { var a = af_top + 1, b = -a; $("table#airfare_wd_list").css("top", b + "px"); af_top = a; if (af_top > airfare_height) af_top = -179 } function SwapTags(a, b, c) { b = RegExp("<s*(/?)s*" + b + "([^>]*)>", "g"); return a.replace(b, "<$1" + c + "$2>") } function cnvrt2Upper(a) { return a.toLowerCase().replace(/\b[a-z]/g, function(b) { return b.toUpperCase() }) } function ltrim(a) { return a.replace(/^\s+/, "") } function rtrim(a) { return a.replace(/\s+$/, "") } function alltrim(a) { return a.replace(/^\s+|\s+$/g, "") };
