var isPickUpFound;var isRequestStopFound;var isSetDownFound;function StoppingPointPanel(A){this.stoppingPointPanelId=A;this.showAllStoppingPoints=false;this.showing=false}StoppingPointPanel.prototype.ShowPanel=function(B,A,C){if(this.stoppingPointPanel==undefined){this.stoppingPointPanel=document.getElementById(this.stoppingPointPanelId);this.stoppingPointPanel.stoppingPointPanelObject=this;this.waitPanel=YAHOO.util.Dom.getElementsByClassName("GettingStoppingPointData",undefined,this.stoppingPointPanel)[0];this.stoppingPointContent=YAHOO.util.Dom.getElementsByClassName("ScrollableContent",undefined,this.stoppingPointPanel)[0];this.stoppingPoints=YAHOO.util.Dom.getElementsByClassName("StoppingPoints",undefined,this.stoppingPointPanel)[0];this.warning=YAHOO.util.Dom.getElementsByClassName("Warning",undefined,this.stoppingPointPanel)[0];this.operators=YAHOO.util.Dom.getElementsByClassName("Operators",undefined,this.stoppingPointPanel)[0];this.icons=YAHOO.util.Dom.getElementsByClassName("Icons",undefined,this.stoppingPointPanel)[0];this.carbonLink=YAHOO.util.Dom.getElementsByClassName("liarrowpr",undefined,this.stoppingPointPanel)[0];this.carbonLinkOriginalhref=this.carbonLink.href;this.panelInfo=YAHOO.util.Dom.getElementsByClassName("PanelInfo",undefined,this.stoppingPointPanel)[0];YAHOO.util.Event.addListener(this.stoppingPointPanel,"click",this.IgnoreMouseClick,this,true)}YAHOO.util.Event.addListener(document,"click",this.MouseClick,this,true);this.service=B;ShowElement(this.stoppingPointPanel,true);if(B.stoppingPoints==undefined){ShowElement(this.waitPanel,true);SetVisibility(this.stoppingPointContent,false)}else{this.ShowStoppingPoints()}YAHOO.util.Dom.setXY(this.stoppingPointPanel,[A-this.stoppingPointPanel.clientWidth,C-this.stoppingPointPanel.clientHeight]);this.showing=true};StoppingPointPanel.prototype.IgnoreMouseClick=function(A){A.cancelBubble=true};StoppingPointPanel.prototype.MouseClick=function(B,A){if(!StillInsideElementOnMouseClick(this,B)){this.HidePanel()}};StoppingPointPanel.prototype.StoppingPointsReceived=function(){if(!this.showing){return }if(this.service.stoppingPoints==undefined){this.HidePanel()}else{this.ShowStoppingPoints()}};StoppingPointPanel.prototype.OnClose=function(B){var A=GetParentWithStyle(B,"PopupPanel");A.stoppingPointPanelObject.HidePanel()};StoppingPointPanel.prototype.OnShowAllStoppingPoints=function(B){var A=GetParentWithStyle(B,"PopupPanel");A.stoppingPointPanelObject.ShowAllStoppingPoints(B.checked)};StoppingPointPanel.prototype.ShowAllStoppingPoints=function(B){this.showAllStoppingPoints=B;var A=GetFirstDiv(this.stoppingPoints);while(A!=undefined){if(A.className=="Stopping"){ShowElement(A,this.showAllStoppingPoints)}A=GetNextDiv(A)}};StoppingPointPanel.prototype.HidePanel=function(){if(this.showing){YAHOO.util.Event.removeListener(document,"click",this.MouseClick);ShowElement(this.stoppingPointPanel,false);this.service=undefined;this.showing=false}};StoppingPointPanel.prototype.ShowStoppingPoints=function(){RemoveAllChildren(this.stoppingPoints);RemoveAllChildren(this.operators);RemoveAllChildren(this.icons);if(this.panelInfo!=undefined){RemoveAllChildren(this.panelInfo)}isPickUpFound=false;isRequestStopFound=false;isSetDownFound=false;this.tocKey=new Object();this.iconKey=new Object();ShowElement(this.waitPanel,false);var A=this.service.stoppingPoints.warning||this.service.isServiceDisrupted;ShowElement(this.warning,A);this.warningBus=YAHOO.util.Dom.getElementsByClassName("WarningBus",undefined,this.stoppingPointPanel)[0];ShowElement(this.warningBus,this.service.stoppingPoints.warning);this.warningDisruptedService=YAHOO.util.Dom.getElementsByClassName("WarningDisruptedService",undefined,this.stoppingPointPanel)[0];ShowElement(this.warningDisruptedService,this.service.isServiceDisrupted);for(var B in this.service.stoppingPoints.serviceLegs){this.AddServiceLeg(this.service.stoppingPoints.serviceLegs[B],this.service)}this.AddInfo(isPickUpFound,isRequestStopFound,isSetDownFound);this.AddKeys();this.UpdateCarbonLink(this.service.mileageInHundredthsOfMile,mixingDeck.journeyPlanningData.data.passengerCount);SetVisibility(this.stoppingPointContent,true)};StoppingPointPanel.prototype.AddServiceLeg=function(G,E){var I=0;var B=new Array(20);for(var A in G.serviceLocations){B[I]=G.serviceLocations[A];I++}B.length=I;B.sort(this.SortStoppingPoints);if(I==0){if(G.sNlc==E.oNlc){messageAppend=" departing at "+FormatTime(G.dTime)}else{if(G.eNlc==E.dNlc){messageAppend=" arriving by "+FormatTime(G.aTime)}else{messageAppend=""}}CreateElement(this.stoppingPoints,"div","Mode",G.mode+" from "+G.sName+" to "+G.eName+messageAppend);if(mixingDeck.displayReservationInfo=="On"&&G.modeType!="W"){var C=CreateElement(this.stoppingPoints,"div","ClearBoth");CreateElement(C,"div","Revinfo",mixingDeck.resourceStrings.reservationinfotext);var H=CreateElement(C,"div","StoppingPanelMoreInfo");if(mixingDeck.resourceStrings.reservationInfoUri!=""){var F="<a class=\"liarrowpr\" target=\"_blank\" href=\""+mixingDeck.resourceStrings.reservationInfoUri+"\"><span class=\"left\">"+mixingDeck.resourceStrings.moreInfo+"</span><span class=\"right\">&nbsp;</span></a>";CreateElement(H,"span","Button",F)}}}else{this.AddHeadings(G);for(var D=0;D<I;D++){if(mixingDeck.displaystationtype==1){if(B[D].StopType=="u"){isPickUpFound=true;if(B[D].station.indexOf(mixingDeck.pickUpOnlyTitle)<=0){B[D].station+=" "+mixingDeck.pickUpOnlyTitle}}else{if(B[D].StopType=="x"){isRequestStopFound=true;if(B[D].station.indexOf(mixingDeck.requestStopTitle)<=0){B[D].station+=" "+mixingDeck.requestStopTitle}}else{if(B[D].StopType=="s"){isSetDownFound=true;if(B[D].station.indexOf(mixingDeck.setDownOnlyTitle)<=0){B[D].station+=" "+mixingDeck.setDownOnlyTitle}}}}}}for(var D=0;D<I;D++){if(D==0){this.AddStartLocation(G,B[D])}else{if(D==I-1){this.AddEndLocation(B[D])}else{this.AddPassingLocation(B[D])}}}this.AddTrainDestinationLine(G)}};StoppingPointPanel.prototype.SortStoppingPoints=function(B,A){if(B.aTime>A.aTime){return 1}else{return -1}};StoppingPointPanel.prototype.AddHeadings=function(A){var D=CreateElement(this.stoppingPoints,"div","Title");if(mixingDeck.disablesleeperservices==1){switch(A.bClass){case"S":case"B":case"F":CreateElement(D,"div","Header",mixingDeck.resourceStrings.sleeperHeaderText.replace(/%tocname%/gi,A.tocDesc));if(A.tocURL!=""){var B=CreateElement(D,"div","SleeperURL");var C="<a class=\"liarrowpr\" target=\"_blank\" href=\""+A.tocURL+"\"><span id=\"btnCarbonClub\" class=\"left\">"+A.tocDesc+"</span><span class=\"right\"></span></a>";CreateElement(B,"span","Button",C)}break}}CreateElement(D,"div","Col1","Station");CreateElement(D,"div","Col2","Arr");CreateElement(D,"div","Col3","Dep");CreateElement(D,"div","Col4","Facilities")};StoppingPointPanel.prototype.AddStartLocation=function(A,D){var C=CreateElement(this.stoppingPoints,"div","Change Start");CreateElement(C,"div","Col1",D.station);CreateElement(C,"div","Col2","&nbsp;");CreateElement(C,"div","Col3",FormatTime(D.dTime));var B=CreateElement(C,"div","Col4",A.tocCode);if(A.tocCode){B.title=A.tocDesc;this.tocKey[A.tocCode]=A.tocDesc}this.AddFacilitiesIcons(A,C)};StoppingPointPanel.prototype.AddEndLocation=function(B){var A=CreateElement(this.stoppingPoints,"div","Change");CreateElement(A,"div","Col1",B.station);CreateElement(A,"div","Col2",FormatTime(B.aTime))};StoppingPointPanel.prototype.AddPassingLocation=function(B){var A=CreateElement(this.stoppingPoints,"div","Stopping");CreateElement(A,"div","Col1",B.station);CreateElement(A,"div","Col2",FormatTime(B.aTime));CreateElement(A,"div","Col3",FormatTime(B.dTime));ShowElement(A,this.showAllStoppingPoints)};StoppingPointPanel.prototype.AddTrainDestinationLine=function(A){if(A.dName==undefined){return }if(A.dName==A.eName){CreateElement(this.stoppingPoints,"div","Info",A.mode+" terminates at "+A.dName)}else{CreateElement(this.stoppingPoints,"div","Info",A.mode+" continues to "+A.dName)}};StoppingPointPanel.prototype.AddFacilitiesIcons=function(A,B){var C=CreateElement(B,"div","FacilityIcons");if(A.modeType=="B"){this.AddIcon(C,"BUS")}else{if(A.modeType=="F"){this.AddIcon(C,"FERRY")}}switch(A.rsv){case"A":case"R":case"S":case"B":this.AddIcon(C,"R"+A.rsv);break}switch(A.sClass){case"B":case"F":this.AddIcon(C,"S"+A.sClass);break}switch(A.bClass){case"S":case"B":case"F":this.AddIcon(C,"B"+A.bClass);break}for(cateringCodeId in A.cater){this.AddIcon(C,"C"+A.cater[cateringCodeId])}if((A.modeType=="_")&&(A.showWiFiIcon=="1")){this.AddIcon(C,"WF")}if(mixingDeck.isServiceDisruptedEnable==1){if(A.isServiceDisrupted){this.AddIcon(C,"DISRUPTED")}}};StoppingPointPanel.prototype.AddIcon=function(C,B){var A=CreateElement(C,"img");A.src=ImagePath+"TrainIcons/"+B+".gif";A.alt=trainIconDescriptions[B];A.title=trainIconDescriptions[B];this.iconKey[B]=trainIconDescriptions[B]};StoppingPointPanel.prototype.AddKeys=function(){for(var C in this.tocKey){var B=CreateElement(this.operators,"div");CreateElement(B,"div","OperatorKey",C);CreateElement(B,"div","Operator",this.tocKey[C])}for(C in this.iconKey){var D=CreateElement(this.icons,"div");var A=CreateElement(D,"div","Icon");this.AddIcon(A,C);CreateElement(D,"div","IconDescription",this.iconKey[C])}};StoppingPointPanel.prototype.UpdateCarbonLink=function(B,A){this.carbonLink.href=this.carbonLinkOriginalhref.replace("{0}",Math.floor(B/100)).replace("{1}",A)};StoppingPointPanel.prototype.AddInfo=function(E,D,F){if(E||F||D){if(E){var C=CreateElement(this.panelInfo,"div","ClearBoth");var A=CreateElement(C,"div","Operators");CreateElement(A,"div","OperatorKey",mixingDeck.pickUpOnlyTitle);CreateElement(A,"div","Operator",mixingDeck.pickUpOnlyDesc);if(D){var B=CreateElement(this.panelInfo,"div","Icons");CreateElement(B,"div","Icon",mixingDeck.requestStopTitle);CreateElement(B,"div","IconDescription",mixingDeck.requestStopDesc);if(F){var C=CreateElement(this.panelInfo,"div","ClearBoth");var A=CreateElement(C,"div","Operators");CreateElement(A,"div","OperatorKey",mixingDeck.setDownOnlyTitle);CreateElement(A,"div","Operator",mixingDeck.setDownOnlyDesc)}}else{if(F){var B=CreateElement(this.panelInfo,"div","Icons");CreateElement(B,"div","Icon",mixingDeck.setDownOnlyTitle);CreateElement(B,"div","IconDescription",mixingDeck.setDownOnlyDesc)}}}else{if(D){var C=CreateElement(this.panelInfo,"div","ClearBoth");var A=CreateElement(C,"div","Operators");CreateElement(A,"div","OperatorKey",mixingDeck.requestStopTitle);CreateElement(A,"div","Operator",mixingDeck.requestStopDesc);if(F){var B=CreateElement(this.panelInfo,"div","Icons");CreateElement(B,"div","Icon",mixingDeck.setDownOnlyTitle);CreateElement(B,"div","IconDescription",mixingDeck.setDownOnlyDesc)}}else{var C=CreateElement(this.panelInfo,"div","ClearBoth");var A=CreateElement(C,"div","Operators");CreateElement(A,"div","OperatorKey",mixingDeck.setDownOnlyTitle);CreateElement(A,"div","Operator",mixingDeck.setDownOnlyDesc)}}}}
