function updateTimetableAirports(B,A){if(A){RouteService.updateRoutes(B,function(C){updateAirportSelect("destinationSelect",C.destinationAirports);setFlightDateRange("departureSelect","destinationSelect",C.dateRanges)})}else{RouteService.updateRoutes(B,function(C){updateAirportSelect("departureSelect",C.destinationAirports);setFlightDateRange("destinationSelect","departureSelect",C.dateRanges)})}}function updateAirportSelect(A,G){var F=DWRUtil.getValue(A);DWRUtil.removeAllOptions(A);if(G==null){return }var E=$(A);for(var D=0;D<G.length;D++){var H=DWRUtil._getValueFrom(G[D],"airportName");var B=DWRUtil._getValueFrom(G[D],"airportCode");H=H+" ("+B+")";if(H||B){var C=new Option(H,B);E.options[E.options.length]=C}}DWRUtil.setValue(A,F)}function setFlightDateRange(D,B,C){var E=DWRUtil.getValue(D);var A=DWRUtil.getValue(B);flightDateRange=C.find(function(F){return F.departureAirportCode==E&&F.destinationAirportCode==A})}function isDateDisabled(B){if(flightDateRange){var A=flightDateRange;if((A.startDate&&B<A.startDate)||(A.endDate&&B>A.endDate)){return true}}return false}function showTrip(D,I,C,H,B,J,K,A,G){var F=D+"?searchCriteriaBean.departureAirportCode="+I+"&searchCriteriaBean.destinationAirportCode="+C+"&searchCriteriaBean.departureDate="+H+"&searchCriteriaBean.returnDate="+B+"&flightIndex="+J+"&dateIndex="+K+"&outbound="+A;var E=getPopupDimensions();showPopup("tripSummary",F,E.width,E.height)}function hideTrip(){new Effect.Fade($("tripSummary"),{duration:0.4})}function showPopup(E,D,F,A){var B=$(E);var C=$("waitImage");if(B.style.display!="none"){B.hide()}positionInCentre(C,75,12);C.show();Event.observe(B,"load",function(){C.hide();if(!Prototype.Browser.WebKit){positionInCentre(B,F,A);new Effect.Appear(B,{duration:0.4})}});if(Prototype.Browser.WebKit){positionInCentre(B,F,A);B.show()}frames[E].location=D}function getPopupDimensions(){if(Prototype.Browser.IE){if(window.XMLHttpRequest){return{width:582,height:510}}else{return{width:580,height:490}}}else{if(Prototype.Browser.Gecko){return{width:582,height:479}}else{return{width:582,height:464}}}}function positionInCentre(B,E,H){var D=new WindowDimensions();var G=D.windowWidth/2;var F=(D.windowHeight/2)+D.scrollOffsetY;var A=G-(E/2);var C=F-(H/2);B.setStyle({position:"absolute",top:C+"px",left:A+"px",width:E+"px",height:H+"px"})}function WindowDimensions(){var C=0,D=0;if(typeof (window.innerWidth)=="number"){C=window.innerWidth;D=window.innerHeight}else{if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){C=document.documentElement.clientWidth;D=document.documentElement.clientHeight}else{if(document.body&&(document.body.clientWidth||document.body.clientHeight)){C=document.body.clientWidth;D=document.body.clientHeight}}}this.windowWidth=C;this.windowHeight=D;var B=0,A=0;if(typeof (window.pageYOffset)=="number"){A=window.pageYOffset;B=window.pageXOffset}else{if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){A=document.body.scrollTop;B=document.body.scrollLeft}else{if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){A=document.documentElement.scrollTop;B=document.documentElement.scrollLeft}}}this.scrollOffsetX=B;this.scrollOffsetY=A};
