(function(B){function A(C){return C&&C.constructor===Number?C+"px":C}B.fn.bgiframe=B.browser.msie&&/msie 6\.0/i.test(navigator.userAgent)?function(D){D=B.extend({top:"auto",left:"auto",width:"auto",height:"auto",opacity:!0,src:"javascript:false;"},D);var C='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+D.src+'"style="display:block;position:absolute;z-index:-1;'+(D.opacity!==!1?"filter:Alpha(Opacity='0');":"")+"top:"+(D.top=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+'px')":A(D.top))+";left:"+(D.left=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+'px')":A(D.left))+";width:"+(D.width=="auto"?"expression(this.parentNode.offsetWidth+'px')":A(D.width))+";height:"+(D.height=="auto"?"expression(this.parentNode.offsetHeight+'px')":A(D.height))+';"/>';return this.each(function(){B(this).children("iframe.bgiframe").length===0&&this.insertBefore(document.createElement(C),this.firstChild)})}:function(){return this},B.fn.bgIframe=B.fn.bgiframe})(jQuery);(function(){FC.hasIE=$.browser.msie;FC.hasIE6=($.browser.msie&&$.browser.version.substr(0,1)=="6");FC.hasLteIE6=($.browser.msie&&$.browser.version<7)})();var sp={keyDownTimeout:10,postcodeMessageTimeout:1000,maxItems:15,defaultFeed:"http://ojp.nationalrail.co.uk/find/stations/",defaultDLRLUFeed:"http://ojp.nationalrail.co.uk/find/stationsDLRLU/",postcodeFeed:"http://ojp.nationalrail.co.uk/find/validatePostcode/",currentInput:null,currentInputOptions:[],currentInputIndex:0,currentListIndex:0,keyDownTimer:"",blurTimer:"",postcodeMessageTimer:"",inList:false,$picker:null,hasInit:false,cache:{},DLRLUcache:{},init:function(){if(this.hasInit){return false}this.$picker=$("#picker");this.$picker.click(function(D){var C=$.browser.msie;var B=C?D.target.parentElement:D.target.parentNode;var A=C?B.tagName:B.localName;if(A.toLowerCase()==="li"){sp.selectItem(B)}else{if(A.toLowerCase()==="ul"){sp.selectItem(D.target)}}});$(window).bind("blur",function(A){if(sp.$picker.hasClass("sp-visible")){sp.listSelect("CLEAR")}});this.hasInit=true},addInputSet:function(A){if(!A.from.length){return false}A.from.data("inputOptionsIndex",this.currentInputOptions.length);this.setUpInput(A.from);if(!A.to){A.single=true}else{A.single=false;A.to.data("inputOptionsIndex",this.currentInputOptions.length);this.setUpInput(A.to)}if(!A.dataURL){A.dataURL=A.useDLRLU?this.defaultDLRLUFeed:this.defaultFeed}if(A.useUserStations){A.userStations=this.parseFavorites()}else{A.userStations=false}this.currentInputOptions[this.currentInputOptions.length]=A;A=null},setUpInput:function(C){var A=C.attr("stype");C.attr("autocomplete","off").attr("spellcheck","false");if(C.outerHeight()){C.next("span").css("height",(C.outerHeight()-2).toString()+"px")}if(A){var B=16;if(A=="dlrlu"){B=40}if(A=="dlr"){B=22}this.setIcon(C,A,B)}C.focus(function(D){var E=C.offset();clearTimeout(sp.blurTimer);if(sp.currentInput){sp.listSelect("CLEAR");sp.currentInput.parent().removeClass("sp-hasfocus")}sp.currentInputIndex=C.data("inputOptionsIndex");sp.currentInput=C;sp.$picker.css("top",(E.top+C.height()+7).toString()+"px");sp.$picker.css("left",(E.left-1).toString()+"px");sp.$picker.css("min-width",(C.parent().width()-20).toString()+"px");if(sp.getCurrentInput("OPTIONS").useDLRLU){sp.$picker.find("#je").css("max-width",(C.parent().width()-20).toString()+"px")}if(sp.getCurrentInput("OPTIONS").usePostcodes){$("#sp-p2pad").show().prev("li").show().prev("hr").show();if(sp.getCurrentInput("OTHER").getAttribute("stype")==="pc"){$("#sp-p2pad").hide().prev("li").hide().prev("hr").hide()}}else{$("#sp-p2pad").hide().prev("li").hide().prev("hr").hide()}sp.$picker[0].className="sp-visible loading";C.parent().addClass("sp-hasfocus");if(!C.data("focused")){sp.removeIcon(sp.currentInput);sp.$picker[0].className="sp-visible";C.data("focused",true)}else{if(C.val().length<1){sp.$picker[0].className="sp-visible"}else{clearTimeout(sp.keyDownTimer);sp.keyDownTimer=setTimeout(sp.keyDownTimerHandler,sp.keyDownTimeout)}}E=null});C.blur(function(D){sp.blurTimer=setTimeout(sp.blurTimerHandler,150,[sp.currentInput]);sp.currentListIndex=0});C.bind("keydown",function(D){switch(D.keyCode){case 38:D.preventDefault();sp.deselectItem();sp.listSelect("UP");break;case 40:D.preventDefault();sp.deselectItem();sp.listSelect("DOWN");break;case 9:if(sp.inList){sp.listSelect("SELECT")}else{if(sp.currentInput.val().length>0){sp.listSelect("AUTO-SELECT")}}break;case 13:D.preventDefault();if(sp.inList){sp.listSelect("SELECT")}else{if(sp.currentInput.val().length>0){sp.listSelect("AUTO-SELECT")}}break;case 27:sp.$picker[0].className="";break;default:sp.deselectItem();clearTimeout(sp.keyDownTimer);sp.keyDownTimer=setTimeout(sp.keyDownTimerHandler,sp.keyDownTimeout);break}})},blurTimerHandler:function(A){if(!sp.$picker.hasClass("j-error")){sp.$picker[0].className=""}if(sp.currentInput){sp.currentInput.parent().removeClass("sp-hasfocus")}sp.currentInput=false},keyDownTimerHandler:function(){if(!sp.currentInput){return false}var B=$.trim(sp.currentInput.val().toLowerCase());var C=sp.getCurrentInput("OPTIONS");var A=sp.getCurrentInput("CACHE");sp.listSelect("CLEAR");switch(B.length){case 0:sp.$picker[0].className="sp-visible";break;case 1:if(!A[B]){sp.sendOjpRequest(B.charAt(0));break}default:if(/[0-9]/.test(B)){sp.checkPostCode();break}if(!A[B.charAt(0)]){sp.sendOjpRequest(B.charAt(0))}else{sp.queryCache(B)}break}},listSelect:function(D){var G;var A;var F;if(this.currentInput&&this.currentInput.val().length>0){G=this.getCurrentList()}else{G=$("#d")}A=G.children();F=A.length;if(this.hasAnyClass(A.get(this.currentListIndex))){if(A.get(this.currentListIndex).className==="sel"){A.get(this.currentListIndex).className=""}}if(A.length===0){return false}switch(D){case"UP":if(this.inList){this.currentListIndex--;if(this.hasAnyClass(A.get(this.currentListIndex))){this.currentListIndex--}if(this.currentListIndex<0){this.currentListIndex=F-1}if(this.hasAnyClass(A.get(this.currentListIndex))){this.currentListIndex--}}else{this.inList=true;this.currentListIndex=F-1;if(this.hasAnyClass(A.get(this.currentListIndex))){this.currentListIndex--}}A.get(this.currentListIndex).className="sel";break;case"DOWN":if(this.inList){this.currentListIndex++;if(this.hasAnyClass(A.get(this.currentListIndex))){this.currentListIndex++}if(this.currentListIndex>F-1){this.currentListIndex=0}if(this.hasAnyClass(A.get(this.currentListIndex))){this.currentListIndex++}}else{this.inList=true;this.currentListIndex=0;if(this.hasAnyClass(A.get(this.currentListIndex))){this.currentListIndex++
}}A.get(this.currentListIndex).className="sel";break;case"SELECT":this.selectItem(A.get(this.currentListIndex));A.get(this.currentListIndex).className="";this.currentListIndex=0;this.inList=false;break;case"AUTO-SELECT":if(this.hasAnyClass(A.get(this.currentListIndex))){this.currentListIndex++}if(!this.hasAnyClass(A.get(this.currentListIndex))){var E=A.get(this.currentListIndex);var C=document.all?E.innerText:E.textContent;if(C.toLowerCase().indexOf(this.currentInput[0].value.toLowerCase())>-1){this.selectItem(E)}}break;case"CLEAR":for(var B=A.length-1;B>=0;B--){if(this.hasAnyClass(A[B])){if(A[B].className==="sel"){A[B].className=""}}}this.currentListIndex=0;this.inList=false;break}},sendOjpRequest:function(B){var C=this.getCurrentInput("OPTIONS");var A="";if(C.single||!C.useDLRLU){A=C.dataURL+B}else{if(this.currentInput[0].id===C.from[0].id){if(C.to.val()===C.to[0].defaultValue){A=C.dataURL+B}else{A=C.dataURL+B+"/"+C.to.val()}}else{if(C.from.val()===C.from[0].defaultValue){A=C.dataURL+B}else{A=C.dataURL+B+"/"+C.from.val()}}}$.ajax({dataType:"jsonp",url:A,success:this.cacheAjaxData,error:this.showServiceError});A=null},sendPostcodeRequest:function(A){$.ajax({dataType:"jsonp",url:this.postcodeFeed+A,success:this.postcodeHandler,error:this.showServiceError})},postcodeHandler:function(B){var A=B.length===0;if(A){sp.showPostcodeMessage("red","Postcode not found","Sorry, we can't find any stations for this postcode.",false)}else{sp.showPostcodeMessage("green","Postcode found","Please continue specifying your journey.",false)}},queryCache:function(){var F=sp.currentInput.val();var C=F.charAt(0).toLowerCase();var A=new RegExp("(^| )"+F.toLowerCase());var B=sp.getCurrentInput("CACHE");var D=$.grep(B[C],function(G){return A.test(G[1].toLowerCase())||A.test(G[0].toLowerCase())});var E=D.sort(function(H,G){var M=F.toLowerCase();var K=H[0].toLowerCase();var J=H[1].toLowerCase();var L=G[0].toLowerCase();var I=G[1].toLowerCase();if(M.length==3){if(K==M){return -1}if(L==M){return 1}}a_matches_at_front=J.indexOf(M)==0;b_matches_at_front=I.indexOf(M)==0;if(a_matches_at_front&&!b_matches_at_front){return -1}if(b_matches_at_front&&!a_matches_at_front){return 1}station_names=[J,I];station_names_alphabetically=station_names.sort();if(station_names_alphabetically[0]==J){return -1}else{return 1}});sp.processData(E)},cacheAjaxData:function(C){var B=sp.currentInput.val().charAt(0).toLowerCase();var A=sp.getCurrentInput("CACHE");A[B]=C;if(sp.currentInput.val().length>1){sp.queryCache()}else{sp.processData(C)}},checkPostCode:function(){var B=sp.currentInput.val().toUpperCase().replace(/ /g,"");var C=this.getCurrentInput("OTHER");var A=new RegExp("^(GIR 0AA)|((([A-PR-UWYZ][0-9][0-9]?)|(([A-PR-UWYZ][A-HK-Y][0-9][0-9]?)|(([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))))[0-9][ABD-HJLNP-UW-Z]{2})$");if(this.getCurrentInput("OPTIONS").usePostcodes!==true){this.showPostcodeMessage("red","Postcode not allowed","Sorry, we can't take postcodes here.",false)}else{if(C.getAttribute("stype")==="pc"){this.showPostcodeMessage("red","Postcode to postcode","Sorry, we can only plan from or to a postcode, we cannot plan a journey between 2 postcodes",false)}else{if(A.test(B)){sp.currentInput.attr("stype","pc");sp.sendPostcodeRequest(B);this.showPostcodeMessage("green","Postcode valid","Please wait, checking that postcode exists...",false)}else{if(B.replace(/ /g,"").length<6){this.showPostcodeMessage("gray","Postcode search","Please keep typing...",false)}else{this.showPostcodeMessage("red","Postcode not found","Please keep typing or try again...",true)}}}}},showPostcodeMessage:function(B,D,C,F){clearTimeout(sp.postcodeMessageTimer);var E='<li class="no-sel no-pad"><span class="A">B</span>C</li>';E=E.replace(/A/,B);E=E.replace(/B/,D);E=E.replace(/C/,C);var A=function(){$("#sp-postcode").html(E);sp.$picker[0].className="sp-visible postcode"};if(F){sp.postcodeMessageTimer=setTimeout(A,sp.postcodeMessageTimeout)}else{A()}},processData:function(G){var I=sp.currentInput.val();var A=sp.getCurrentInput("OPTIONS");var B;var F=false;var D="";if(G===null){sp.showServiceError();return false}else{B=G.length}if(!A.useUserStations&&B===0){sp.$picker[0].className="sp-visible nothing";return false}if(A.useUserStations){var C=A.userStations;var J=[];for(var H in C){for(var E=C[H].length-1;E>=0;E--){if(I.toLowerCase()===C[H][E][1].slice(0,I.length).toLowerCase()){J[J.length]=C[H][E]}}if(J.length){F=true;D+='<li class="h">'+H+"</li>";D+=sp.makeList(J,A,I,F);D+='<hr class="sp" />'}J=[]}}D+=F?'<li class="h">All</li>':"";D+=sp.makeList(G,A,I,F);if(D.slice(D.length-2,D.length)==="/>"){D=D.slice(0,D.length-21)}while(D.split("</li>").length>sp.maxItems){D=D.slice(0,D.lastIndexOf("<li"))}if(B>sp.maxItems){D+="<li class='more' title='...for "+(B-sp.maxItems)+" more stations'><hr class='sp' />Continue typing to see more results...</li>"}sp.getCurrentList()[0].innerHTML=D;if(D===""){sp.$picker[0].className="sp-visible nothing"}else{sp.setPickerClass()}},selectItem:function(A){if(A===undefined){return false}var I=document.all?A.innerText:A.textContent;var E=A.getAttribute("stype");var G=A.getAttribute("sok");var C=/lu/;var B=/dlr/;var D,H,F;if(this.getCurrentInput("OPTIONS").useDLRLU&&!this.getCurrentInput("OPTIONS").single){switch(E){case"dlr":I=I.slice(0,I.length-3);this.setIcon(this.currentInput,"dlr",22);break;case"lu":I=I.slice(0,I.length-3);this.setIcon(this.currentInput,"lu",16);break;case"dlrlu":I=I.slice(0,I.length-3);this.setIcon(this.currentInput,"dlrlu",40);break;default:this.removeIcon(this.currentInput)}D=this.getCurrentInput("OTHER");if(!!D.getAttribute("stype")){H=D.getAttribute("stype");F=this.currentInput[0].getAttribute("stype");if((C.test(H)||B.test(H))&&(C.test(F)||B.test(F))){G="false"}}if(this.currentInput.val().length>1&&G==="false"){this.currentInput.parent().addClass("sp-error");this.$picker[0].className="sp-visible j-error";if(this.$picker.find("#je").length===0){this.$picker.append('<ul id="je"></ul>')}this.$picker.find("#je").html(['<li class="no-sel no-pad">','<p><span><img src="/images/icon-',this.getCurrentInput("FROM")[0].getAttribute("stype"),'.png" alt="DLR" /> to <img src="/images/icon-',this.getCurrentInput("TO")[0].getAttribute("stype"),'.png" />&nbsp;<strong>Sorry</strong></span></p>',"<p>Sorry, we can only plan to or from a London Underground/<abbr title='Docklands Light Railway'>DLR</abbr> station, we cannot plan between 2 London Underground/<abbr title='Docklands Light Railway'>DLR</abbr> stations. </p>","</li>"].join(""))
}else{this.currentInput.parent().removeClass("sp-error");this.$picker[0].className=""}}else{if(E&&!this.getCurrentInput("OPTIONS").single){this.$picker[0].className="sp-visible j-error"}}if(!sp.hasAnyClass(A)){sp.currentInput.val(sp.formatSelection(I))}},deselectItem:function(){if(this.currentInputOptions[this.currentInputIndex].useDLRLU){this.currentInput.next("span")[0].className="sp-icon-holder";this.removeIcon(this.currentInput);this.currentInput.parent().removeClass("sp-error")}},getCurrentInput:function(A){switch(A){case"OPTIONS":return this.currentInputOptions[this.currentInputIndex];break;case"TO":return this.currentInputOptions[this.currentInputIndex].to;break;case"OTHER":if(this.currentInputOptions[this.currentInputIndex].single){return false}return this.currentInputOptions[this.currentInputIndex].to[0].id===this.currentInput[0].id?this.currentInputOptions[this.currentInputIndex].from[0]:this.currentInputOptions[this.currentInputIndex].to[0];break;case"CACHE":return this.currentInputOptions[this.currentInputIndex].useDLRLU?sp.DLRLUcache:sp.cache;break;default:return this.currentInputOptions[this.currentInputIndex].from;break}},getFavorites:function(){var A=this.getCurrentInput("OPTIONS");if(typeof A==="undefined"||typeof A.userStations==="undefined"){return false}else{return A.userStations}},parseFavorites:function(){var C=$("#d");if(C.children("[stype]").length==0){return false}var E=C.children("li");var D=this.getCurrentInput("OPTIONS");var B={};var A="";E.each(function(I){if(this.className=="h"){A=this.innerHTML;B[A]=[]}if(this.getAttribute("stype")){var J=this.innerHTML;var G=$.trim(J.split(" - ")[0]);var F=$.trim(J.split(" - ")[1]).replace("[","").replace("]","");var H=0;if(F.indexOf("img")>0){F=""}switch(this.getAttribute("stype")){case"nr":H=0;break;case"dlr":H=4;break;case"lu":H=5;break;case"dlrlu":H=6;break}B[A].push([F,G,H,1])}});return B},hasAnyClass:function(A){if(A===undefined||A.className===null){return false}else{return A.className.length>0}},setIcon:function(A,D,B){var C=A.next("span");A.parent().addClass("sp-has-icon");C[0].className="sp-icon-holder sp-icon-"+D;A.css("width","");A.css("width",(A.width()-B-4).toString()+"px");A[0].setAttribute("stype",D)},removeIcon:function(A){A.parent().removeClass("sp-has-icon");A.css("width","");A[0].setAttribute("stype","")},formatSelection:function(A){return A.slice(0,A.lastIndexOf("-")).replace(/^\s+|\s+$/g,"")},makeList:function(H,A,J,G){var I=[];var K=new RegExp(J,"i");var B,F;var C="";for(var E=0,D=H.length-1;E<=D;E++){if(!A.useGroups&&H[E][0].length>3){continue}B=H[E][1].replace(K,"<strong>$&</strong>");F=H[E][0].replace(K,"<strong>$&</strong>");I[I.length]=G?'<li style="margin-left:85px"':"<li ";if(A.useDLRLU){switch(H[E][2]){case 4:I[I.length]='stype="dlr" sok="';I[I.length]=H[E][3]===1;I[I.length]='"> ';I[I.length]=B;I[I.length]=" - [<img src='/images/icon-dlr.png' width='22' height='12' alt='DLR' />]";break;case 5:I[I.length]='stype="lu" sok="';I[I.length]=H[E][3]===1;I[I.length]='"> ';I[I.length]=B;I[I.length]=" - [<img src='/images/icon-tube-sm.png' width='15' height='12' alt='Tube' />]";break;case 6:I[I.length]='stype="dlrlu" sok="';I[I.length]=H[E][3]===1;I[I.length]='"> ';I[I.length]=B;I[I.length]=" - [<img src='/images/icon-dlrlu.png' width='40' height='12' alt='DLR Tube' />]";break;default:I[I.length]='stype="nr" sok="';I[I.length]=H[E][3]===1;I[I.length]='"> ';I[I.length]=B;I[I.length]=" - [";I[I.length]=F;I[I.length]="]"}}else{I[I.length]=">";I[I.length]=B;I[I.length]=" - [";I[I.length]=F;I[I.length]="]"}I[I.length]="</li>"}return C+I.join("")},getCurrentList:function(){return $("#p1 ul").eq(0)},setPickerClass:function(){if(this.currentInput.val().length>0){this.$picker[0].className="sp-visible p1"}else{this.$picker[0].className=" sp-visible"}},showServiceError:function(A){sp.$picker[0].className="sp-visible error";$("#sp-s-e").html('<li class="no-sel no-pad"><strong>Service Error</strong><p>Sorry, we can\'t access this service. Please type your station name or postcode.</p></li>')}};var dp={calURL:"/javascript/todays.datepicker.html",monthsLoaded:false,currentMonth:0,currentInput:false,calEventsAdded:false,blurTimer:"",monthCount:0,mousedown:false,init:function(){$(".date-picker-control").bind("click",dp.buttonClickHandler).bind("blur",dp.blurHandler);$(".w3em").bind("click",dp.inputClickHandler).bind("blur",dp.blurHandler)},blurHandler:function(A){if(dp.mousedown){return }dp.blurTimer=setTimeout("dp.hideDP()",200)},cancelBlurHandler:function(){clearInterval(dp.blurTimer)},buttonClickHandler:function(B){B.preventDefault();B.stopPropagation();if(!dp.calEventsAdded){dp.addCalendarEvents()}if(dp.currentInput[0]&&this===dp.currentInput.siblings()[0]){dp.hideDP()}else{var A=$(this);dp.clearDate();A.focus();dp.currentInput=A.siblings("input.w3em");if(!dp.currentInput.data("buttonEvents")){dp.addButtonEvents(A)}if(!dp.monthsLoaded){dp.loadHTML()}dp.showDP();dp.cancelBlurHandler()}},inputClickHandler:function(A){A.stopPropagation();dp.currentInput=$(this);if(!dp.calEventsAdded){dp.addCalendarEvents()}if(!dp.monthsLoaded){dp.loadHTML()}dp.showDP();dp.cancelBlurHandler()},addCalendarEvents:function(){this.$cal=$("#dp").eq(0);this.$prev=$("img",this.$cal).eq(0);this.$next=$("img",this.$cal).eq(1);this.$monthLabels=$("p",this.$cal);this.monthCount=this.$monthLabels.length;this.$cal.bind("click",dp.dpClickHandler);this.$cal.bind("mousedown",dp.dpMousedownHandler);this.$cal.bind("mouseup",dp.dpMouseupHandler);this.$prev.bind("click",dp.prevMonth);this.$next.bind("click",dp.nextMonth);$(document.body).click(function(){if(dp.currentInput){dp.hideDP()}});this.calEventsAdded=true},addButtonEvents:function(A){A.bind("keydown",dp.kbEventHandler);dp.currentInput.data("buttonEvents",true)},kbEventHandler:function(A){switch(A.keyCode){case 34:case 33:case 37:case 38:case 39:case 40:A.preventDefault();dp.navigate(A.keyCode);break;case 9:case 13:if(dp.currentInput){A.preventDefault();dp.selectDate(parseInt(dp.currentInput.data("td").innerHTML),false);dp.hideDP()}break}},navigate:function(A){var D=$(dp.currentInput.data("td"));var B;D.removeClass("dp-sel");D.removeClass("dp-hover");switch(A){case 37:B=D.prev();if(!B.length){B=D.parent().prev("tr").children().last()}break;case 38:B=D.parent().prev("tr").children().eq(D.siblings("td").andSelf().index(D[0]));break;case 39:B=D.next();if(!B.length){B=D.parent().next("tr").children().first()}break;case 40:B=D.parent().next("tr").children().eq(D.siblings("td").andSelf().index(D[0]));
break}if(C(B)){B=D;if((A===37||A===38||A===34)&&dp.currentMonth>0){dp.prevMonth();B=dp.$months.eq(dp.currentMonth).find("tbody > tr:last-child > td.dp-last")}else{if((A===39||A===40||A===33)&&dp.currentMonth<dp.monthCount-1){dp.nextMonth();B=dp.$months.eq(dp.currentMonth).find("tbody > tr:first-child > td.dp-first")}}}B.addClass("dp-hover");dp.currentInput.data("td",B[0]);function C(E){if(!E){return true}if(!E.length){return true}if(/nbsp/.test(E.html())){return true}if(E.children("span").length){return true}return false}},loadHTML:function(){if($("table",dp.$cal).length){A()}if(!dp.monthsLoaded){$("#dp > div").load("/javascript/todays.datepicker.html",A)}function A(){dp.$months=$("table",dp.$cal);dp.showMonth(0);dp.$prev.hide();if(!dp.currentInput.data("td")){dp.currentInput.data("td",$("td.dp-now",dp.$cal)[0])}dp.monthsLoaded=true;dp.getDateFromInput()}},getDateFromInput:function(){var B=dp.currentInput.val();var E=B.split("/");var D,C,A;if($.trim(B.toLowerCase())==="tomorrow"){D=$("td.dp-tomorrow",dp.$cal);C=0}else{if(E.length===3){C=E[1]-parseInt(dp.$monthLabels.eq(0).attr("title").slice(1,3));if(C<0){C=C+12}A=dp.$months.eq(C);D=$("td",A).filter(function(F){if($.trim(this.innerText||this.textContent)===E[0]){return true}})}else{D=$("td.dp-now",dp.$cal);C=0}}if(D&&D.length){dp.showMonth(C);dp.currentInput.data("td",D[0])}},dpClickHandler:function(B){B.preventDefault();B.stopPropagation();if(B.target.tagName.toLowerCase()==="td"){var A=parseInt(B.target.innerHTML);if(!isNaN(A)){dp.clearDate();B.target.className+=" dp-sel";dp.currentInput.data("td",B.target);dp.selectDate(A,false)}}if(B.target.tagName.toLowerCase()==="li"){B.preventDefault();dp.clearDate();dp.selectDate(B.target.innerHTML,true)}},dpMousedownHandler:function(A){dp.mousedown=true},dpMouseupHandler:function(A){dp.mousedown=false},nextMonth:function(A){dp.cancelBlurHandler();if(dp.currentMonth<dp.monthCount-1){dp.currentMonth++;dp.showMonth(dp.currentMonth)}},prevMonth:function(A){dp.cancelBlurHandler();if(dp.currentMonth>0){dp.currentMonth--;dp.showMonth(dp.currentMonth)}},showMonth:function(A){dp.$monthLabels.hide();dp.$months.addClass("hidden");dp.$monthLabels.eq(A).show();dp.$months.eq(A).removeClass("hidden");dp.$prev.show();dp.$next.show();A===0&&dp.$prev.hide();A===(dp.monthCount-1)&&dp.$next.hide();dp.currentMonth=A},selectDate:function(A,C){var B;if(C){B=A}else{A=parseInt(A);if(A<10){A="0"+A.toString()}else{A=A.toString()}}B=C?A:A+dp.$monthLabels.eq(dp.currentMonth)[0].getAttribute("title");dp.currentInput.val(B);dp.hideDP()},clearDate:function(){if(dp.currentInput&&dp.currentInput.data("td")){dp.currentInput.data("td").className=dp.currentInput.data("td").className.replace(/dp-sel/,"")}},showDP:function(){var D=dp.currentInput.offset();var C=D.top-$(window).scrollTop();var B=$(window).height()-C;dp.$cal.css("top",(D.top+dp.currentInput.height()+7).toString()+"px");dp.$cal.css("left",(D.left-1).toString()+"px");if(dp.$months){dp.getDateFromInput()}if(dp.currentInput.data("td")){dp.currentInput.data("td").className+=" dp-sel"}dp.$cal.show();var A=12;if(B<(dp.$cal.outerHeight()+dp.currentInput.outerHeight()+A)){dp.$cal.css("top",(dp.$cal.offset().top-dp.$cal.height()-dp.currentInput.height()-25).toString()+"px")}},hideDP:function(){dp.clearDate();dp.currentInput=false;dp.$cal&&dp.$cal.hide()}};FC.vars={slowSafari:($.browser.safari&&$.browser.version<523),selectors:{ACCORDIAN:"div.accordian",ACCORDIAN_TABLE:"table.accordian-table",ADD_JOURNEY:"a.add-journey",ADD_RAILCARDS:".calculator a.add",AD_SEARCH_HOLDER:"div.advanced-search-h",AD_SEARCH_BUTTON:"a.adv-search",AD_SEARCH:"div.advanced-search",ALERT_POPUP:".alert-popup",AMBIGOUS_STATION_ERROR_TO:"#txtToSelect",AMBIGOUS_STATION_ERROR_FROM:"#txtFromSelect",CALLING_POINTS:"tr.callingpoints",CHKBOX_BORDERS:".checkbox-border",CTF_PROVIDER:"div.ticket-provider",DATE_STATE:"#dateState",DATE_PICKER:"div.date-picker",DATE_PICKER_CONTROL:"a.date-picker-control",FARE_FIND:"div.farefind",FARES_TAB:"table.results th.fares-tab",FARES_MORE:"table.results p.more-fares a",FARES_ACCORDIAN_TRIGGER:".further-fares",FARES_ACCORDIAN_TRIGGER_ANCHOR:".further-fares a.further-fares-trigger",FARES_ACCORDIAN:".more-fares-list",FARES_ACCORDIAN_CONTENT:".further-fares ul",HOMEPAGE:"div.homepage",HP_LIVE_TRAINS:"div.homepage div.live-trains",INPUT_BORDERS:".input-border",JP_TIMES:"div.journey-planner-times",JP_WAYPOINTS:"div.advanced-search-w",JP_WAYPOINT_ROUTE:"div.advanced-search-route",JOURNEY_PLANNER:"div.journey-planner",JOURNEY_DATES:"#txtDateRet",MINI_BASKET:"div.miniBasket  div.ticket-total-padding",PT:"div.pocket-timetable",RAILCARD_BUTTON:"div.rcards button, div.rcards input",REGISTER_BUTTON:"#register-button",REM_SEARCH_BUTTON:"a.hide-search",RESULTS_TABLE:"table.results",ROUTE_MAP:"#route-map",RTN_JOURNEY:"div.journey-planner div.return",SEARCH_SUBMIT_BUTTON:"div.button-holder button.fluid, div.button-holder span.fluid",SELECT_BORDERS:".select-border",SHOW_MORE:"div.show-more",SIDE_TABS:"div.side-tabs",SMS_OPTIONS:"#alertSent",TICKER:"div.ticker",TICKET_PROVIDER:"div.ticket-provider",TIME_RANGE:"div.time-range select",TIME_STATE:"#timeState",TOCS:"div.operators div.TOC input:radio",TOOLTIP_HOLDER:"div.tooltip, span.tooltip, li.tooltip",TRAIN_ACTION:"#train-action",TRAIN_ACTION_FIRST:"#train-action-first",TRAIN_ACTION_SECOND:"#train-action-second",TXTAREA_BORDERS:".txtarea-border",HOMEAD:"#ad-placeholder-homepage",ADS:"#ad-placeholder-side,#ad-placeholder-top,#ad-placeholder-homepage",OTHER_FARES:".other-fares-popup-link",TABS_CONTAINER:"#tabs-container",TAB_PANEL:".tab-panel",TAB_HEADING:"h3",TAB_CONTENT:".tab-content",HEADING_DISPLAY:1,TAB_START:1,FX_SPEED:800,BASEMAP_EASEMANT_HANDLE:"#easement-updown",BASEMAP_EASEMANT_MESSAGEWINDOW:"#easement-messages"},paths:{CLEAR_GIF:"/images/clear.gif",TICKER_INFO:"//nationalrail.co.uk/dynjs/newsflash/newsflash_homepage.js",PREDICTIVE_FEED:"/redesign/default/javascript/stations-json.js",MORE_FARES_JSON:"/service/timesandfares/ajaxMoreFares",ALL_FARES_JSON:"/service/timesandfares/ajaxAllFares",ALT_INIT:"/service/purchaseticket/alternativespopup",ALT_ELTRAINS:""},messages:{MORE_FARES_ERROR:"Error loading more fares",NO_STATIONS_ADDED:"No stations added - please add stations below",CONFIRM_ACTION:"Your changes will be lost."},links:{ADVANCE_SINGLE_INFO:"Advance Single",ADVANCE_RETURN_INFO:"Advance Return",ADVANCE_INFO_LINK:"#Advance",ANYTIME_SINGLE_INFO:"Anytime Single",ANYTIME_RETURN_INFO:"Anytime Return",ANYTIME_INFO_LINK:"#Anytime",OFF_PEAK_SINGLE_INFO:"Off-Peak Single",OFF_PEAK_RETURN_INFO:"Off-Peak Return",OFF_PEAK_INFO_LINK:"#OffPeak"},ticker:{selectors:{newsType:".ticker .update h2",newsUpdate:".ticker .update",newsTypeValue:["","Live travel updates","Service updates"],newsContainer:".ticker .update p a",newsCounterText:".ticker p.counter",newsBack:"#back a",newsPause:"#pause a",newsForward:"#forward a",newsCounter:-1,newsLength:0,newsInterval:8000,newsTimer:0,newsPauseBool:0,newsCursor:"_",newsLetterCounter:0,newsLetterTimer:0,letters:0,icon:"#ticker-alert"}},preload:{scripts:["functions.other.js"],css:["split-other.css"]}};
FC.modalPopup=function(D,H){var E=document,C=$,B=E.body.style,A=/fixed/,G=navigator.userAgent.toLowerCase(),F=H;__dateString=D;onYesClickHandler=function(I){if(FC.hasLteIE6){$("iframe.hideSelect").remove();B.height="auto";B.width="auto";E.documentElement.style.overflow=""}$("div.modal-popup").remove();$("div.overlay").remove();return false},confirmAction=function(Q){var M=/mac/,P=/firefox/;try{if(FC.hasLteIE6){B.height="100%";B.width="100%";E.documentElement.style.overflow="hidden";if($("iframe.hideSelect").length===0){$("body .modalContainer").append('<iframe class="hideSelect"></iframe><div class="overlay"></div><div class="box-8 box-8-short modal-popup"><div class="b8-t"><div class="b8-tr">&nbsp;</div></div><div class="b8-m"><div class="b8-p clear"><h1 class="sifr">'+__dateString+'</h1><p class="popup-text"></p></div></div><div class="b8-b"><div class="b8-br">&nbsp;</div></div></div>')}}else{if(!document.getElementById("overlay")){$("body .modalContainer").append('<div class="overlay"></div><div class="box-8 box-8-short modal-popup"><div class="b8-t"><div class="b8-tr">&nbsp;</div></div><div class="b8-m"><div class="b8-p clear"><h1 class="sifr">'+__dateString+'</h1><p class="popup-text"></p></div></div><div class="b8-b"><div class="b8-br">&nbsp;</div></div></div>')}}var L=$("div.overlay"),I=$("div.modal-popup");if(M.test(G)&&P.test(G)){L.addClass("overlayMacFFBGHack")}else{L.addClass("overlayBG")}$("p.popup-text").text(F);I.find("div.b8-p").append('<div class="buttons clear"><a class="b-b popup-ok" href="#"><span>OK</span></a></div>');$("a.popup-ok").bind("click",{callback:Q},onYesClickHandler).focus();var R=I.outerHeight(),J=I.outerHeight(),O=$(window).scrollTop()-Math.round(R/2),K=Math.round(I.outerWidth()/2);I.css({marginLeft:"-"+K+"px"});if(FC.hasLteIE6){$(window).scrollTop(0)}else{I.css({marginTop:O+"px"})}}catch(N){}};confirmAction()};FC.altTrains=function(E){var I,F,A,G;function J(K){K.preventDefault();G=K.target;I=G.className;if(I==""){if(G.paparentElement){I=G.parentElement.className}else{I=G.parentNode.className}}switch(I){case"other-fares-popup-link":F=FC.vars.paths.ALT_INIT;A=G.href.toString().slice(G.href.toString().lastIndexOf("?")+1);C();break;case"ctf-earlier":F=FC.vars.paths.ALT_ELTRAINS;A=G.href.toString().slice(G.href.toString().lastIndexOf("?")+1);D();break;case"ctf-later":F=FC.vars.paths.ALT_ELTRAINS;A=G.href.toString().slice(G.href.toString().lastIndexOf("?")+1);D();break;default:break}}function C(){$.ajax({dataType:"html",url:F,data:A,success:B,error:H})}function D(){$.ajax({dataType:"html",url:F,data:A,success:B,error:H})}function H(){var K=$("div.other-fares-popup");popop.replaceWith("<p>Sorry, there has been an error. Please try again</p>")}function B(K){var L=$("div.other-fares-popup");if(L){L.replaceWith(K);L=$("div.other-fares-popup");if(FC.hasLteIE6){$("div.other-fares-popup span.ctf-earlier a").live("click",J);$("div.other-fares-popup span.ctf-later a").live("click",J)}else{L.find("span.ctf-earlier a").bind("click",J);L.find("span.ctf-later a").bind("click",J)}}try{M.preventDefault()}catch(M){}otherFares=$(FC.vars.selectors.OTHER_FARES);FC.otherFaresPopup(otherFares,true);FC.tooltip(L.find(".tooltip"))}J(E)};FC.otherFaresPopup=function(B,I){var H=document,A=$,E=H.body.style,C=/fixed/,D=navigator.userAgent.toLowerCase(),G=B;try{G.unbind("click")}catch(F){}G.bind("click",function(J){J.preventDefault();FC.altTrains(J)});onYesClickHandler=function(J){if(FC.hasLteIE6){$("iframe.hideSelect").remove();E.height="auto";E.width="auto";H.documentElement.style.overflow=""}$("div.other-fares-popup").hide();$("div.overlay").remove();return false},confirmAction=function(U){var O=/mac/,S=/firefox/;try{var K=$("div.other-fares-popup");var V=K.outerHeight(),L=K.outerHeight(),R=$(window).scrollTop()-Math.round(V/2),M=Math.round(K.outerWidth()/2);if(FC.hasLteIE6){E.height="100%";E.width="100%";$(window).scrollTop();H.documentElement.style.overflow="hidden";var T=$(window).height();var P=$(window).width();if($("iframe.hideSelect").length===0){$("body .otherFaresContainer").prepend('<iframe class="hideSelect"></iframe><div class="overlay overlayBG"></div>');var J=$("body .otherFaresContainer").find("div.overlay");J.width(P);J.height(T)}}else{if(!document.getElementById("overlay")){$("body .otherFaresContainer").prepend('<div id="overlay" class="overlay"></div>')}}var N=$("#overlay");if(O.test(D)&&S.test(D)){N.addClass("overlayMacFFBGHack")}else{N.addClass("overlayBG")}K.prepend('<a class="close-button" href="#">Close</a>');$(document).keyup(function(W){if(W.keyCode=="27"){onYesClickHandler()}});K.css({marginLeft:"-"+M+"px"});if(FC.hasLteIE6){$(window).scrollTop(0);K.css({marginTop:"0px"});K.css("top","30px")}else{K.css({marginTop:R+"px"})}K.show();K.find("a.close-button").bind("click",{callback:U},onYesClickHandler).focus()}catch(Q){}return false};if(I==true){confirmAction()}};FC.presentPass=function(B){var A=null,D=$,F,E,C=0;while(E=B[C++]){((F=D(E.test))&&F.length)?E.func(F,E.args||A):A}D=F=E=C=A};FC.formBorders=function(G){var D=FC.vars.selectors,C=G.find("input, select, textarea"),H,E,A;var B=function(O){var L=this.parentNode,I=L.parentNode,N=I.parentNode,M=/hidden-border/,K=/invalid/,J=/invalid-large/;if(!M.test(L.className)){E=!!K.test(I.className);H=!!J.test(N.className);A=!!K.test(N.className)&&!H;L.style.backgroundColor="#ffe155"}};var F=function(J){var I=this.parentNode;if(I.className.indexOf("hidden-border")===-1&&(H||E||A)){I.style.backgroundColor="#ff0000"}else{I.style.background="none"}};(function(){var I=C.length;while(I--){$(C[I]).bind("focus",B).bind("blur",F)}})()};FC.presentPass([{test:FC.vars.selectors.SIDE_TABS,func:function(V){var a=document,C=$,c=a.body.style,H=V.children("ul"),G=H.children("li"),J=G.find("div.side-tab-content"),W=J.length,X,R,S=/fixed/,N=!!S.test(V[0].className),Y=0,K,L=G.length,E=navigator.userAgent.toLowerCase(),A=function(d){if(FC.hasLteIE6){$("iframe.hideSelect").remove();c.height="auto";c.width="auto";a.documentElement.style.overflow=""}$("div.modal-popup").remove();$("div.overlay").remove();d.data.callback(true);return false},M=function(d){if(FC.hasLteIE6){$("iframe.hideSelect").remove();c.height="auto";c.width="auto";a.documentElement.style.overflow=""}$("div.modal-popup").remove();$("div.overlay").remove();d.data.callback(false);return false},T=function(n){var j=/mac/,m=/firefox/;try{if(FC.hasLteIE6){c.height="100%";c.width="100%";a.documentElement.style.overflow="hidden";if($("iframe.hideSelect").length===0){$("body").append('<iframe class="hideSelect"></iframe><div class="overlay"></div><div class="box-8 box-8-short modal-popup"><div class="b8-t"><div class="b8-tr">&nbsp;</div></div><div class="b8-m"><div class="b8-p clear"><h3 class="sifr">Are you sure you want to proceed?</h3><p class="popup-text"></p></div></div><div class="b8-b"><div class="b8-br">&nbsp;</div></div></div>')
}}else{if(!document.getElementById("overlay")){$("body").append('<div class="overlay"></div><div class="box-8 box-8-short modal-popup"><div class="b8-t"><div class="b8-tr">&nbsp;</div></div><div class="b8-m"><div class="b8-p clear"><h3 class="sifr">Are you sure you want to proceed?</h3><p class="popup-text"></p></div></div><div class="b8-b"><div class="b8-br">&nbsp;</div></div></div>')}}var h=$("div.overlay"),d=$("div.modal-popup");if(j.test(E)&&m.test(E)){h.addClass("overlayMacFFBGHack")}else{h.addClass("overlayBG")}$("p.popup-text").text(FC.vars.messages.CONFIRM_ACTION);d.find("div.b8-p").append('<div class="buttons clear"><a class="b-b popup-no" href="#"><span>No</span></a><a class="b-b popup-yes" href="#"><span>Yes</span></a></div>');$("a.popup-yes").bind("click",{callback:n},A).focus();$("a.popup-no").bind("click",{callback:n},M);var o=d.outerHeight(),f=d.outerHeight(),l=$(window).scrollTop()-Math.round(o/2),g=Math.round(d.outerWidth()/2);d.css({marginLeft:"-"+g+"px"});if(FC.hasLteIE6){$(window).scrollTop(0)}else{d.css({marginTop:l+"px"})}}catch(k){}},b=function(f){var d=L,e,g;while(d--){g=G[d];g.className=g.className.replace(/ selected/g,"")}f[0].parentNode.parentNode.className+=" selected";if(N){__listHeight=H.height()-40;if(FC.hasIE6){__listHeight=H.height()-66}f.parent().siblings("div.side-tab-container").find("div.side-tab-content").height(__listHeight)}else{__listHeight=f.parent().siblings("div.side-tab-container").height()-52;H.height(__listHeight)}},O=function(){var g=$(this),k,m,f,l,h,d=/selected/,j=/confirmChange/,e=(function(){var n=L,o;while(n--){if((o=G[n])&&d.test(o.className)){return o}}})();if(j.test(e.className)){K=false;k=e.getElementsByTagName("input");if(k){l=k.length;while(l--){h=k[l];if(h.type==="radio"){if(h.checked!==h.defaultChecked){K=true;break}}else{if(h.value!==h.defaultValue){K=true;break}}}}if(!K){m=e.getElementsByTagName("select");if(m){l=m.length;while(l--){f=m[l];if(!f.options[f.selectedIndex].defaultSelected){K=true;break}}}}if(K){T(function(o){var p,n=0;if(o){if(k){l=k.length;while(l--){h=k[l];if(h.type==="radio"){h.checked=h.defaultChecked}else{h.value=h.defaultValue}}}if(m||(m=e.getElementsByTagName("select"))){l=m.length;while(l--){f=m[l];p=f.length;for(;n<p;n++){if(f.options[n].defaultSelected){f.options[n].selected="selected";break}}}}b(g)}})}else{b(g)}}else{b(g)}return false};G.find("div.tab a").unbind().bind("click",O);if(N){while(W--){X=$(J[W]).height();if(X>Y){Y=X}}if(H.height()<Y){H.height(Y)}else{__listHeight=H.height()-40;W=J.length;while(W--){$(J[W]).height(__listHeight)}}}else{C(G[0]).find("div.tab a").trigger("click")}R=G.filter(".confirmChange").find("div.side-tab-content");R.find("div.error-message a").unbind();R.find("button").unbind();if(window.location.href.indexOf("st=")>-1&&V.hasClass("my-account")){var I=window.location.href,D=I.slice(I.indexOf("?")+1).toLowerCase().split("&"),U=[],B,F;for(var Z=0;Z<D.length;Z++){B=D[Z].split("=");if(B.length>1){var Q=B[0].replace(/[^-a-z]/ig,"");var P=B[1].replace(/[^-a-z]/ig,"");U.push(Q);U[Q]=P}}F=U.length>0?U.st:"notset";switch(F){case"overview ":G.find("div.tab a").eq(0).trigger("click");break;case"alerts":G.find("div.tab a").eq(1).trigger("click");break;case"stations":G.find("div.tab a").eq(2).trigger("click");break;case"journeys":G.find("div.tab a").eq(3).trigger("click");break;case"pockettimetables":G.find("div.tab a").eq(4).trigger("click");break;case"sitepreferences":G.find("div.tab a").eq(5).trigger("click");break;case"personaldetails":G.find("div.tab a").eq(6).trigger("click");break;default:G.find("div.tab a").eq(0).trigger("click");break}}else{G.find("div.tab a").eq(0).trigger("click")}}}]);FC.tooltip=function(I,L){var n=window,Q=FC,M=L?L.find(I):I,q=M.length-1,Y,f,l,K,e,U,W,s,u,F,t=[],m,c,j,V=/changestip/,N=/\bstatus\b/,O=/statustip/,R=/typetip/,E=/addinfotip/,Z=/facilitiestip/,D,H,S,C,G,T=0,A,X=false;var p=0;$(window).bind("resize.tooltip",function(){clearTimeout(T);T=setTimeout(function(){A=[];$(FC.vars.selectors.ADS).each(function(){var z=$(this),y=z.offset(),x=z.outerWidth(),w=z.outerHeight();A.push({tl:{x:y.left,y:y.top},tr:{x:y.left+x,y:y.top},bl:{x:y.left,y:y.top+w},br:{x:y.left+x,y:y.top+w}})})},200)}).trigger("resize.tooltip");function k(z){var y=A.slice(0,A.length),x,w;y.push(z);x=y.length;while(x--){w=y.length;while(w--&&w!==x){if(!(y[w].br.x<y[x].bl.x||y[w].bl.x>y[x].br.x||y[w].bl.y<y[x].tl.y||y[w].tl.y>y[x].bl.y)){return true}}}return false}function o(AF){var AL=$(n),AS,AR,Ah,Aj=AF[0].className.replace(/tooltip|first/g,"").replace(/\s*/g,""),Ag=24,AJ=15,AB=AF.offset(),Ad=AF.width(),AM=AF.height(),Ai=l.width(),AI=l.height(),AN=20,AU={width:(n.innerWidth||$(n).width())-AN,height:(n.innerHeight||$(n).height())},AY={top:AL.scrollTop(),left:AL.scrollLeft()},Ak={generic:{rb:[11,-14],rt:[11,-15],lb:[-11,-14],lt:[-11,-15]},changes:{rb:[-10,18],rt:[-30,-18],lb:[28,18],lt:[28,-18]},facilitiestip:{rb:[-36,24],rt:[-36,-24],lb:[24,20],lt:[30,-30]},statustip:{rb:[11,-14],rt:[11,14],lb:[-11,-14],lt:[-11,14]}},AZ;if(!Aj){if(AF.parents(".TIMs").length){Aj="operators"}}switch(Aj){case"changestip":case"changestip-link":AZ=Ak.changes;break;case"statustip":AZ=Ak.statustip;break;case"operators":case"facilitiestip":case"factip-ctl":AZ=Ak.facilitiestip;break;case"more-help":default:AZ=Ak.generic;break}var AA={left:(AB.left-AY.left-Ai+AZ.lt[0])>0,right:(AB.left-AY.left+Ad+Ai+AZ.rt[0])<AU.width,top:(AB.top-AI+(AM/2)+AZ.lt[1]-AY.top)>0,bot:(AB.top+(AM/2)+AI-AY.top+AZ.lb[1])<AU.height};var Af=AB.left+Ad+AZ.rb[0],Ab=AB.left+Ad+Ai+AZ.rb[0],AO=AB.top+(AM/2)+AZ.rb[1],AK=AB.top+(AM/2)+AI+AZ.rb[1],z=AB.left+Ad+AZ.rt[0],w=AB.left+Ad+Ai+AZ.rt[0],AX=AB.top+(AM/2)-AI+AZ.rt[1],AW=AB.top+(AM/2)+AZ.rt[1],AV=AB.left-Ai+AZ.lb[0],AT=AB.left+AZ.lb[0],AH=AB.top+(AM/2)+AZ.lb[1],AG=AB.top+(AM/2)+AI+AZ.lb[1],AQ=AB.left-Ai+AZ.lt[0],AP=AB.left+AZ.lt[0],AE=AB.top-AI+(AM/2)+AZ.lt[1],AD=AB.top+(AM/2)+AZ.lt[1],AC=[{inview:(AA.right&&AA.bot),className:"tip-top-left",coords:{tl:{x:Af,y:AO},tr:{x:Ab,y:AO},bl:{x:Af,y:AK},br:{x:Ab,y:AK}}},{inview:(AA.right&&AA.top),className:"tip-bottom-left",coords:{tl:{x:z,y:AX},tr:{x:w,y:AX},bl:{x:z,y:AW},br:{x:w,y:AW}}},{inview:(AA.left&&AA.bot),className:"tip-top-right",coords:{tl:{x:AV,y:AH},tr:{x:AT,y:AH},bl:{x:AV,y:AG},br:{x:AT,y:AG}}},{inview:(AA.left&&AA.top),className:"tip-bottom-right",coords:{tl:{x:AQ,y:AE},tr:{x:AP,y:AE},bl:{x:AQ,y:AD},br:{x:AP,y:AD}}}];for(var Ac=0,Aa=AC.length;Ac<Aa;Ac++){if(AC[Ac].inview&&!k(AC[Ac].coords)){AS=AC[Ac].coords.tl.x;AR=AC[Ac].coords.tl.y;
Ah=AC[Ac].className;break}}var Ae=AA.right?AC[AA.top?1:0]:AC[AA.top?3:2];AS=AS||Ae.coords.tl.x,AR=AR||Ae.coords.tl.y,Ah=Ah||Ae.className;return{left:AS,top:AR,offsetLeft:AS-AB.left,offsetTop:AR-AB.top,className:Ah}}function v(AA){var x=$.data(this,"vars"),w=x.slowerTrains,z=x.tooltip;K.html(x.content);z.append(l);l.bgiframe();var y=o(e);l.removeClass("tip-top-right tip-top-left tip-bottom-right tip-bottom-left").addClass(y.className);$.data(l[0],"trigger",this);if(z.parents(".jp-acc").length){z.css("z-index","10000");if(Q.hasIE&&w){w.style.zIndex=10000}}else{z.css("z-index","110")}l.css({left:y.offsetLeft,top:y.offsetTop});if(Q.hasIE){l.delay(400).show()}else{l.delay(400).stop().css({opacity:0,display:"block"}).animate({opacity:1},200)}}function J(z){var y=$.data(this,"vars"),x=y.tooltip,w=y.slowerTrains;if(l.hasClass("persist")){l.removeClass("persist").find(".close").trigger("hide")}else{if(FC.hasIE){x.css("z-index","100");if(w){w.style.zIndex=0}l.hide()}else{l.stop().animate({opacity:0},200,function(){this.style.display="none"}).parent().css("z-index","100")}}}function b(x){if(!l.hasClass("persist")){var w=$(this);clearTimeout(p);p=setTimeout(function(){e=w;v.call(w[0],x)},400)}}function P(w){if(w.keyCode&&w.keyCode!==13){return }w.preventDefault();if(typeof e=="undefined"){e=[null]}(this!==e[0])&&l.removeClass("persist");e=$(this);if(!l.hasClass("persist")){var x=$(this);v.call(this,w);l.addClass("persist").find(".close").css("display","block").one("hide",function(){x.focus();this.style.display="none";if(FC.hasIE){l[0].className=l[0].className.replace(/persist/,"");l[0].style.zIndex=100;l[0].style.display="none"}else{l.removeClass("persist").stop().animate({opacity:0},200,function(){this.style.display="none";this.style.zIndex=100})}return false}).one("keydown click",function(y){if(y.keyCode&&y.keyCode===13||!y.keyCode){y.preventDefault();$(this).trigger("hide")}})}else{J.call(this,w)}}function h(w){if(!X&&!l.hasClass("persist")){clearTimeout(p);J.call(this,w)}}function a(w){X=true}function g(w){X=false;h.call(e[0],w)}while(Y=M[q--]){f=$(Y);s=f.parents("tr");W=Y.className;C=false;if(V.test(W)){G=true;F=s.next(".changes");D='<div class="infodesc"><h4>Change information</h4></div>'+F.find(".changestext").html()}else{if(O.test(W)){G=true;m=(m&&m[0].parentNode==s[0].parentNode)?m:s.parent().children("tr");c=m.index(s[0]);if(m[++c]&&N.test(m[c].className)||m[++c]&&N.test(m[c].className)){F=$(m[c])}D=(j=$.find(".statustext",F[0])[0])?j.innerHTML:null}else{if(R.test(W)){G=true;u=f.parent();F=u.siblings(".typeDesc");D="<div>"+F.html()+"</div>"}else{if(E.test(W)){H=f.parents("li")[0].className;F=s.next(".addinforow");D="<div class='"+H+"'>"+(j=$.find("."+H,F[0])[0])?j.innerHTML:null+"</div>";f.find("a").removeAttr("title");if(t[t.length-1]!=F[0]){t[t.length]=F[0]}}else{if(Z.test(W)){D=$(".facilitiestip-content")[q+1].innerHTML;$($(".facilitiestip-content")[q+1]).remove()}else{var B=f.find("a"),d=B.attr("tip-title");if(!d){d=B.attr("title")}B.attr("tip-title",d).removeAttr("title");C=true;D=($.find("img",Y).length)?"<p>"+f.find("img").attr("alt")+"</p>":"<p>"+d+"</p>"}}}}}if(G&&F[0]){F[0].text="&nbsp;";if(F[0].parentNode){F[0].parentNode.removeChild(F[0])}delete F[0]}if(!C){if(G){S=f.find("a:first")}else{var r=f.hasClass("addinfotip")?"addinfotip-ctl":"factip-ctl";S=$('<a href="#'+Y.id+'" class="'+r+'">'+f.find("h3").html()+"</a>");f.prepend(S)}}else{f.find("a:first").bind("click",function(w){return false});S=f.find("a:first")}$.data(S[0],"vars",{slowerTrains:f.parents(".slower-trains")[0]||null,content:D,tooltip:f});S.bind("mouseenter",b).bind("click keydown",P).bind("mouseleave",h);f.bind("mouseenter",a).bind("mouseleave",g)}q=t.length;while(q--){t[q].parentNode.removeChild(t[q]);delete t[q]}l=$(".tooltip-top");if(!l.length){l=$('<div class="tooltip-top"><div class="tooltip-bottom clear"><div class="tooltip-tip"></div><div class="padding clear"><a href="#" class="close" style="display:none">close</a><div class="content"></div></div></div></div>');$("body").prepend(l)}K=l.find(".content")};FC.accordian=function(N){var D=$,S=document,V=FC.vars.slowSafari,I=/return/,X=/outward/,L=/expanded/,Q,K,O,J=S.createDocumentFragment(),W=S.createElement("A"),T=S.createElement("IMG"),a=S.createElement("SPAN"),G,H,R=N.length,E,F,Z,Y,A,U,C=function(c){var b=/\bhead-hlt\b/g;if(!b.test(this.className)){this.className+=" head-hlt"}},P=function(b){this.className=this.className.replace(/\bhead-hlt\b/g,"")},M=function(l){var m=this,d,f,k=/head/,b=/expanded/,j,c,h,g;if(!k.test(m.className)){return }if(l.keyCode&&l.keyCode!==13){return }d=D(m);f=$.data(m,"vars");g=f.img;c=f.multiOpen;if(!b.test(m.className)){g.alt="expand "+f.title+" panel";if(V){if(!c){f.$contentSiblings.hide().removeClass("expanded-content")}f.$next.show().addClass("expanded-content")}else{if(!c){f.$contentSiblings.filter(".expanded-content").slideUp(200).removeClass("expanded-content")}f.$next.slideDown(300).addClass("expanded-content")}if(!c){f.$headSiblings.removeClass("expanded")}m.className+=" expanded"}else{g.alt="collapse "+f.title+" panel";V?f.$next.hide().addClass("expanded-content"):f.$next.slideUp(300).addClass("expanded-content");m.className=m.className.replace(/\bexpanded\b/g,"")}return false};T.width="26";T.height="26";T.src="/images/clear.gif";T.className="sprite-main";W.appendChild(a);W.appendChild(T);W.href="#";W.className="arrow";J.appendChild(W);while(R--){H=N[R];G=D(H);__$contentSiblings=G.find("div.acc-c");__$tgts=G.find(".head");__k=__$tgts.length;while(__k--){Q=__$tgts[__k];K=D(Q);Z=K.find("h2").length?K.find("h2").text():K.find("h3").text();A=K.find("div.head-arrow")[0];if(X.test(A.className)){a.innerHTML="Outward journey details"}else{if(I.test(A.className)){a.innerHTML="Return journey details"}}T.alt=(L.test(Q.className))?"collapse "+Z+" panel":"expand "+Z+" panel";A.appendChild(J.cloneNode(true));E=K.find("a");(function(){K.bind("mouseenter focusin",C).bind("mouseleave focusout",P).bind("keypress",M).bind("click",M)})();$.data(Q,"vars",{multiOpen:!!/multi-open/.test(H.className),title:Z,$arrowContainer:A,img:E.find("img")[0],$next:K.next("div.acc-c"),$headSiblings:__$tgts,$contentSiblings:__$contentSiblings})}}while(J.firstChild){J.firstChild.innerHTML="";J.removeChild(J.firstChild)}if(window.location.hash&&N.hasClass("jp-acc")){var B=window.location.hash.toLowerCase();B=B.replace(/[^-a-z0-9]/ig,"");if(B.indexOf("num2")>-1){__$tgts.find("a").eq(2).trigger("click")}}};FC.onScriptReceived=function(){var A=FC.vars.ticker.selectors,B=$;
$container=$(A.newsContainer);$icon=$(A.icon);if(tickerData.length>0){$icon.addClass("sprite-alert")}if(tickerData.length==1){tickerData.push([1,"Find out if any current service disruptions may be affecting your journey","http://nationalrail.co.uk/service_disruptions/today.html",1])}tickerAnim=function(){var C=A.newsContainer;if(A.newsLetterCounter<A.letters.length){$container.text($container.text()+A.letters[A.newsLetterCounter]);A.newsLetterCounter=A.newsLetterCounter+1;A.newsLetterTimer=setTimeout(arguments.callee,20)}else{clearTimeout(A.newsLetterTimer)}};loadNews=function(F,G){var E,D,I,H;clearTimeout(A.newsLetterTimer);clearTimeout(A.newsTimer);A.newsLetterCounter=0;if(G==1){if(F===0){if(A.newsCounter<=0){A.newsCounter=A.newsLength}A.newsCounter=A.newsCounter-1}else{A.newsCounter=A.newsCounter+1;if(A.newsCounter>=A.newsLength){A.newsCounter=0}}}else{A.newsCounter=A.newsCounter+1;if(A.newsCounter>=A.newsLength){A.newsCounter=0}}var C=B(A.newsContainer);D=tickerData[A.newsCounter];I=D[1];H=D[2];A.letters=[];for(i=0;i<I.length;i++){A.letters.push(I.substring(i,i+1))}E=A.newsCounter+1;$(A.newsCounterText).empty().append("("+E+" of "+A.newsLength+")");C.empty();A.newsLetterTimer=setTimeout(tickerAnim,20);(D[3]==1)?C.attr("href",H):C.removeAttr("href");$(A.newsType+" a").text("Service updates");$(A.newsType).removeClass("blue");if(A.newsPauseBool===0){A.newsTimer=setTimeout(loadNews,A.newsInterval)}};onClickHandler=function(C){loadNews(C.data?C.data.dir:null,1);return false};onToggleIn=function(){clearTimeout(A.newsTimer);clearTimeout(A.newsLetterTimer);$(A.newsPause).parent().addClass("play");A.newsPauseBool=1};onToggleOut=function(){A.newsTimer=setTimeout(loadNews,A.newsInterval);A.newsLetterTimer=setTimeout(tickerAnim,200);$(A.newsPause).parent().removeClass("play");A.newsPauseBool=0};A.newsLength=tickerData.length;if(A.newsLength){$(A.newsContainer).empty();if(A.newsLength>0){$("div.functions ul").show();$(A.newsBack).unbind().bind("click",{dir:0},onClickHandler);$(A.newsPause).toggle(onToggleIn,onToggleOut);$(A.newsForward).unbind().bind("click",onClickHandler)}loadNews()}else{$("div.functions ul").hide()}};FC.tickerInit=function(){$.getScript(FC.vars.paths.TICKER_INFO,FC.onScriptReceived)};FC.clearFields=function(B){var D=B?$(B):$("body");var C=D.find("select"),E=D.find("input[type=text]"),A=D.find("textarea");searchField=D.find("input#search");C.css({color:"#555"});E.css({color:"#555"});searchField.css({color:"#444"});C.bind("focus",function(){if(this.value===this.defaultValue){this.style.color="#404040"}});A.bind("focus",function(){var F=/noclear/;if(!F.test(this.className)){if(this.value==this.defaultValue){this.value="";this.style.color="#404040"}}});E.bind("focus",function(){var F=$(this);if(!this.className.match(/noclear/g)){if(this.value==this.defaultValue){this.value="";this.style.color="#404040"}}});searchField.bind("focus",function(){var F=$(this);if(!this.className.match(/noclear/g)){if(this.value==this.defaultValue){this.value="";this.style.color="#404040"}}});E.each(function(){if(this.value!=this.defaultValue){this.style.color="#404040"}});A.each(function(){if(this.value!=this.defaultValue){this.style.color="#404040"}});searchField.each(function(){if(this.value!=this.defaultValue){this.style.color="#404040"}})};FC.registerFlyout=function(C){var A=$("#register-panel");var B='<iframe id="register-frame" src="register-1.shtml" frameborder="0" allowtransparency="true"></iframe>';C.bind("click",E);function E(H){var G=$(B);H.preventDefault();C.unbind("click");A.append(G);G.ready(function(){D()})}function D(){$(".top-section").css({"z-index":"1000"});A.css({display:"block"});A.animate({opacity:1},250);A.append("<p class='close'><a href='#'>Close</a></p>");$("p.close",A).bind("click",function(G){G.preventDefault();F()})}function F(){$(".top-section").css({"z-index":"2"});A.animate({opacity:0},250,function(){A.css({display:"none"});$("p.close",A).remove()});C.bind("click",function(G){G.preventDefault();D()});return false}};FC.addFares=function(E){var A=$("#add-fares-show");var F=E;var D="fast";A.addClass("active").attr("title","Fares shown will be based on 1 adult, 0 children. Click here to change.");if(document.getElementById("jpState")&&document.getElementById("jpState").value.charAt(2)==="1"){G({preventDefault:function(){},noFocus:true})}A.click(G);function G(I){FC.rePositionHomeAd();I.preventDefault();if(I.noFocus){A.parent().hide();F.show()}else{A.parent().fadeOut(D);F.parent().animate({height:110},H);$("#adults").focus()}function H(){F.fadeIn(function(){FC.positionHomeAd()});F.parent().css("height","auto")}$(".button-holder > button").css("bottom",$(".advanced-search-h").css("display")==="block"?2:20);if(document.getElementById("jpState")){document.getElementById("jpState").value=document.getElementById("jpState").value.slice(0,2)+"1"}}var C=$("#rcards-holder .rcards-add").eq(FC.hasIE6?1:0);var B=$("#rcards-holder ul");C.click(function(K){var H=document.getElementById("rcards");var I=H.options[H.selectedIndex].innerHTML;var L="rcard-"+H.value.toString();var J='<li><label for="x">y</label><select name="numberOfEachRailcard" id="x"><option value="0">0</option><option value="1" selected>1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option></select><input type="hidden" name="railcardCodes" value="'+H.value.toString()+'" /></li>';K.preventDefault();if(H.value.toString()===""||document.getElementById(L)){$(H).parent().css("background-color","red");return false}J=J.replace(/x/g,L);J=J.replace(/y/,I);B.append(J);B.addClass("active");FC.positionHomeAd()})};FC.advancedSearch=function(D){var B=D.find(FC.vars.selectors.AD_SEARCH);var E=$(FC.vars.selectors.AD_SEARCH_BUTTON);var K=D;var J=$(FC.vars.selectors.REM_SEARCH_BUTTON);var H=$(FC.vars.selectors.SEARCH_SUBMIT_BUTTON);E.addClass("active").attr("title","");J.addClass("active").attr("title","");var G=H.css("bottom");if(!FC.hasIE){K.css({opacity:0})}else{$("div.advanced-search-p",K).css({visibility:"hidden"})}E.bind("click",function(L){L.preventDefault();I();return false});function F(){E.parent().hide();K.show();J.unbind("click").bind("click",function(){A();return false})}function C(L){L.addClass("noout");L.bind("blur",function(M){$(this).removeClass("noout");$(this).unbind("blur")})}function I(){FC.rePositionHomeAd();if(FC.hasIE){E.css({visibility:"hidden"});E.parent().hide(400);
H.animate({bottom:"2px"},600);K.slideDown(600,function(){$("div.advanced-search-p",$(this)).css({visibility:"visible"});J.unbind("click").bind("click",function(){A();return false});C($("div.advanced-search-p a.hide-search"));$("div.advanced-search-p a.hide-search").focus();FC.positionHomeAd()})}else{H.animate({bottom:"2px"},250);E.parent().animate({opacity:0},250,function(){$(this).hide(400);K.slideDown(600,function(){$(this).animate({opacity:1},250,function(){J.unbind("click").bind("click",function(){A();return false});C($("div.advanced-search-p a.hide-search"));$("div.advanced-search-p a.hide-search").focus();FC.positionHomeAd()})})})}if(document.getElementById("jpState")){document.getElementById("jpState").value=document.getElementById("jpState").value.slice(0,1)+"1"+document.getElementById("jpState").value.slice(2,3)}}function A(){FC.rePositionHomeAd();if($("#add-fares").css("display")==="block"){G=20}if(FC.vars.slowSafari){E.parent().show();K.hide();E.unbind("click").bind("click",function(){I();return false});$("ul.jpActions a.adv-search").focus();C($("ul.jpActions a.adv-search"));FC.positionHomeAd()}else{if(FC.hasIE){K.find(".advanced-search-p").css({visibility:"hidden"});E.parent().show(400,function(){E.css({visibility:"visible"})});H.animate({bottom:G},600);K.slideUp(600,function(){E.unbind("click").bind("click",function(){I();return false});$("ul.jpActions a.adv-search").focus();C($("ul.jpActions a.adv-search"));FC.positionHomeAd()})}else{K.animate({opacity:0},250,function(){E.parent().show(400);$(this).slideUp(600,function(){H.animate({bottom:G},250);E.parent().animate({opacity:1},250,function(){E.unbind("click").bind("click",function(){I();return false});$("ul.jpActions a.adv-search").focus();C($("ul.jpActions a.adv-search"));FC.positionHomeAd()})})})}}if(document.getElementById("jpState")){document.getElementById("jpState").value=document.getElementById("jpState").value.slice(0,1)+"0"+document.getElementById("jpState").value.slice(2,3)}}if(document.getElementById("jpState")&&document.getElementById("jpState").value.charAt(1)==="1"){if(!FC.hasIE){E.parent().css({opacity:0});K.css({opacity:1})}else{$("div.advanced-search-p",K).css({visibility:"visible"})}F()}};FC.addJourney=function(){var I=$("div.journey-planner div.return");var K="showhide";var E='<ul class="actions clear"><li><a href="#" class="remove-journey"><img alt="" class="sprite-main" src="'+FC.vars.paths.CLEAR_GIF+'" width="22" height="30" />Remove return journey</a></li></ul>';if($.find("div.return-prepend").length){I.prepend($(E))}else{I.append($(E))}var N=$(FC.vars.selectors.ADD_JOURNEY);var F=$("div.journey-planner a.remove-journey");var H=$(FC.vars.selectors.SEARCH_SUBMIT_BUTTON);var G=H.css("bottom");var D=$(".jp-acc .slower-trains");N.addClass("active").attr("title","");F.addClass("active").attr("title","");if(!FC.hasIE){I.css({opacity:0})}else{I.children().css({visibility:"hidden"})}I.hide();N.bind("click",function(O){O.preventDefault();L()});function C(){H.css({zoom:"0"});H.css({zoom:"1"})}function A(O){O.addClass("noout");O.bind("blur",function(P){$(this).removeClass("noout");$(this).unbind("blur")})}function J(){if(K=="showhide"){N.parent().hide();I.show();F.unbind("click").bind("click",function(){M();return false})}else{I.show();N.attr("class","remove-journey").empty().append("Remove return journey").unbind("click").bind("click",function(){M();return false});N.parent().css({opacity:1})}}function B(){$("select",I).each(function(){this.selectedIndex=0});$("input",I).each(function(){$(this).val("dd/mm")})}function L(){FC.rePositionHomeAd();FC.journeyDates(true);if(FC.vars.slowSafari){J()}else{if(FC.hasIE){N.css({visibility:"hidden"});if(K=="showhide"){$("a.date-picker-control",I).css({visibility:"hidden"});N.parent().hide(400,function(){I.slideDown(400,function(){I.addClass("return-open");I.children().css({visibility:"visible"});I.find("a.date-picker-control").css({visibility:"visible"});F.unbind("click").bind("click",function(){M();return false});C();$("a.remove-journey").focus();A($("a.remove-journey"));FC.positionHomeAd()});D.animate({top:"-3em"},400)})}else{$("a.date-picker-control",I).css({visibility:"hidden"});I.slideDown(400,function(){I.addClass("return-open");I.children().css({visibility:"visible"});$("a.date-picker-control",I).css({visibility:"visible"});N.attr("class","remove-journey").empty().append("Remove return journey").unbind("click").bind("click",function(){M();return false});N.css({visibility:"visible"});C();$("a.remove-journey").focus();A($("a.remove-journey"));FC.positionHomeAd()});D.animate({top:"-3em"},400)}}else{I.stop();N.parent().animate({opacity:0},250,function(){if(K=="showhide"){$(this).hide(400,function(){I.show(400,function(){I.addClass("return-open");I.animate({opacity:1},250,function(){F.unbind("click").bind("click",function(){M();return false});$("a.remove-journey").focus();A($("a.remove-journey"));FC.positionHomeAd()})});D.animate({top:"-3em"},400)})}else{I.show(400,function(){I.addClass("return-open");I.animate({opacity:1},250,function(){N.attr("class","remove-journey").empty().append("Remove return journey").unbind("click").bind("click",function(){M();return false});N.parent().animate({opacity:1},250);$("a.remove-journey").focus();A($("a.remove-journey"));FC.positionHomeAd()});D.animate({top:"-3em"},400)})}})}}if(document.getElementById("jpState")){document.getElementById("jpState").value="1"+document.getElementById("jpState").value.slice(1)}}function M(){FC.rePositionHomeAd();FC.journeyDates();if(FC.vars.slowSafari){I.removeClass("return-open");I.hide();D.animate({top:"0"},400);if(K=="showhide"){N.parent().show();N.unbind("click").bind("click",function(){L();return false});C();B();$("a.add-journey").focus();A($("a.add-journey"));FC.positionHomeAd()}else{N.attr("class","add-journey").empty().append("Add a return journey").unbind("click").bind("click",function(){L();return false});C();B();$("a.add-journey").focus();A($("a.add-journey"));FC.positionHomeAd()}}else{if(FC.hasIE){I.removeClass("return-open");I.children().css({visibility:"hidden"});I.find(".date-picker-control").css({visibility:"hidden"});I.slideUp(400,function(){if(K=="showhide"){N.parent().show(400,function(){N.css({visibility:"visible"});$("a.add-journey").focus();A($("a.add-journey"))});N.unbind("click").bind("click",function(){L();return false});C();B();FC.positionHomeAd()}else{N.attr("class","add-journey").empty().append("Add a return journey").unbind("click").bind("click",function(){L();return false
});C();B();$("a.add-journey").focus();A($("a.add-journey"));FC.positionHomeAd()}});D.animate({top:"0"},400)}else{I.stop();I.animate({opacity:0},250,function(){I.removeClass("return-open");I.hide(400,function(){if(K=="showhide"){N.parent().show(400,function(){$(this).animate({opacity:1},250);$("a.add-journey").focus();A($("a.add-journey"))});N.unbind("click").bind("click",function(){L();return false});B();FC.positionHomeAd()}else{N.parent().animate({opacity:0},250,function(){N.attr("class","add-journey").empty().append("Add a return journey").unbind("click").bind("click",function(){L();return false});N.parent().animate({opacity:1},250);$("a.add-journey").focus();A($("a.add-journey"))});B();FC.positionHomeAd()}});D.animate({top:"0"},400)})}}if(document.getElementById("jpState")){document.getElementById("jpState").value="0"+document.getElementById("jpState").value.slice(1)}}if(document.getElementById("jpState")&&document.getElementById("jpState").value.charAt(0)==="1"){if(!FC.hasIE){N.parent().css({opacity:0});I.css({opacity:1})}else{I.children().css({visibility:"visible"})}J()}};FC.trainAction=function(){var B=$(FC.vars.selectors.TRAIN_ACTION);var C=$(FC.vars.selectors.TRAIN_ACTION_FIRST);var A=$(FC.vars.selectors.TRAIN_ACTION_SECOND);B.bind("change",function(){if(B.val()=="ARRIVALS"){C.text("at");A.text("from")}else{C.text("from");A.text("to")}})};FC.showHide=function(C,B,D,A,E){$(C).hide();$(D).bind("click",function(){$(B).find("input").attr("value","");$(B).hide();$(C).show();$(A).focus();var F=B;B=C;C=F;var G=A;A=E;E=G;return false})};FC.showHideSli=function(C,B,D,A,E){$(C).addClass("sliderHide");$(D).bind("click",function(){$(B).find("input").attr("value","");$(B).addClass("sliderHide");$(C).removeClass("sliderHide");$(A).focus();var F=B;B=C;C=F;var G=A;A=E;E=G;return false})};FC.journeyDates=function(H){var B={date:"txtDate",hours:"sltHours"};var A={date:"txtDateRet",hours:"sltHoursRet"};if(H===true){document.getElementById(A.date).value=document.getElementById(B.date).value;C(document.getElementById(B.hours).value)}var F=$("#"+B.date).bind("change",E);var G=$("#"+B.hours).bind("change",D);function E(J){var I=document.getElementById(A.date);I.value=this.value;I=null;if($.find(".return-open").length){F.unbind("change");F=null}}function D(I){C(this.value);if($.find(".return-open").length){G.unbind("change");G=null}element=null}function C(J){var I=document.getElementById(A.hours);var K=2;var J=parseFloat(J)+K;if(J<10){I.value="0"+J.toString()}else{I.value=J}I=null}};FC.popup=function(E,B){var F=B[0];var A=B[1];var C=B[2];var D=$("a"+F);D.bind("click",function(){myLinkLocation=$(this).attr("href");window.open(myLinkLocation,"windowname1","width="+A+", height="+C+", scrollbars=1");return false})};FC.tableRollover=function(E,C){var B=$,F=B.find(E+" tr"),D=function(G){B(this).addClass(G.data.a)},A=function(G){B(this).removeClass(G.data.a)};(function(G){while(G--){B(F[G]).bind("mouseover",{a:C},D).bind("mouseout",{a:C},A)}})(F.length)};FC.tableRolloverRadio=function(D,A){var B=$(D);var C=B.find("tr");var E=B.find("input[type=radio]");C.bind("mouseover",function(){$(this).addClass(A)});C.bind("mouseout",function(){var F=$(this).find("input[type=radio]");if(F.attr("checked")!==true){$(this).removeClass(A)}});E.bind("click",function(){C.removeClass("selected");$(this).parents("tr").addClass("selected")})};FC.spOne=function(A){sp.init();sp.addInputSet({from:A,to:$("#txtTo"),useGroups:true,useDLRLU:true,useUserStations:true,usePostcodes:true});sp.addInputSet({from:$("#txtViaAvDest"),useGroups:true})};FC.spTwo=function(A){sp.init();sp.addInputSet({from:A,to:$("#train-to")})};FC.spThree=function(A){sp.init();sp.addInputSet({from:A})};FC.spFour=function(A){sp.init();sp.addInputSet({from:A,to:$("#txtToCFF"),useGroups:true})};FC.spFive=function(A){sp.init();sp.addInputSet({from:A,to:$("#txtTo"),useGroups:true,useDLRLU:true,useUserStations:true,usePostcodes:false})};FC.askLisa=function(A){A.bind("submit",function(){var B=$(this).attr("action");window.open(B,"askLisa","width=350,height=580");return false})};FC.positionHomeAd=function(){if($(FC.vars.selectors.HOMEAD).length>0){var C=$("#ad-placeholder-homepage").position();var B=C.top;var A=C.left;$("div#ad-homepage").css({top:B+"px",left:A+"px",visibility:"visible"})}};FC.rePositionHomeAd=function(){if($(FC.vars.selectors.HOMEAD).length>0){$("div#ad-homepage").css({visibility:"hidden"})}};FC.positionAdlinkAds=function(){if($("#ad-placeholder-side").length>0){var C=$("#ad-placeholder-side").position();var B=C.top;var A=C.left;B+=5;A+=7;$("div#ad-side").css({top:B+"px",left:A+"px",visibility:"visible"})}$(window).trigger("resize.tooltip")};FC.positionFB=function(){if($("#ad-placeholder-top").length>0){var C=$("#ad-placeholder-top").position();var B=C.top;var A=C.left;A=A+770;$("#facebook").css({left:A+"px",display:"block"})}};FC.placeFB=function(){$("#facebook").append("<iframe src='//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%2Fnationalrailenq&amp;send=false&amp;layout=button_count&amp;width=100&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21' scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:80px; height:21px;' allowTransparency='true'></iframe>")};FC.positionPostPurchase=function(){if($("#ad-placeholder-pp-t").length>0){var C=$("#ad-placeholder-pp-t").offset();var B=C.top;var A=C.left;B+=5;A+=7;$("div#ad-postpurchase").css({top:B+"px",left:A+"px",visibility:"visible"})}if($("#ad-placeholder-pp-b").length>0){var C=$("#ad-placeholder-pp-b").offset();var B=C.top;var A=C.left;B+=5;A+=7;$("div#ad-postpurchase2").css({top:B+"px",left:A+"px",visibility:"visible"})}if($("#ad-placeholder-pp-mb").length>0){var C=$("#ad-placeholder-pp-mb").offset();var B=C.top;var A=C.left;$("div#ad-postpurchase3").css({top:B+"px",left:A+"px",visibility:"visible"})}};FC.preLoad=function(B,A){setTimeout(function(){var C=document.getElementsByTagName("head")[0];while(A[0].vars.preload.scripts.length){var E=document.createElement("script");E.type="text/javascript";E.src="/javascript/"+A[0].vars.preload.scripts.shift();C.appendChild(E)}while(A[0].vars.preload.css.length){var D=document.createElement("link");D.type="text/css";D.rel="stylesheet";D.href="/css/"+A[0].vars.preload.css.shift();D.media="screen";C.appendChild(D)}},6000)};FC.loadMap=function(A){getMap();getMap2();A.bind("click",function(){$this=$(this);$this.parent().find(".active").removeClass("active");if($this.attr("class")=="toMapLink"){$("#fromMap").hide();
$("#toMap").show()}if($this.attr("class")=="fromMapLink"){$("#toMap").hide();$("#fromMap").show()}$this.addClass("active");return false});$(".toMapLink").click()};FC.tabs=function(){var E=$(FC.vars.selectors.TABS_CONTAINER);var A=$(FC.vars.selectors.TAB_PANEL);var C=FC.vars.selectors.TAB_HEADING;var B=$(FC.vars.selectors.TAB_CONTENT);var D=FC.vars.selectors.TAB_START;$(E).addClass("tabs-active").prepend('<ul id="tabs" class="clear"></ul>');$(A,E).each(function(F){var G=F+1;var J=F+1;var H=$(this).children(C);var I=H.text();$("#tabs",E).append('<li><a href="#tab-'+G+'"><span>'+I+"</span></a></li>");$(this).attr("id","tab-"+J+++"");if(F===D){$(this).css({display:"block"}).addClass("active")}else{$(this).css({display:"none"})}if(FC.vars.selectors.HEADING_DISPLAY===0){$(H).css({height:"1px",width:"1px",position:"absolute",overflow:"hidden",top:"-10px"})}});$("#tabs li:eq("+D+")",E).addClass("selected");$("#tabs li a",E).click(function(G){var F=$(this).parent();if(!$(F).hasClass("selected")){$(F).addClass("selected").siblings().removeClass("selected")}$(A,E).each(function(H){if(H===F.index()){$(this).siblings("div").css({display:"none"}).removeClass("active");$(this).fadeIn(FC.vars.selectors.FX_SPEED).addClass("active")}});G.preventDefault()})};FC.basemapEasementSlider=function(){var B=$(FC.vars.selectors.BASEMAP_EASEMANT_HANDLE);var A=$(FC.vars.selectors.BASEMAP_EASEMANT_MESSAGEWINDOW);B.click(function(C){if(!B.hasClass("open-handle")){A.slideDown();B.addClass("open-handle")}else{A.slideUp();B.removeClass("open-handle")}C.preventDefault()})};(function(){var A=[];var F=document.cookie.indexOf("rsi_segs=");if(F>=0){F=document.cookie.indexOf("=",F)+1;if(F>0){var D=document.cookie.indexOf(";",F);if(D==-1){D=document.cookie.length}A=document.cookie.substring(F,D).split("|")}}var C=20;var E="";if(A.length<C){C=A.length}for(var B=0;B<C;B++){E+=("rsi="+A[B]+";")}window.segQS=E})();$(function(){FC.positionAdlinkAds();FC.positionHomeAd();FC.positionFB();FC.placeFB();FC.positionPostPurchase()});$(window).resize(function(){FC.positionAdlinkAds();FC.positionHomeAd();FC.positionFB();FC.positionPostPurchase()});$(function(F){var B=FC,D=B.vars.selectors;B.clearFields();if(F.find(D.HOMEPAGE).length){F(window).bind("load",B.tickerInit);if(F.find(D.HP_LIVE_TRAINS).length){}}if(F.find(D.TRAIN_ACTION).length){B.trainAction()}var C=navigator.userAgent.toLowerCase().indexOf("webkit")>-1;var E=navigator.userAgent.toLowerCase().indexOf("opera")>-1;if(C||E){var G=F("#skip-content");G.attr("href","#skip-content");G.text("Start of main content");G.attr("tabindex","0");F("#cont-skip").bind("click",function(){G.focus()});var A=F("#skip-nav");A.attr("href","#skip-nav");A.text("Start of main navigation");A.attr("tabindex","0");F("#nav-skip").bind("click",function(){A.focus()})}B.presentPass([{test:D.REGISTER_BUTTON,func:B.registerFlyout},{test:D.JP_TIMES,func:B.callingPoints},{test:D.TOOLTIP_HOLDER,func:B.tooltip},{test:D.ACCORDIAN,func:B.accordian},{test:D.ACCORDIAN_TABLE,func:B.accordianTable},{test:D.SHOW_MORE,func:B.showMore},{test:D.SMS_OPTIONS,func:B.smsOptions},{test:D.ALERT_POPUP,func:B.popup,args:[".alert-popup","668","500"]},{test:D.INPUT_BORDERS,func:B.formBorders},{test:D.SELECT_BORDERS,func:B.formBorders},{test:D.TXTAREA_BORDERS,func:B.formBorders},{test:D.CHKBOX_BORDERS,func:B.formBorders},{test:D.AMBIGOUS_STATION_ERROR_TO,func:B.resetUnknownStation},{test:D.AMBIGOUS_STATION_ERROR_FROM,func:B.resetUnknownStation},{test:D.JOURNEY_DATES,func:B.journeyDates},{test:"#txtFrom",func:B.spOne},{test:"#train-from",func:B.spTwo},{test:"#station",func:B.spThree},{test:"#txtFromCFF",func:B.spFour},{test:"#txtFromAW",func:B.spFive},{test:".homepage .timetable",func:B.initLTHP},{test:"#live-departure-board",func:B.initLTLDB},{test:"#live-departure-details",func:B.initLTLDD},{test:"#ask_lisa_form",func:B.askLisa},{test:"#homepage",func:B.preLoad,args:[B]},{test:"#route-map",func:B.routeMap},{test:"a.view-summary",func:B.viewSummary},{test:"#add-fares",func:B.addFares},{test:"#share",func:B.shareMenu},{test:".toMapLink, .fromMapLink",func:B.loadMap},{test:D.CTF_PROVIDER,func:B.CtfChooseTOC},{test:"#pp-share",func:B.ppShare},{test:D.OTHER_FARES,func:B.otherFaresPopup},{test:D.TABS_CONTAINER,func:B.tabs},{test:D.BASEMAP_EASEMANT_HANDLE,func:B.basemapEasementSlider}]);if(F.find(D.PT).length){B.PT()}if(F.find(D.JOURNEY_PLANNER).length){B.addJourney();FC.presentPass([{test:D.AD_SEARCH_HOLDER,func:B.advancedSearch}])}if(F.find(D.FARE_FIND).length){B.timeRange();B.rcards();B.tocs();B.fareStates();B.increment("#adults");B.increment("#children");B.presentPass([{test:D.TICKET_PROVIDER,func:B.chooseTOC},{test:D.RESULTS_TABLE,func:B.resultsTable}])}if(F.find(D.RESULTS_TABLE).length&&!F.find(D.JP_TIMES).length){B.callingPoints()}if(F.find("#ctf-details").length){B.printButtonOld()}if(F.find("#ctf-results").length){B.faresMore();B.basket();B.fareSwticher();B.printButton();B.editJourneyLink(F("#edit_ur_jorney_btn"));B.otherCheapFaresReveal(F("#other-cheap-fares"));B.resultsTable("#ctf-results table");B.increment("#adults");B.increment("#children");B.rcards()}if(F.find("table").length){B.tableRollover(".train-dates","rollover");B.tableRolloverRadio(".train-times","selected")}dp.init()}(jQuery));
