function silentErrorHandler(){return!0}window.onerror=silentErrorHandler;
(function(a){var g=(a.browser.msie?"paste":"input")+".mask",c=void 0!=window.orientation;a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},dataName:"rawMaskFn"};a.fn.extend({caret:function(b,a){if(0!=this.length){if("number"==typeof b)return a="number"==typeof a?a:b,this.each(function(){if(this.setSelectionRange)this.setSelectionRange(b,a);else if(this.createTextRange){var c=this.createTextRange();c.collapse(!0);c.moveEnd("character",a);c.moveStart("character",b);c.select()}});if(this[0].setSelectionRange)b=
this[0].selectionStart,a=this[0].selectionEnd;else if(document.selection&&document.selection.createRange){var c=document.selection.createRange();b=0-c.duplicate().moveStart("character",-1E5);a=b+c.text.length}return{begin:b,end:a}}},unmask:function(){return this.trigger("unmask")},mask:function(b,h){if(!b&&0<this.length)return a(this[0]).data(a.mask.dataName)();var h=a.extend({placeholder:"_",completed:null},h),d=a.mask.definitions,e=[],i=b.length,o=null,k=b.length;a.each(b.split(""),function(b,a){"?"==
a?(k--,i=b):d[a]?(e.push(RegExp(d[a])),null==o&&(o=e.length-1)):e.push(null)});return this.trigger("unmask").each(function(){function m(b){for(var a=f.val(),n=-1,c=0,d=0;c<k;c++)if(e[c]){for(j[c]=h.placeholder;d++<a.length;){var g=a.charAt(d-1);if(e[c].test(g)){j[c]=g;n=c;break}}if(d>a.length)break}else j[c]==a.charAt(d)&&c!=i&&(d++,n=c);if(!b&&n+1<i)f.val(""),q(0,k);else if(b||n+1>=i)p(),b||f.val(f.val().substring(0,n+1));return i?c:o}function p(){return f.val(j.join("")).val()}function q(a,b){for(var c=
a;c<b&&c<k;c++)e[c]&&(j[c]=h.placeholder)}function t(a){var b=a.which,c=f.caret();if(a.ctrlKey||a.altKey||a.metaKey||32>b)return!0;if(b){0!=c.end-c.begin&&(q(c.begin,c.end),s(c.begin,c.end-1));a=l(c.begin-1);if(a<k&&(b=String.fromCharCode(b),e[a].test(b))){for(var c=a,d=h.placeholder;c<k;c++)if(e[c]){var g=l(c),i=j[c];j[c]=d;if(g<k&&e[g].test(i))d=i;else break}j[a]=b;p();a=l(a);f.caret(a);h.completed&&a>=k&&h.completed.call(f)}return!1}}function u(a){a=a.which;if(8==a||46==a||c&&127==a){var b=f.caret(),
d=b.begin,b=b.end;if(0==b-d){if(46!=a)for(;0<=--d&&!e[d];);else d=b=l(d-1);b=46==a?l(b):b}q(d,b);s(d,b-1);return!1}if(27==a)return f.val(r),f.caret(0,m()),!1}function s(a,b){if(!(0>a)){for(var c=a,d=l(b);c<k;c++)if(e[c]){if(d<k&&e[c].test(j[d]))j[c]=j[d],j[d]=h.placeholder;else break;d=l(d)}p();f.caret(Math.max(o,a))}}function l(a){for(;++a<=k&&!e[a];);return a}var f=a(this),j=a.map(b.split(""),function(a){if("?"!=a)return d[a]?h.placeholder:a}),r=f.val();f.data(a.mask.dataName,function(){return a.map(j,
function(a,b){return e[b]&&a!=h.placeholder?a:null}).join("")});f.attr("readonly")||f.one("unmask",function(){f.unbind(".mask").removeData(a.mask.dataName)}).bind("focus.mask",function(){r=f.val();var c=m();p();var d=function(){c==b.length?f.caret(0,c):f.caret(c)};(a.browser.msie?d:function(){setTimeout(d,0)})()}).bind("blur.mask",function(){m();f.val()!=r&&f.change()}).bind("keydown.mask",u).bind("keypress.mask",t).bind(g,function(){setTimeout(function(){f.caret(m(!0))},0)});m()})}})})(jQuery);
navigator.userAgent.toLowerCase().match("chrome")&&jQuery("body").addClass("chrome");
var updateAirportSelect=function(a,g){"departureSelect"==a&&(toUpdate=jQuery("#dep"));"destinationSelect"==a&&(toUpdate=jQuery("#dest"));jQuery(toUpdate).html("");var c=null,c={},b;for(b in airportzones)c[b]=[];for(b in g)if(g[b].n){var h=g[b].n,d=g[b].c,e=[];e.push(h);e.push(d);airportzones[airports[d]]?c[airports[d]].push(e):c.XX.push(e)}airportDetailsArray=[];for(var i in c){1<=c[i].length&&(thisAirportDetailsSubArray=[],thisAirportDetailsSubArray.push("country"),thisAirportDetailsSubArray.push(airportzones[i]),
airportDetailsArray.push(thisAirportDetailsSubArray));for(var e in c[i])c[i][e].constructor==Array&&(thisAirportDetailsSubArray=[],thisAirportDetailsSubArray.push("airport"),thisAirportDetailsSubArray.push(c[i][e][0]),thisAirportDetailsSubArray.push(c[i][e][1]),airportDetailsArray.push(thisAirportDetailsSubArray))}d=airportDetailsArray.length;c=5;"destinationSelect"==a&&(c=4);24>d&&(c=3);18>d&&(c=2);10>d&&(c=1);h=Math.ceil(d/c);b=0;for(columns=[];b<=c-1;)columns[b]=[],b++;splitLocations=[];for(b=
0;b<=d;)splitLocations.push(b),b+=h;slicedAirports=[];for(b=0;b<c;)startSlice=splitLocations[b],d=startSlice+h,b++,thisSlice=airportDetailsArray.slice(startSlice,d),slicedAirports.push(thisSlice);for(b=0;b<c;)"country"==slicedAirports[b][slicedAirports[b].length-1][0]&&(countryToMove=slicedAirports[b].pop(),iPlus=b+1,slicedAirports[iPlus].unshift(countryToMove)),b++;domColumns=[];for(b=0;b<slicedAirports.length;)domColumns[b]=jQuery('<ul class="airportColumn"></ul>'),b++;for(b=0;b<c;){thisSliceLength=
slicedAirports[b].length;for(v=0;v<thisSliceLength;)"country"==slicedAirports[b][v][0]&&(thisLI='<li class="country">'+slicedAirports[b][v][1]+"</li>"),"airport"==slicedAirports[b][v][0]&&(thisLI='<li class="airport airportlist '+slicedAirports[b][v][2]+'"> <a href="#" onClick="javascript:selectAirport(\''+a+"', '"+slicedAirports[b][v][2]+"', '"+slicedAirports[b][v][1]+"'); return false;\" >"+slicedAirports[b][v][1]+"</a></li>"),jQuery(thisLI).appendTo(domColumns[b]),v++;b++}for(b=0;b<c;)jQuery(domColumns[b]).appendTo(toUpdate),
b++;if((isMSIE6||isMSIE7)&&"destinationSelect"==a)megaWidth=180*c,jQuery("#destWrapper").css("width",megaWidth)};
function selectAirport(a,g,c){"departureSelect"==a&&(elementToUpdate="destinationSelect",elementtoUpdateJQ=jQuery("#departureSelect"),textElementToUpdate=jQuery("#selectedDep"),closeMega("dep"),openMega("dest"));"destinationSelect"==a&&(elementToUpdate="departureSelect",elementtoUpdateJQ=jQuery("#destinationSelect"),textElementToUpdate=jQuery("#selectedDest"),closeMega("dest"));"departureSelect"==a&&RouteService.getRoutesForDepartureAirport(g,function(a){updateAirportSelect(elementToUpdate,a.destinationAirports,
g)});jQuery(elementtoUpdateJQ).val(g);jQuery(elementtoUpdateJQ).change();jQuery(textElementToUpdate).html(c)}try{document.execCommand("BackgroundImageCache",!1,!0)}catch(exception){}
jQuery(document).ready(function(){jQuery("#departureDate").datepicker({inline:!1,dateFormat:"dd/mm/yy",numberOfMonths:3,minDate:0,showAnim:"",showOn:"focus",maxDate:"1y",onSelect:function(a,g){departureSelect(a,g)}});jQuery("#returnDate").datepicker({inline:!1,dateFormat:"dd/mm/yy",numberOfMonths:3,minDate:0,showOn:"focus",maxDate:"1y",showAnim:"",onSelect:function(a,g){returnSelect(a,g)}})});
var setDropDownDates=function(a){jQuery("#"+a).datepicker("option",{minDate:calendarStartDate,maxDate:calendarEndDate});"returnDate"==a&&(currentDepartDateValue=jQuery("#departureDate").val(),("dd/mm/yyyy"==currentDepartDateValue||""==currentDepartDateValue)&&jQuery("#departureDate").focus())};
function departureSelect(a){jQuery("#returnDate").datepicker("option","minDate",a);jQuery("#returnFlight").is(":checked")&&""==jQuery("#returnDate").val()&&(jQuery("#returnDate").datepicker("show"),jQuery("#returnDate").datepicker("redraw"))}function returnSelect(a){jQuery("#departureDate").datepicker("option","maxDate",a)}jQuery("#clearAirportSelection").live("click",function(){clearMega()});
function clearMega(){selectAirport("destinationSelect","","Flying to&hellip;");selectAirport("departureSelect","","Flying from&hellip;");closeMega("dep");closeMega("dest");jQuery("#departureDate").val("Departure date\u2026");jQuery("#returnDate").val("Return date\u2026");jQuery("#numberOfInfants, #numberOfChildren").val("0");jQuery("#numberOfAdults").val("1");jQuery("#numberOfInfants, #numberOfChildren, #numberOfAdults").change()}jQuery(document).ready(function(){clearMega()});
var megaDepIsOpen=!1,megaDestIsOpen=!1;jQuery("#openDep").click(function(){""!=jQuery("#destinationSelect").val()&&selectAirport("dest","","Flying to&hellip;");openMega("dep")});jQuery("#openDest").click(function(){""!=jQuery("#departureSelect").val()?openMega("dest"):alert("Please select your departure before selecting your destination.")});
var openMega=function(a){"dep"==a&&megaDestIsOpen&&jQuery("#destWrapper").hide();"dest"==a&&megaDepIsOpen&&jQuery("#depWrapper").hide();"dep"==a&&(jMega=jQuery("#depWrapper"),megaDepIsOpen=!0);"dest"==a&&(jMega=jQuery("#destWrapper"),megaDestIsOpen=!0);!0==isMSIE6&&jQuery("#numberOfAdults, #numberOfChildren, #numberOfInfants").hide();jQuery(jMega).fadeTo("medium",0.99);isMSIE6||("dep"==a&&jQuery("#selectedDep").addClass("whiteFillInput"),"dest"==a&&jQuery("#selectedDest").addClass("whiteFillInput"))},
closeMega=function(a){isMSIE6||("dep"==a&&jQuery("#selectedDep").removeClass("whiteFillInput"),"dest"==a&&jQuery("#selectedDest").removeClass("whiteFillInput"));"dep"==a&&(jMega=jQuery("#depWrapper"),megaDepIsOpen=!1);"dest"==a&&(jMega=jQuery("#destWrapper"),megaDestIsOpen=!1);!0==isMSIE6&&jQuery("#numberOfAdults, #numberOfChildren, #numberOfInfants").show();jQuery(jMega).hide()};
jQuery(document).ready(function(){var a=!1;jQuery("#depWrapper, #destWrapper").hover(function(){a=!0},function(){a=!1});jQuery("body").mouseup(function(){!a&&megaDestIsOpen&&closeMega("dest");!a&&megaDepIsOpen&&closeMega("dep")})});jQuery("#dep .airport").live("mouseenter",function(){thisHover=jQuery(this).text();jQuery("#flyingFrom").text(thisHover)}).live("mouseleave",function(){jQuery("#flyingFrom").text("")});
jQuery("#dest .airport").live("mouseenter",function(){thisHover=jQuery(this).text();jQuery("#flyingTo").text(thisHover)}).live("mouseleave",function(){jQuery("#flyingTo").text("")});
jQuery("#singleFlight, #returnFlight").click(function(){jQuery("#singleFlight").attr("checked")?(jQuery("#returnDate").attr("disabled",!0),jQuery("#returnDate").datepicker("disable"),jQuery("#returnDate").val("---"),jQuery("#returnDate").css("background-image","url(/images/icons/calendarDesat.png)")):(jQuery("#returnDate").removeAttr("disabled"),jQuery("#returnDate").datepicker("enable"),jQuery("#returnDate").val("Return date\u2026"),jQuery("#returnDate").css("background-image","url(/images/icons/calendar.png)"))});
jQuery(document).ready(function(){jQuery("#departureDate").mask("99/99/9999");jQuery("#departureDate").val("Departure date\u2026");jQuery("#returnDate").mask("99/99/9999");jQuery("#returnDate").val("Return date\u2026")});populatePassengerNumbers();initAirportsFromList("departureSelect","destinationSelect");
