function FilterPanel(A,B){this.filterPanelId=A;this.timetablesOnly=B}FilterPanel.prototype.Initialise=function(){if(this.filterPanel==undefined){this.filterPanel=document.getElementById(this.filterPanelId);this.chkShowStandard=document.getElementById(mixingDeck.chkShowStandardId);this.chkShowFirstClass=document.getElementById(mixingDeck.chkShowFirstClassId);this.rdoPromotionalFaresOnly=document.getElementById(mixingDeck.rdoPromotionalFaresOnly);this.rdoNoFlexibility=document.getElementById(mixingDeck.rdoNoFlexibility);this.rdoMoreFlexibility=document.getElementById(mixingDeck.rdoMoreFlexibility);this.rdoShowAllFares=document.getElementById(mixingDeck.rdoShowAllFares);this.chkShowItsoSmartCard=document.getElementById(mixingDeck.chkShowItsoSmartCardId);this.showSlower=YAHOO.util.Dom.getElementsByClassName("ShowSlower",undefined,this.filterPanel)[0]}};FilterPanel.prototype.SetClassAndFlexibility=function(C,B){this.Initialise();if(C=="S"){this.chkShowStandard.checked=true}else{if(C=="1"){this.chkShowFirstClass.checked=true}else{this.chkShowStandard.checked=true;this.chkShowFirstClass.checked=true}}var A;if(this.rdoNoFlexibility.checked){A=1}else{if(this.rdoMoreFlexibility.checked){A=2}else{A=3}}if(B=="N"){A=Math.max(A,1)}else{if(B=="P"){A=Math.max(A,2)}else{A=Math.max(A,3)}}if(this.rdoPromotionalFaresOnly){this.rdoPromotionalFaresOnly.checked=false}this.rdoNoFlexibility.checked=(A==1);this.rdoMoreFlexibility.checked=(A==2);this.rdoShowAllFares.checked=(A==3);mixingDeck.SetFlexibility(A);mixingDeck.ShowFirst(this.chkShowFirstClass.checked);mixingDeck.ShowStandard(this.chkShowStandard.checked);if(this.chkShowItsoSmartCard!=null){mixingDeck.ShowOnlySmartCardFares(this.chkShowItsoSmartCard.checked)}mixingDeck.UpdateFilter()};FilterPanel.prototype.SetVisibilityOfFlexibilityButtons=function(A,B){var C=false;var E=false;if(A){for(var F in A){C=C||(A[F].flex=="N");E=E||(A[F].flex=="P")}}if(B){for(var D in B){C=C||(B[D].flex=="N");E=E||(B[D].flex=="P")}}this.rdoNoFlexibility.disabled=!C;this.rdoMoreFlexibility.disabled=!E};FilterPanel.prototype.Show=function(A,B){this.Initialise();ShowElement(this.filterPanel,A);if(A){if(B){YAHOO.util.Dom.setY(this.filterPanel,B)}this.EnsureDocumentIsLargeEnough()}};FilterPanel.prototype.ToggleSlowerRoutes=function(){var A=this.GetSlowerRoutesDiv();if(A.style.display=="block"){this.HideSlowerRoutes()}else{this.ShowSlowerRoutes()}this.EnsureDocumentIsLargeEnough()};FilterPanel.prototype.EnsureDocumentIsLargeEnough=function(){if(mixingDeck.journeyPlanningData==undefined||!mixingDeck.journeyPlanningData.data.isReturn){var A=YAHOO.util.Dom.getRegion(this.filterPanel);document.body.style.height="";document.body.style.height=Math.max(document.body.clientHeight,A.bottom+100)+"px"}else{if(this.timetablesOnly==undefined){mixingDeck.MoveLowestFareFinder()}}};FilterPanel.prototype.ShowSlowerRoutes=function(){SetWTButtonText(this.GetShowSlowerRoutesButton(),mixingDeck.resourceStrings.hideSlower);var A=this.GetSlowerRoutesDiv();this.SetRoutes();A.style.display="block"};FilterPanel.prototype.HideSlowerRoutes=function(){SetWTButtonText(this.GetShowSlowerRoutesButton(),mixingDeck.resourceStrings.showSlower);var A=this.GetSlowerRoutesDiv();A.style.display="none"};FilterPanel.prototype.SetIsPromotion=function(A){ShowElement(document.getElementById("promotionFilter"),(A==true))};FilterPanel.prototype.SetRoutes=function(B){if(B!=undefined){this.routes=B}this.ClearRoutes();var A=false;var E=0;for(var D in this.routes){E++;this.AddRoute(D,this.routes[D]);A=A||this.routes[D].isQueried}if(E==1){ShowElement(this.showSlower,false)}if(A){SetWTButtonText(this.GetShowSlowerRoutesButton(),mixingDeck.resourceStrings.hideSlower);var C=this.GetSlowerRoutesDiv();C.style.display="block"}if(mixingDeck.showFastestRouteChk==1){var F=document.getElementById("showFastest");var G=this.GetRouteCheckbox(F);G.checked=true}};FilterPanel.prototype.ClearRoutes=function(){var A=document.getElementById("serviceRoutes");var B=GetFirstDiv(A);while(B.nextSibling!=undefined){A.removeChild(B.nextSibling)}};FilterPanel.prototype.AddRoute=function(D,B){var H=document.getElementById("showFastest");var C=H.cloneNode(true);C.id="";var A=document.getElementById("serviceRoutes");A.appendChild(C);var E=GetFirstElement(C,"SPAN");var F=GetFirstElement(E,"INPUT");var G=GetFirstElement(E,"LABEL");F.id="Route"+D;F.name=F.id;F.checked=B.isQueried;G.htmlFor=F.id;G.innerHTML=B.routeDesc;F.route=D};FilterPanel.prototype.OnRouteClicked=function(B){if(mixingDeck.forceSlowerRoutePlan==1){return }if(!B.checked){return }var D=document.getElementById("showFastest");var E=this.GetRouteCheckbox(D);if(E!=B){E.checked=false}else{var A=document.getElementById("serviceRoutes");A=GetFirstDiv(A);for(var C=GetNextDiv(A);C!=undefined;C=GetNextDiv(C)){E=this.GetRouteCheckbox(C);if(E!=B){E.checked=false}}}};FilterPanel.prototype.GetRouteCheckbox=function(B){var A=GetFirstElement(B,"SPAN");return GetFirstElement(A,"INPUT")};FilterPanel.prototype.OnUpdate=function(){var B=document.getElementById(mixingDeck.hdnRouteCodes);B.value="";var D=document.getElementById("showFastest");var E=this.GetRouteCheckbox(D);if(mixingDeck.forceSlowerRoutePlan==1&&E.checked){B.value=" ,"}var A=document.getElementById("serviceRoutes");A=GetFirstDiv(A);for(var C=GetNextDiv(A);C!=undefined;C=GetNextDiv(C)){E=this.GetRouteCheckbox(C);if(E.checked){B.value+=E.route+","}}};FilterPanel.prototype.GetSlowerRoutesDiv=function(){if(this.divSlowerRoutes==undefined){this.divSlowerRoutes=document.getElementById("slowerRoutes")}return this.divSlowerRoutes};FilterPanel.prototype.GetShowSlowerRoutesButton=function(){this.Initialise();if(this.showSlowerRoutesButton==undefined){this.showSlowerRoutesButton=YAHOO.util.Dom.getElementsByClassName("liarrowpr","A",this.filterPanel)[0]}return this.showSlowerRoutesButton};FilterPanel.prototype.UpdateTicketClass=function(A){if(this.chkShowStandard==A){mixingDeck.ShowStandard(this.chkShowStandard.checked);if(!this.chkShowStandard.checked&&!this.chkShowFirstClass.checked){this.chkShowFirstClass.checked=true;mixingDeck.ShowFirst(this.chkShowFirstClass.checked)}}else{mixingDeck.ShowFirst(this.chkShowFirstClass.checked);if(!this.chkShowStandard.checked&&!this.chkShowFirstClass.checked){this.chkShowStandard.checked=true;mixingDeck.ShowStandard(this.chkShowStandard.checked)}}mixingDeck.UpdateFilter()};FilterPanel.prototype.UpdateOnlySmartcardFares=function(A){if(this.chkShowItsoSmartCard==A){mixingDeck.ShowOnlySmartCardFares(this.chkShowItsoSmartCard.checked)}mixingDeck.UpdateFilter()}