(function(a){function b(a){return a&&a.constructor===Number?a+"px":a}a.fn.bgiframe=a.browser.msie&&/msie 6\.0/i.test(navigator.userAgent)?function(c){var c=a.extend({top:"auto",left:"auto",width:"auto",height:"auto",opacity:!0,src:"javascript:false;"},c),g='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+c.src+'"style="display:block;position:absolute;z-index:-1;'+(c.opacity!==!1?"filter:Alpha(Opacity='0');":"")+"top:"+(c.top=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+'px')":
b(c.top))+";left:"+(c.left=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+'px')":b(c.left))+";width:"+(c.width=="auto"?"expression(this.parentNode.offsetWidth+'px')":b(c.width))+";height:"+(c.height=="auto"?"expression(this.parentNode.offsetHeight+'px')":b(c.height))+';"/>';return this.each(function(){a(this).children("iframe.bgiframe").length===0&&this.insertBefore(document.createElement(g),this.firstChild)})}:function(){return this};a.fn.bgIframe=a.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:1E3,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:!1,$picker:null,hasInit:!1,cache:{},DLRLUcache:{},init:function(){if(this.hasInit)return!1;this.$picker=
$("#picker");this.$picker.click(function(a){var b=$.browser.msie,c=b?a.target.parentElement:a.target.parentNode,b=b?c.tagName:c.localName;b.toLowerCase()==="li"?sp.selectItem(c):b.toLowerCase()==="ul"&&sp.selectItem(a.target)});$(window).bind("blur",function(){sp.$picker.hasClass("sp-visible")&&sp.listSelect("CLEAR")});this.hasInit=!0},addInputSet:function(a){if(!a.from.length)return!1;a.from.data("inputOptionsIndex",this.currentInputOptions.length);this.setUpInput(a.from);a.to?(a.single=!1,a.to.data("inputOptionsIndex",
this.currentInputOptions.length),this.setUpInput(a.to)):a.single=!0;if(!a.dataURL)a.dataURL=a.useDLRLU?this.defaultDLRLUFeed:this.defaultFeed;a.userStations=a.useUserStations?this.parseFavorites():!1;this.currentInputOptions[this.currentInputOptions.length]=a},setUpInput:function(a){var b=a.attr("stype");a.attr("autocomplete","off").attr("spellcheck","false");a.outerHeight()&&a.next("span").css("height",(a.outerHeight()-2).toString()+"px");if(b){var c=16;b=="dlrlu"&&(c=40);b=="dlr"&&(c=22);this.setIcon(a,
b,c)}a.focus(function(){var b=a.offset();clearTimeout(sp.blurTimer);sp.currentInput&&(sp.listSelect("CLEAR"),sp.currentInput.parent().removeClass("sp-hasfocus"));sp.currentInputIndex=a.data("inputOptionsIndex");sp.currentInput=a;sp.$picker.css("top",(b.top+a.height()+7).toString()+"px");sp.$picker.css("left",(b.left-1).toString()+"px");sp.$picker.css("min-width",(a.parent().width()-20).toString()+"px");sp.getCurrentInput("OPTIONS").useDLRLU&&sp.$picker.find("#je").css("max-width",(a.parent().width()-
20).toString()+"px");sp.getCurrentInput("OPTIONS").usePostcodes?($("#sp-p2pad").show().prev("li").show().prev("hr").show(),sp.getCurrentInput("OTHER").getAttribute("stype")==="pc"&&$("#sp-p2pad").hide().prev("li").hide().prev("hr").hide()):$("#sp-p2pad").hide().prev("li").hide().prev("hr").hide();sp.$picker[0].className="sp-visible loading";a.parent().addClass("sp-hasfocus");a.data("focused")?a.val().length<1?sp.$picker[0].className="sp-visible":(clearTimeout(sp.keyDownTimer),sp.keyDownTimer=setTimeout(sp.keyDownTimerHandler,
sp.keyDownTimeout)):(sp.removeIcon(sp.currentInput),sp.$picker[0].className="sp-visible",a.data("focused",!0))});a.blur(function(){sp.blurTimer=setTimeout(sp.blurTimerHandler,150,[sp.currentInput]);sp.currentListIndex=0});a.bind("keydown",function(a){switch(a.keyCode){case 38:a.preventDefault();sp.deselectItem();sp.listSelect("UP");break;case 40:a.preventDefault();sp.deselectItem();sp.listSelect("DOWN");break;case 9:sp.inList?sp.listSelect("SELECT"):sp.currentInput.val().length>0&&sp.listSelect("AUTO-SELECT");
break;case 13:a.preventDefault();sp.inList?sp.listSelect("SELECT"):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)}})},blurTimerHandler:function(){if(!sp.$picker.hasClass("j-error"))sp.$picker[0].className="";sp.currentInput&&sp.currentInput.parent().removeClass("sp-hasfocus");sp.currentInput=!1},keyDownTimerHandler:function(){if(!sp.currentInput)return!1;
var a=$.trim(sp.currentInput.val().toLowerCase());sp.getCurrentInput("OPTIONS");var b=sp.getCurrentInput("CACHE");sp.listSelect("CLEAR");switch(a.length){case 0:sp.$picker[0].className="sp-visible";break;case 1:if(!b[a]){sp.sendOjpRequest(a.charAt(0));break}default:if(/[0-9]/.test(a)){sp.checkPostCode();break}b[a.charAt(0)]?sp.queryCache(a):sp.sendOjpRequest(a.charAt(0))}},listSelect:function(a){var b,c;b=(this.currentInput&&this.currentInput.val().length>0?this.getCurrentList():$("#d")).children();
c=b.length;if(this.hasAnyClass(b.get(this.currentListIndex))&&b.get(this.currentListIndex).className==="sel")b.get(this.currentListIndex).className="";if(b.length===0)return!1;switch(a){case "UP":if(this.inList){if(this.currentListIndex--,this.hasAnyClass(b.get(this.currentListIndex))&&this.currentListIndex--,this.currentListIndex<0)this.currentListIndex=c-1}else this.inList=!0,this.currentListIndex=c-1;this.hasAnyClass(b.get(this.currentListIndex))&&this.currentListIndex--;b.get(this.currentListIndex).className=
"sel";break;case "DOWN":if(this.inList){if(this.currentListIndex++,this.hasAnyClass(b.get(this.currentListIndex))&&this.currentListIndex++,this.currentListIndex>c-1)this.currentListIndex=0}else this.inList=!0,this.currentListIndex=0;this.hasAnyClass(b.get(this.currentListIndex))&&this.currentListIndex++;b.get(this.currentListIndex).className="sel";break;case "SELECT":this.selectItem(b.get(this.currentListIndex));b.get(this.currentListIndex).className="";this.currentListIndex=0;this.inList=!1;break;
case "AUTO-SELECT":this.hasAnyClass(b.get(this.currentListIndex))&&this.currentListIndex++;this.hasAnyClass(b.get(this.currentListIndex))||(b=b.get(this.currentListIndex),(document.all?b.innerText:b.textContent).toLowerCase().indexOf(this.currentInput[0].value.toLowerCase())>-1&&this.selectItem(b));break;case "CLEAR":for(a=b.length-1;a>=0;a--)if(this.hasAnyClass(b[a])&&b[a].className==="sel")b[a].className="";this.currentListIndex=0;this.inList=!1}},sendOjpRequest:function(a){var b=this.getCurrentInput("OPTIONS"),
c="",c=b.single||!b.useDLRLU?b.dataURL+a:this.currentInput[0].id===b.from[0].id?b.to.val()===b.to[0].defaultValue?b.dataURL+a:b.dataURL+a+"/"+b.to.val():b.from.val()===b.from[0].defaultValue?b.dataURL+a:b.dataURL+a+"/"+b.from.val();$.ajax({dataType:"jsonp",url:c,success:this.cacheAjaxData,error:this.showServiceError})},sendPostcodeRequest:function(a){$.ajax({dataType:"jsonp",url:this.postcodeFeed+a,success:this.postcodeHandler,error:this.showServiceError})},postcodeHandler:function(a){a.length===
0?sp.showPostcodeMessage("red","Postcode not found","Sorry, we can't find any stations for this postcode.",!1):sp.showPostcodeMessage("green","Postcode found","Please continue specifying your journey.",!1)},queryCache:function(){var a=sp.currentInput.val(),b=a.charAt(0).toLowerCase(),c=RegExp("(^| )"+a.toLowerCase()),g=sp.getCurrentInput("CACHE"),b=$.grep(g[b],function(a){return c.test(a[1].toLowerCase())||c.test(a[0].toLowerCase())}).sort(function(b,c){var d=a.toLowerCase(),g=b[0].toLowerCase(),
k=b[1].toLowerCase(),h=c[0].toLowerCase(),s=c[1].toLowerCase();if(d.length==3){if(g==d)return-1;if(h==d)return 1}a_matches_at_front=k.indexOf(d)==0;b_matches_at_front=s.indexOf(d)==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=[k,s];station_names_alphabetically=station_names.sort();return station_names_alphabetically[0]==k?-1:1});sp.processData(b)},cacheAjaxData:function(a){var b=sp.currentInput.val().charAt(0).toLowerCase();
sp.getCurrentInput("CACHE")[b]=a;sp.currentInput.val().length>1?sp.queryCache():sp.processData(a)},checkPostCode:function(){var a=sp.currentInput.val().toUpperCase().replace(/ /g,""),b=this.getCurrentInput("OTHER"),c=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})$");this.getCurrentInput("OPTIONS").usePostcodes!==!0?this.showPostcodeMessage("red","Postcode not allowed",
"Sorry, we can't take postcodes here.",!1):b.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",!1):c.test(a)?(sp.currentInput.attr("stype","pc"),sp.sendPostcodeRequest(a),this.showPostcodeMessage("green","Postcode valid","Please wait, checking that postcode exists...",!1)):a.replace(/ /g,"").length<6?this.showPostcodeMessage("gray","Postcode search","Please keep typing...",
!1):this.showPostcodeMessage("red","Postcode not found","Please keep typing or try again...",!0)},showPostcodeMessage:function(a,b,c,g){clearTimeout(sp.postcodeMessageTimer);var e='<li class="no-sel no-pad"><span class="A">B</span>C</li>',e=e.replace(/A/,a),e=e.replace(/B/,b),e=e.replace(/C/,c),a=function(){$("#sp-postcode").html(e);sp.$picker[0].className="sp-visible postcode"};g?sp.postcodeMessageTimer=setTimeout(a,sp.postcodeMessageTimeout):a()},processData:function(a){var b=sp.currentInput.val(),
c=sp.getCurrentInput("OPTIONS"),g,e=!1,f="";if(a===null)return sp.showServiceError(),!1;else g=a.length;if(!c.useUserStations&&g===0)return sp.$picker[0].className="sp-visible nothing",!1;if(c.useUserStations){var d=c.userStations,j=[],k;for(k in d){for(var h=d[k].length-1;h>=0;h--)b.toLowerCase()===d[k][h][1].slice(0,b.length).toLowerCase()&&(j[j.length]=d[k][h]);j.length&&(e=!0,f+='<li class="h">'+k+"</li>",f+=sp.makeList(j,c,b,e),f+='<hr class="sp" />');j=[]}}f+=e?'<li class="h">All</li>':"";f+=
sp.makeList(a,c,b,e);for(f.slice(f.length-2,f.length)==="/>"&&(f=f.slice(0,f.length-21));f.split("</li>").length>sp.maxItems;)f=f.slice(0,f.lastIndexOf("<li"));g>sp.maxItems&&(f+="<li class='more' title='...for "+(g-sp.maxItems)+" more stations'><hr class='sp' />Continue typing to see more results...</li>");sp.getCurrentList()[0].innerHTML=f;f===""?sp.$picker[0].className="sp-visible nothing":sp.setPickerClass()},selectItem:function(a){if(a===void 0)return!1;var b=document.all?a.innerText:a.textContent,
c=a.getAttribute("stype"),g=a.getAttribute("sok"),e=/lu/,f=/dlr/,d;if(this.getCurrentInput("OPTIONS").useDLRLU&&!this.getCurrentInput("OPTIONS").single){switch(c){case "dlr":b=b.slice(0,b.length-3);this.setIcon(this.currentInput,"dlr",22);break;case "lu":b=b.slice(0,b.length-3);this.setIcon(this.currentInput,"lu",16);break;case "dlrlu":b=b.slice(0,b.length-3);this.setIcon(this.currentInput,"dlrlu",40);break;default:this.removeIcon(this.currentInput)}c=this.getCurrentInput("OTHER");if(c.getAttribute("stype")&&
(c=c.getAttribute("stype"),d=this.currentInput[0].getAttribute("stype"),(e.test(c)||f.test(c))&&(e.test(d)||f.test(d))))g="false";this.currentInput.val().length>1&&g==="false"?(this.currentInput.parent().addClass("sp-error"),this.$picker[0].className="sp-visible j-error",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="/redesign/default/images/icon-',this.getCurrentInput("FROM")[0].getAttribute("stype"),
'.png" alt="DLR" /> to <img src="/redesign/default/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(""))):(this.currentInput.parent().removeClass("sp-error"),this.$picker[0].className="")}else if(c&&
!this.getCurrentInput("OPTIONS").single)this.$picker[0].className="sp-visible j-error";sp.hasAnyClass(a)||sp.currentInput.val(sp.formatSelection(b))},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];case "TO":return this.currentInputOptions[this.currentInputIndex].to;
case "OTHER":return this.currentInputOptions[this.currentInputIndex].single?!1:this.currentInputOptions[this.currentInputIndex].to[0].id===this.currentInput[0].id?this.currentInputOptions[this.currentInputIndex].from[0]:this.currentInputOptions[this.currentInputIndex].to[0];case "CACHE":return this.currentInputOptions[this.currentInputIndex].useDLRLU?sp.DLRLUcache:sp.cache;default:return this.currentInputOptions[this.currentInputIndex].from}},getFavorites:function(){var a=this.getCurrentInput("OPTIONS");
return typeof a==="undefined"||typeof a.userStations==="undefined"?!1:a.userStations},parseFavorites:function(){var a=$("#d");if(a.children("[stype]").length==0)return!1;a=a.children("li");this.getCurrentInput("OPTIONS");var b={},c="";a.each(function(){if(this.className=="h")c=this.innerHTML,b[c]=[];if(this.getAttribute("stype")){var a=this.innerHTML,e=$.trim(a.split(" - ")[0]),a=$.trim(a.split(" - ")[1]).replace("[","").replace("]",""),f=0;a.indexOf("img")>0&&(a="");switch(this.getAttribute("stype")){case "nr":f=
0;break;case "dlr":f=4;break;case "lu":f=5;break;case "dlrlu":f=6}b[c].push([a,e,f,1])}});return b},hasAnyClass:function(a){return a===void 0||a.className===null?!1:a.className.length>0},setIcon:function(a,b,c){var g=a.next("span");a.parent().addClass("sp-has-icon");g[0].className="sp-icon-holder sp-icon-"+b;a.css("width","");a.css("width",(a.width()-c-4).toString()+"px");a[0].setAttribute("stype",b)},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(a,b,c,g){for(var e=[],c=RegExp(c,"i"),f,d,j=0,k=a.length-1;j<=k;j++)if(b.useGroups||!(a[j][0].length>3)){f=a[j][1].replace(c,"<strong>$&</strong>");d=a[j][0].replace(c,"<strong>$&</strong>");e[e.length]=g?'<li style="margin-left:85px"':"<li ";if(b.useDLRLU)switch(a[j][2]){case 4:e[e.length]='stype="dlr" sok="';e[e.length]=a[j][3]===1;e[e.length]='"> ';e[e.length]=f;e[e.length]=" - [<img src='/redesign/default/images/icon-dlr.png' width='22' height='12' alt='DLR' />]";
break;case 5:e[e.length]='stype="lu" sok="';e[e.length]=a[j][3]===1;e[e.length]='"> ';e[e.length]=f;e[e.length]=" - [<img src='/redesign/default/images/icon-tube-sm.png' width='15' height='12' alt='Tube' />]";break;case 6:e[e.length]='stype="dlrlu" sok="';e[e.length]=a[j][3]===1;e[e.length]='"> ';e[e.length]=f;e[e.length]=" - [<img src='/redesign/default/images/icon-dlrlu.png' width='40' height='12' alt='DLR Tube' />]";break;default:e[e.length]='stype="nr" sok="',e[e.length]=a[j][3]===1,e[e.length]=
'"> ',e[e.length]=f,e[e.length]=" - [",e[e.length]=d,e[e.length]="]"}else e[e.length]=">",e[e.length]=f,e[e.length]=" - [",e[e.length]=d,e[e.length]="]";e[e.length]="</li>"}return""+e.join("")},getCurrentList:function(){return $("#p1 ul").eq(0)},setPickerClass:function(){this.$picker[0].className=this.currentInput.val().length>0?"sp-visible p1":" sp-visible"},showServiceError:function(){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>')}},
dp={calURL:"/service/datepicker",monthsLoaded:!1,currentMonth:0,currentInput:!1,calEventsAdded:!1,blurTimer:"",monthCount:0,mousedown:!1,init:function(){$(".date-picker-control").bind("click",dp.buttonClickHandler).bind("blur",dp.blurHandler);$(".w3em").bind("click",dp.inputClickHandler).bind("blur",dp.blurHandler)},blurHandler:function(){if(!dp.mousedown)dp.blurTimer=setTimeout("dp.hideDP()",200)},cancelBlurHandler:function(){clearInterval(dp.blurTimer)},buttonClickHandler:function(a){a.preventDefault();
a.stopPropagation();dp.calEventsAdded||dp.addCalendarEvents();dp.currentInput[0]&&this===dp.currentInput.siblings()[0]?dp.hideDP():(a=$(this),dp.clearDate(),a.focus(),dp.currentInput=a.siblings("input.w3em"),dp.currentInput.data("buttonEvents")||dp.addButtonEvents(a),dp.monthsLoaded||dp.loadHTML(),dp.showDP(),dp.cancelBlurHandler())},inputClickHandler:function(a){a.stopPropagation();dp.currentInput=$(this);dp.calEventsAdded||dp.addCalendarEvents();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(){dp.currentInput&&dp.hideDP()});this.calEventsAdded=
!0},addButtonEvents:function(a){a.bind("keydown",dp.kbEventHandler);dp.currentInput.data("buttonEvents",!0)},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:dp.currentInput&&(a.preventDefault(),dp.selectDate(parseInt(dp.currentInput.data("td").innerHTML),!1),dp.hideDP())}},navigate:function(a){var b=$(dp.currentInput.data("td")),c;b.removeClass("dp-sel");b.removeClass("dp-hover");switch(a){case 37:c=
b.prev();c.length||(c=b.parent().prev("tr").children().last());break;case 38:c=b.parent().prev("tr").children().eq(b.siblings("td").andSelf().index(b[0]));break;case 39:c=b.next();c.length||(c=b.parent().next("tr").children().first());break;case 40:c=b.parent().next("tr").children().eq(b.siblings("td").andSelf().index(b[0]))}if(!c||!c.length||/nbsp/.test(c.html())||c.children("span").length)if(c=b,(a===37||a===38||a===34)&&dp.currentMonth>0)dp.prevMonth(),c=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(),c=dp.$months.eq(dp.currentMonth).find("tbody > tr:first-child > td.dp-first");c.addClass("dp-hover");dp.currentInput.data("td",c[0])},loadHTML:function(){function a(){dp.$months=$("table",dp.$cal);dp.showMonth(0);dp.$prev.hide();dp.currentInput.data("td")||dp.currentInput.data("td",$("td.dp-now",dp.$cal)[0]);dp.monthsLoaded=!0;dp.getDateFromInput()}$("table",dp.$cal).length&&a();dp.monthsLoaded||$("#dp > div").load("/service/datepicker",
a)},getDateFromInput:function(){var a=dp.currentInput.val(),b=a.split("/"),c;$.trim(a.toLowerCase())==="tomorrow"?(c=$("td.dp-tomorrow",dp.$cal),a=0):b.length===3?(a=b[1]-parseInt(dp.$monthLabels.eq(0).attr("title").slice(1,3)),a<0&&(a+=12),c=dp.$months.eq(a),c=$("td",c).filter(function(){if($.trim(this.innerText||this.textContent)===b[0])return!0})):(c=$("td.dp-now",dp.$cal),a=0);c&&c.length&&(dp.showMonth(a),dp.currentInput.data("td",c[0]))},dpClickHandler:function(a){a.preventDefault();a.stopPropagation();
if(a.target.tagName.toLowerCase()==="td"){var b=parseInt(a.target.innerHTML);isNaN(b)||(dp.clearDate(),a.target.className+=" dp-sel",dp.currentInput.data("td",a.target),dp.selectDate(b,!1))}a.target.tagName.toLowerCase()==="li"&&(a.preventDefault(),dp.clearDate(),dp.selectDate(a.target.innerHTML,!0))},dpMousedownHandler:function(){dp.mousedown=!0},dpMouseupHandler:function(){dp.mousedown=!1},nextMonth:function(){dp.cancelBlurHandler();dp.currentMonth<dp.monthCount-1&&(dp.currentMonth++,dp.showMonth(dp.currentMonth))},
prevMonth:function(){dp.cancelBlurHandler();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,b){var c;b||(a=parseInt(a),a=a<10?"0"+a.toString():a.toString());c=b?a:a+dp.$monthLabels.eq(dp.currentMonth)[0].getAttribute("title");
dp.currentInput.val(c);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 a=dp.currentInput.offset(),b=a.top-$(window).scrollTop(),b=$(window).height()-b;dp.$cal.css("top",(a.top+dp.currentInput.height()+7).toString()+"px");dp.$cal.css("left",(a.left-1).toString()+"px");dp.$months&&dp.getDateFromInput();dp.currentInput.data("td")&&(dp.currentInput.data("td").className+=
" dp-sel");dp.$cal.show();b<dp.$cal.outerHeight()+dp.currentInput.outerHeight()+12&&dp.$cal.css("top",(dp.$cal.offset().top-dp.$cal.height()-dp.currentInput.height()-25).toString()+"px")},hideDP:function(){dp.clearDate();dp.currentInput=!1;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:"/redesign/default/images/clear.gif",TICKER_INFO:"http://nationalrail.co.uk/dynjs/newsflash/newsflash_homepage.js",PREDICTIVE_FEED:"/redesign/default/javascript/stations-json.js",
MORE_FARES_JSON:"/service/timesandfares/ajaxAllFares",ALL_FARES_JSON:"/service/timesandfares/ajaxAllFares",ALT_INIT:"/service/purchaseticket/alternativespopup",ALT_ELTRAINS:"/service/purchaseticket/alternativespopup"},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:"/service/ticketterms/show?",
ANYTIME_SINGLE_INFO:"Anytime Single",ANYTIME_RETURN_INFO:"Anytime Return",ANYTIME_INFO_LINK:"/service/ticketterms/show?",OFF_PEAK_SINGLE_INFO:"Off-Peak Single",OFF_PEAK_RETURN_INFO:"Off-Peak Return",OFF_PEAK_INFO_LINK:"/service/ticketterms/show?"},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:8E3,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(a,b){var c=document,g=c.body.style,e=navigator.userAgent.toLowerCase();__dateString=a;onYesClickHandler=function(){if(FC.hasLteIE6)$("iframe.hideSelect").remove(),g.height="auto",g.width="auto",c.documentElement.style.overflow="";$("div.modal-popup").remove();$("div.overlay").remove();return!1};confirmAction=function(a){var d=/mac/,j=/firefox/;try{FC.hasLteIE6?(g.height="100%",g.width="100%",c.documentElement.style.overflow="hidden",$("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>')):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 k=
$("div.overlay"),h=$("div.modal-popup");d.test(e)&&j.test(e)?k.addClass("overlayMacFFBGHack"):k.addClass("overlayBG");$("p.popup-text").text(b);h.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:a},onYesClickHandler).focus();var s=h.outerHeight();h.outerHeight();var n=$(window).scrollTop()-Math.round(s/2),l=Math.round(h.outerWidth()/2);h.css({marginLeft:"-"+l+"px"});FC.hasLteIE6?$(window).scrollTop(0):
h.css({marginTop:n+"px"})}catch(o){}};confirmAction()};
FC.altTrains=function(a){function b(a){a.preventDefault();k=a.target;f=k.className;f==""&&(f=k.paparentElement?k.parentElement.className:k.parentNode.className);switch(f){case "other-fares-popup-link":d=FC.vars.paths.ALT_INIT;j=k.href.toString().slice(k.href.toString().lastIndexOf("?")+1);$.ajax({dataType:"html",url:d,data:j,success:e,error:g});break;case "ctf-earlier":d=FC.vars.paths.ALT_ELTRAINS;j=k.href.toString().slice(k.href.toString().lastIndexOf("?")+1);c();break;case "ctf-later":d=FC.vars.paths.ALT_ELTRAINS,
j=k.href.toString().slice(k.href.toString().lastIndexOf("?")+1),c()}}function c(){$.ajax({dataType:"html",url:d,data:j,success:e,error:g})}function g(){$("div.other-fares-popup");popop.replaceWith("<p>Sorry, there has been an error. Please try again</p>")}function e(c){var e=$("div.other-fares-popup");e&&(e.replaceWith(c),e=$("div.other-fares-popup"),FC.hasLteIE6?($("div.other-fares-popup span.ctf-earlier a").live("click",b),$("div.other-fares-popup span.ctf-later a").live("click",b)):(e.find("span.ctf-earlier a").bind("click",
b),e.find("span.ctf-later a").bind("click",b)));try{a.preventDefault()}catch(d){}otherFares=$(FC.vars.selectors.OTHER_FARES);FC.otherFaresPopup(otherFares,!0);FC.tooltip(e.find(".tooltip"))}var f,d,j,k;b(a)};
FC.otherFaresPopup=function(a,b){var c=document,g=c.body.style,e=navigator.userAgent.toLowerCase();try{a.unbind("click")}catch(f){}a.bind("click",function(a){a.preventDefault();FC.altTrains(a)});onYesClickHandler=function(){if(FC.hasLteIE6)$("iframe.hideSelect").remove(),g.height="auto",g.width="auto",c.documentElement.style.overflow="";$("div.other-fares-popup").hide();$("div.overlay").remove();return!1};confirmAction=function(a){var b=/mac/,f=/firefox/;try{var h=$("div.other-fares-popup"),s=h.outerHeight();
h.outerHeight();var n=$(window).scrollTop()-Math.round(s/2),l=Math.round(h.outerWidth()/2);if(FC.hasLteIE6){g.height="100%";g.width="100%";$(window).scrollTop();c.documentElement.style.overflow="hidden";var o=$(window).height(),p=$(window).width();if($("iframe.hideSelect").length===0){$("body .otherFaresContainer").prepend('<iframe class="hideSelect"></iframe><div class="overlay overlayBG"></div>');var m=$("body .otherFaresContainer").find("div.overlay");m.width(p);m.height(o)}}else document.getElementById("overlay")||
$("body .otherFaresContainer").prepend('<div id="overlay" class="overlay"></div>');var w=$("#overlay");b.test(e)&&f.test(e)?w.addClass("overlayMacFFBGHack"):w.addClass("overlayBG");h.prepend('<a class="close-button" href="#">Close</a>');$(document).keyup(function(a){a.keyCode=="27"&&onYesClickHandler()});h.css({marginLeft:"-"+l+"px"});FC.hasLteIE6?($(window).scrollTop(0),h.css({marginTop:"0px"}),h.css("top","30px")):h.css({marginTop:n+100+"px"});h.show();h.find("a.close-button").bind("click",{callback:a},
onYesClickHandler).focus()}catch(y){}return!1};b==!0&&confirmAction()};FC.presentPass=function(a){for(var b=$,c,g,e=0;g=a[e++];)(c=b(g.test))&&c.length&&g.func(c,g.args||null)};
FC.formBorders=function(a){var b=a.find("input, select, textarea"),c,g,e,f=function(){var a=this.parentNode,b=a.parentNode,d=b.parentNode,f=/invalid/,n=/invalid-large/;if(!/hidden-border/.test(a.className))g=!!f.test(b.className),c=!!n.test(d.className),e=!!f.test(d.className)&&!c,a.style.backgroundColor="#ffe155"},d=function(){var a=this.parentNode;a.className.indexOf("hidden-border")===-1&&(c||g||e)?a.style.backgroundColor="#ff0000":a.style.background="none"};(function(){for(var a=b.length;a--;)$(b[a]).bind("focus",
f).bind("blur",d)})()};
FC.presentPass([{test:FC.vars.selectors.SIDE_TABS,func:function(a){var b=document,c=$,g=b.body.style,e=a.children("ul"),f=e.children("li"),d=f.find("div.side-tab-content"),j=d.length,k=!!/fixed/.test(a[0].className),h=0,s,n=f.length,l=navigator.userAgent.toLowerCase(),o=function(a){if(FC.hasLteIE6)$("iframe.hideSelect").remove(),g.height="auto",g.width="auto",b.documentElement.style.overflow="";$("div.modal-popup").remove();$("div.overlay").remove();a.data.callback(!0);return!1},p=function(a){if(FC.hasLteIE6)$("iframe.hideSelect").remove(),
g.height="auto",g.width="auto",b.documentElement.style.overflow="";$("div.modal-popup").remove();$("div.overlay").remove();a.data.callback(!1);return!1},m=function(a){var c=/mac/,e=/firefox/;try{FC.hasLteIE6?(g.height="100%",g.width="100%",b.documentElement.style.overflow="hidden",$("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>')):
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 d=$("div.overlay"),f=$("div.modal-popup");c.test(l)&&e.test(l)?d.addClass("overlayMacFFBGHack"):d.addClass("overlayBG");
$("p.popup-text").text(FC.vars.messages.CONFIRM_ACTION);f.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:a},o).focus();$("a.popup-no").bind("click",{callback:a},p);var h=f.outerHeight();f.outerHeight();var j=$(window).scrollTop()-Math.round(h/2),k=Math.round(f.outerWidth()/2);f.css({marginLeft:"-"+k+"px"});FC.hasLteIE6?$(window).scrollTop(0):
f.css({marginTop:j+"px"})}catch(s){}},w=function(a){for(var b=n,c;b--;)c=f[b],c.className=c.className.replace(/ selected/g,"");a[0].parentNode.parentNode.className+=" selected";k?(__listHeight=e.height()-40,FC.hasIE6&&(__listHeight=e.height()-66),a.parent().siblings("div.side-tab-container").find("div.side-tab-content").height(__listHeight)):(__listHeight=a.parent().siblings("div.side-tab-container").height()-52,e.height(__listHeight))};f.find("div.tab a").unbind().bind("click",function(){var a=$(this),
b,c,e,d,g,h=/selected/,j=function(){for(var a=n,b;a--;)if((b=f[a])&&h.test(b.className))return b}();if(/confirmChange/.test(j.className)){s=!1;if(b=j.getElementsByTagName("input"))for(d=b.length;d--;)if(g=b[d],g.type==="radio"){if(g.checked!==g.defaultChecked){s=!0;break}}else if(g.value!==g.defaultValue){s=!0;break}if(!s&&(c=j.getElementsByTagName("select")))for(d=c.length;d--;)if(e=c[d],!e.options[e.selectedIndex].defaultSelected){s=!0;break}s?m(function(f){var h=0;if(f){if(b)for(d=b.length;d--;)g=
b[d],g.type==="radio"?g.checked=g.defaultChecked:g.value=g.defaultValue;if(c||(c=j.getElementsByTagName("select")))for(d=c.length;d--;){e=c[d];for(f=e.length;h<f;h++)if(e.options[h].defaultSelected){e.options[h].selected="selected";break}}w(a)}}):w(a)}else w(a);return!1});if(k){for(;j--;)c=$(d[j]).height(),c>h&&(h=c);if(e.height()<h)e.height(h);else{__listHeight=e.height()-40;for(j=d.length;j--;)$(d[j]).height(__listHeight)}}else c(f[0]).find("div.tab a").trigger("click");d=f.filter(".confirmChange").find("div.side-tab-content");
d.find("div.error-message a").unbind();d.find("button").unbind();if(window.location.href.indexOf("st=")>-1&&a.hasClass("my-account")){a=window.location.href;a=a.slice(a.indexOf("?")+1).toLowerCase().split("&");d=[];for(j=0;j<a.length;j++)c=a[j].split("="),c.length>1&&(h=c[0].replace(/[^-a-z]/ig,""),c=c[1].replace(/[^-a-z]/ig,""),d.push(h),d[h]=c);switch(d.length>0?d.st:"notset"){case "overview":f.find("div.tab a").eq(0).trigger("click");break;case "alerts":f.find("div.tab a").eq(1).trigger("click");
break;case "stations":f.find("div.tab a").eq(2).trigger("click");break;case "journeys":f.find("div.tab a").eq(3).trigger("click");break;case "timetables":f.find("div.tab a").eq(4).trigger("click");break;case "sitepreferences":f.find("div.tab a").eq(5).trigger("click");break;case "details":f.find("div.tab a").eq(6).trigger("click");break;default:f.find("div.tab a").eq(0).trigger("click")}}else f.find("div.tab a").eq(0).trigger("click")}}]);
FC.tooltip=function(a,b){function c(){var a=$.data(this,"vars"),b=a.slowerTrains,c=a.tooltip;w.html(a.content);c.append(m);m.bgiframe();var e,d=y,f=$(h),g,j,k=d[0].className.replace(/tooltip|first/g,"").replace(/\s*/g,""),a=d.offset(),r=d.width(),l=d.height(),p=m.width(),o=m.height(),q={width:(h.innerWidth||$(h).width())-20,height:h.innerHeight||$(h).height()},f={top:f.scrollTop(),left:f.scrollLeft()},n={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]}};k||d.parents(".TIMs").length&&(k="operators");switch(k){case "changestip":case "changestip-link":d=n.changes;break;case "statustip":d=n.statustip;break;case "operators":case "facilitiestip":case "factip-ctl":d=n.facilitiestip;break;default:d=n.generic}for(var q={left:a.left-f.left-p+d.lt[0]>0,right:a.left-f.left+r+p+d.rt[0]<q.width,top:a.top-o+l/2+d.lt[1]-
f.top>0,bot:a.top+l/2+o-f.top+d.lb[1]<q.height},k=a.left+r+d.rb[0],f=a.left+r+p+d.rb[0],n=a.top+l/2+d.rb[1],t=a.top+l/2+o+d.rb[1],x=a.left+r+d.rt[0],r=a.left+r+p+d.rt[0],u=a.top+l/2-o+d.rt[1],v=a.top+l/2+d.rt[1],z=a.left-p+d.lb[0],A=a.left+d.lb[0],B=a.top+l/2+d.lb[1],C=a.top+l/2+o+d.lb[1],p=a.left-p+d.lt[0],D=a.left+d.lt[0],o=a.top-o+l/2+d.lt[1],l=a.top+l/2+d.lt[1],l=[{inview:q.right&&q.bot,className:"tip-top-left",coords:{tl:{x:k,y:n},tr:{x:f,y:n},bl:{x:k,y:t},br:{x:f,y:t}}},{inview:q.right&&q.top,
className:"tip-bottom-left",coords:{tl:{x:x,y:u},tr:{x:r,y:u},bl:{x:x,y:v},br:{x:r,y:v}}},{inview:q.left&&q.bot,className:"tip-top-right",coords:{tl:{x:z,y:B},tr:{x:A,y:B},bl:{x:z,y:C},br:{x:A,y:C}}},{inview:q.left&&q.top,className:"tip-bottom-right",coords:{tl:{x:p,y:o},tr:{x:D,y:o},bl:{x:p,y:l},br:{x:D,y:l}}}],o=0,p=l.length;o<p;o++){if(d=l[o].inview){a:{d=l[o].coords;k=E.slice(0,E.length);n=f=void 0;k.push(d);for(f=k.length;f--;)for(n=k.length;n--&&n!==f;)if(!(k[n].br.x<k[f].bl.x||k[n].bl.x>k[f].br.x||
k[n].bl.y<k[f].tl.y||k[n].tl.y>k[f].bl.y)){d=!0;break a}d=!1}d=!d}if(d){e=l[o].coords.tl.x;g=l[o].coords.tl.y;j=l[o].className;break}}q=q.right?l[q.top?1:0]:l[q.top?3:2];e=e||q.coords.tl.x;g=g||q.coords.tl.y;j=j||q.className;e={left:e,top:g,offsetLeft:e-a.left,offsetTop:g-a.top,className:j};m.removeClass("tip-top-right tip-top-left tip-bottom-right tip-bottom-left").addClass(e.className);$.data(m[0],"trigger",this);if(c.parents(".jp-acc").length){if(c.css("z-index","10000"),s.hasIE&&b)b.style.zIndex=
1E4}else c.css("z-index","110");m.css({left:e.offsetLeft,top:e.offsetTop});s.hasIE?m.delay(400).show():m.delay(400).stop().css({opacity:0,display:"block"}).animate({opacity:1},200)}function g(){var a=$.data(this,"vars"),b=a.tooltip,a=a.slowerTrains;if(m.hasClass("persist"))m.removeClass("persist").find(".close").trigger("hide");else if(FC.hasIE){b.css("z-index","100");if(a)a.style.zIndex=0;m.hide()}else m.stop().animate({opacity:0},200,function(){this.style.display="none"}).parent().css("z-index",
"100")}function e(a){if(!m.hasClass("persist")){var b=$(this);clearTimeout(B);B=setTimeout(function(){y=b;c.call(b[0],a)},400)}}function f(a){if(!(a.keyCode&&a.keyCode!==13))if(a.preventDefault(),typeof y=="undefined"&&(y=[null]),this!==y[0]&&m.removeClass("persist"),y=$(this),m.hasClass("persist"))g.call(this,a);else{var b=$(this);c.call(this,a);m.addClass("persist").find(".close").css("display","block").one("hide",function(){b.focus();this.style.display="none";FC.hasIE?(m[0].className=m[0].className.replace(/persist/,
""),m[0].style.zIndex=100,m[0].style.display="none"):m.removeClass("persist").stop().animate({opacity:0},200,function(){this.style.display="none";this.style.zIndex=100});return!1}).one("keydown click",function(a){if(a.keyCode&&a.keyCode===13||!a.keyCode)a.preventDefault(),$(this).trigger("hide")})}}function d(a){!C&&!m.hasClass("persist")&&(clearTimeout(B),g.call(this,a))}function j(){C=!0}function k(a){C=!1;d.call(y[0],a)}var h=window,s=FC,n=b?b.find(a):a,l=n.length-1,o,p,m,w,y,t,r,q,x=[],u,A,G=
/changestip/,D=/\bstatus\b/,H=/statustip/,I=/typetip/,J=/addinfotip/,K=/facilitiestip/,v,z,F=0,E,C=!1,B=0;for($(window).bind("resize.tooltip",function(){clearTimeout(F);F=setTimeout(function(){E=[];$(FC.vars.selectors.ADS).each(function(){var a=$(this),b=a.offset(),c=a.outerWidth(),a=a.outerHeight();E.push({tl:{x:b.left,y:b.top},tr:{x:b.left+c,y:b.top},bl:{x:b.left,y:b.top+a},br:{x:b.left+c,y:b.top+a}})})},200)}).trigger("resize.tooltip");o=n[l--];){p=$(o);r=p.parents("tr");t=o.className;v=!1;if(G.test(t))z=
!0,q=r.next(".changes"),r='<div class="infodesc"><h4>Change information</h4></div>'+q.find(".changestext").html();else if(H.test(t)){z=!0;u=u&&u[0].parentNode==r[0].parentNode?u:r.parent().children("tr");r=u.index(r[0]);if(u[++r]&&D.test(u[r].className)||u[++r]&&D.test(u[r].className))q=$(u[r]);r=(A=$.find(".statustext",q[0])[0])?A.innerHTML:null}else I.test(t)?(z=!0,q=p.parent(),q=q.siblings(".typeDesc"),r="<div>"+q.html()+"</div>"):J.test(t)?(t=p.parents("li")[0].className,q=r.next(".addinforow"),
r="<div class='"+t+"'>"+(A=$.find("."+t,q[0])[0])?A.innerHTML:"null</div>",p.find("a").removeAttr("title"),x[x.length-1]!=q[0]&&(x[x.length]=q[0])):K.test(t)?(r=$(".facilitiestip-content")[l+1].innerHTML,$($(".facilitiestip-content")[l+1]).remove()):(v=p.find("a"),(r=v.attr("tip-title"))||(r=v.attr("title")),v.attr("tip-title",r).removeAttr("title"),v=!0,r=$.find("img",o).length?"<p>"+p.find("img").attr("alt")+"</p>":"<p>"+r+"</p>");if(z&&q[0])q[0].text="&nbsp;",q[0].parentNode&&q[0].parentNode.removeChild(q[0]),
delete q[0];v?(p.find("a:first").bind("click",function(){return!1}),o=p.find("a:first")):z?o=p.find("a:first"):(v=p.hasClass("addinfotip")?"addinfotip-ctl":"factip-ctl",o=$('<a href="#'+o.id+'" class="'+v+'">'+p.find("h3").html()+"</a>"),p.prepend(o));$.data(o[0],"vars",{slowerTrains:p.parents(".slower-trains")[0]||null,content:r,tooltip:p});o.bind("mouseenter",e).bind("click keydown",f).bind("mouseleave",d);p.bind("mouseenter",j).bind("mouseleave",k)}for(l=x.length;l--;)x[l].parentNode.removeChild(x[l]),
delete x[l];m=$(".tooltip-top");m.length||(m=$('<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(m));w=m.find(".content")};
FC.accordian=function(a){var b=$,c=document,g=FC.vars.slowSafari,e=/return/,f=/outward/,d=/expanded/,j,k,h=c.createDocumentFragment(),s=c.createElement("A"),n=c.createElement("IMG"),c=c.createElement("SPAN"),l=a.length,o,p,m,w=function(){/\bhead-hlt\b/g.test(this.className)||(this.className+=" head-hlt")},y=function(){this.className=this.className.replace(/\bhead-hlt\b/g,"")},t=function(a){var c,d;if(/head/.test(this.className)&&!(a.keyCode&&a.keyCode!==13))return b(this),a=$.data(this,"vars"),d=
a.img,c=a.multiOpen,/expanded/.test(this.className)?(d.alt="collapse "+a.title+" panel",g?a.$next.hide().addClass("expanded-content"):a.$next.slideUp(300).addClass("expanded-content"),this.className=this.className.replace(/\bexpanded\b/g,"")):(d.alt="expand "+a.title+" panel",g?(c||a.$contentSiblings.hide().removeClass("expanded-content"),a.$next.show().addClass("expanded-content")):(c||a.$contentSiblings.filter(".expanded-content").slideUp(200).removeClass("expanded-content"),a.$next.slideDown(300).addClass("expanded-content")),
c||a.$headSiblings.removeClass("expanded"),this.className+=" expanded"),!1};n.width="26";n.height="26";n.src="/redesign/default/images/clear.gif";n.className="sprite-main";s.appendChild(c);s.appendChild(n);s.href="#";s.className="arrow";for(h.appendChild(s);l--;){s=a[l];j=b(s);__$contentSiblings=j.find("div.acc-c");__$tgts=j.find(".head");for(__k=__$tgts.length;__k--;){j=__$tgts[__k];k=b(j);p=k.find("h2").length?k.find("h2").text():k.find("h3").text();m=k.find("div.head-arrow")[0];if(f.test(m.className))c.innerHTML=
"Outward journey details";else if(e.test(m.className))c.innerHTML="Return journey details";n.alt=d.test(j.className)?"collapse "+p+" panel":"expand "+p+" panel";m.appendChild(h.cloneNode(!0));o=k.find("a");k.bind("mouseenter focusin",w).bind("mouseleave focusout",y).bind("keypress",t).bind("click",t);$.data(j,"vars",{multiOpen:!!/multi-open/.test(s.className),title:p,$arrowContainer:m,img:o.find("img")[0],$next:k.next("div.acc-c"),$headSiblings:__$tgts,$contentSiblings:__$contentSiblings})}}for(;h.firstChild;)h.firstChild.innerHTML=
"",h.removeChild(h.firstChild);window.location.hash&&a.hasClass("jp-acc")&&(a=window.location.hash.toLowerCase(),a=a.replace(/[^-a-z0-9]/ig,""),a.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);tickerData.length>0&&$icon.addClass("sprite-alert");tickerData.length==1&&tickerData.push([1,"Find out if any current service disruptions may be affecting your journey","/service_disruptions/today.html",1]);tickerAnim=function(){a.newsLetterCounter<a.letters.length?($container.text($container.text()+a.letters[a.newsLetterCounter]),a.newsLetterCounter+=1,a.newsLetterTimer=setTimeout(arguments.callee,
20)):clearTimeout(a.newsLetterTimer)};loadNews=function(c,g){var e,f,d;clearTimeout(a.newsLetterTimer);clearTimeout(a.newsTimer);a.newsLetterCounter=0;if(g==1)if(c===0){if(a.newsCounter<=0)a.newsCounter=a.newsLength;a.newsCounter-=1}else{if(a.newsCounter+=1,a.newsCounter>=a.newsLength)a.newsCounter=0}else if(a.newsCounter+=1,a.newsCounter>=a.newsLength)a.newsCounter=0;var j=b(a.newsContainer);f=tickerData[a.newsCounter];e=f[1];d="http://www.nationalrail.co.uk"+f[2];a.letters=[];for(i=0;i<e.length;i++)a.letters.push(e.substring(i,
i+1));e=a.newsCounter+1;$(a.newsCounterText).empty().append("("+e+" of "+a.newsLength+")");j.empty();a.newsLetterTimer=setTimeout(tickerAnim,20);f[3]==1?j.attr("href",d):j.removeAttr("href");$(a.newsType+" a").text("Service updates");$(a.newsType).removeClass("blue");if(a.newsPauseBool===0)a.newsTimer=setTimeout(loadNews,a.newsInterval)};onClickHandler=function(a){loadNews(a.data?a.data.dir:null,1);return!1};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;a.newsLength?($(a.newsContainer).empty(),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()):$("div.functions ul").hide()};
FC.tickerInit=function(){$.getScript(FC.vars.paths.TICKER_INFO,FC.onScriptReceived)};
FC.clearFields=function(a){var a=a?$(a):$("body"),b=a.find("select"),c=a.find("input[type=text]"),g=a.find("textarea");searchField=a.find("input#search");b.css({color:"#555"});c.css({color:"#555"});searchField.css({color:"#444"});b.bind("focus",function(){if(this.value===this.defaultValue)this.style.color="#404040"});g.bind("focus",function(){if(!/noclear/.test(this.className)&&this.value==this.defaultValue)this.value="",this.style.color="#404040"});c.bind("focus",function(){$(this);if(!this.className.match(/noclear/g)&&
this.value==this.defaultValue)this.value="",this.style.color="#404040"});searchField.bind("focus",function(){$(this);if(!this.className.match(/noclear/g)&&this.value==this.defaultValue)this.value="",this.style.color="#404040"});c.each(function(){if(this.value!=this.defaultValue)this.style.color="#404040"});g.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(a){function b(){$(".top-section").css({"z-index":"1000"});g.css({display:"block"});g.animate({opacity:1},250);g.append("<p class='close'><a href='#'>Close</a></p>");$("p.close",g).bind("click",function(a){a.preventDefault();c()})}function c(){$(".top-section").css({"z-index":"2"});g.animate({opacity:0},250,function(){g.css({display:"none"});$("p.close",g).remove()});a.bind("click",function(a){a.preventDefault();b()});return!1}var g=$("#register-panel");a.bind("click",function(c){var f=
$('<iframe id="register-frame" src="/personal/quickregistration/step1" frameborder="0" allowtransparency="true"></iframe>');c.preventDefault();a.unbind("click");g.append(f);f.ready(function(){b()})})};
FC.addFares=function(a){function b(a){function b(){g.fadeIn(function(){FC.positionHomeAd()});g.parent().css("height","auto")}FC.rePositionHomeAd();a.preventDefault();a.noFocus?(c.parent().hide(),g.show()):(c.parent().fadeOut(e),g.parent().animate({height:110},b),$("#adults").focus());$(".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=$("#add-fares-show"),g=a,e="fast";c.addClass("active").attr("title","Fares shown will be based on 1 adult, 0 children. Click here to change.");document.getElementById("jpState")&&document.getElementById("jpState").value.charAt(2)==="1"&&b({preventDefault:function(){},noFocus:!0});c.click(b);var a=$("#rcards-holder .rcards-add").eq(FC.hasIE6?1:0),f=$("#rcards-holder ul");a.click(function(a){var b=document.getElementById("rcards"),c=b.options[b.selectedIndex].innerHTML,e="rcard-"+b.value.toString(),
g='<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="'+b.value.toString()+'" /></li>';a.preventDefault();if(b.value.toString()===""||document.getElementById(e))return $(b).parent().css("background-color",
"red"),!1;g=g.replace(/x/g,e);g=g.replace(/y/,c);f.append(g);f.addClass("active");FC.positionHomeAd()})};
FC.advancedSearch=function(a){function b(){f.parent().hide();d.show();j.unbind("click").bind("click",function(){e();return!1})}function c(a){a.addClass("noout");a.bind("blur",function(){$(this).removeClass("noout");$(this).unbind("blur")})}function g(){FC.rePositionHomeAd();FC.hasIE?(f.css({visibility:"hidden"}),f.parent().hide(400),k.animate({bottom:"2px"},600),d.slideDown(600,function(){$("div.advanced-search-p",$(this)).css({visibility:"visible"});j.unbind("click").bind("click",function(){e();
return!1});c($("div.advanced-search-p a.hide-search"));$("div.advanced-search-p a.hide-search").focus();FC.positionHomeAd()})):(k.animate({bottom:"2px"},250),f.parent().animate({opacity:0},250,function(){$(this).hide(400);d.slideDown(600,function(){$(this).animate({opacity:1},250,function(){j.unbind("click").bind("click",function(){e();return!1});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 e(){FC.rePositionHomeAd();$("#add-fares").css("display")==="block"&&(h=20);FC.vars.slowSafari?(f.parent().show(),d.hide(),f.unbind("click").bind("click",function(){g();return!1}),$("ul.jpActions a.adv-search").focus(),c($("ul.jpActions a.adv-search")),FC.positionHomeAd()):FC.hasIE?(d.find(".advanced-search-p").css({visibility:"hidden"}),f.parent().show(400,function(){f.css({visibility:"visible"})}),
k.animate({bottom:h},600),d.slideUp(600,function(){f.unbind("click").bind("click",function(){g();return!1});$("ul.jpActions a.adv-search").focus();c($("ul.jpActions a.adv-search"));FC.positionHomeAd()})):d.animate({opacity:0},250,function(){f.parent().show(400);$(this).slideUp(600,function(){k.animate({bottom:h},250);f.parent().animate({opacity:1},250,function(){f.unbind("click").bind("click",function(){g();return!1});$("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)}a.find(FC.vars.selectors.AD_SEARCH);var f=$(FC.vars.selectors.AD_SEARCH_BUTTON),d=a,j=$(FC.vars.selectors.REM_SEARCH_BUTTON),k=$(FC.vars.selectors.SEARCH_SUBMIT_BUTTON);f.addClass("active").attr("title","");j.addClass("active").attr("title","");var h=k.css("bottom");FC.hasIE?$("div.advanced-search-p",d).css({visibility:"hidden"}):
d.css({opacity:0});f.bind("click",function(a){a.preventDefault();g();return!1});document.getElementById("jpState")&&document.getElementById("jpState").value.charAt(1)==="1"&&(FC.hasIE?$("div.advanced-search-p",d).css({visibility:"visible"}):(f.parent().css({opacity:0}),d.css({opacity:1})),b())};
FC.addJourney=function(){function a(){n.css({zoom:"0"});n.css({zoom:"1"})}function b(a){a.addClass("noout");a.bind("blur",function(){$(this).removeClass("noout");$(this).unbind("blur")})}function c(){j=="showhide"?(h.parent().hide(),d.show(),s.unbind("click").bind("click",function(){f();return!1})):(d.show(),h.attr("class","remove-journey").empty().append("Remove return journey").unbind("click").bind("click",function(){f();return!1}),h.parent().css({opacity:1}))}function g(){$("select",d).each(function(){this.selectedIndex=
0});$("input",d).each(function(){$(this).val("dd/mm")})}function e(){FC.rePositionHomeAd();FC.journeyDates(!0);FC.vars.slowSafari?c():FC.hasIE?(h.css({visibility:"hidden"}),j=="showhide"?($("a.date-picker-control",d).css({visibility:"hidden"}),h.parent().hide(400,function(){d.slideDown(400,function(){d.addClass("return-open");d.children().css({visibility:"visible"});d.find("a.date-picker-control").css({visibility:"visible"});s.unbind("click").bind("click",function(){f();return!1});a();$("a.remove-journey").focus();
b($("a.remove-journey"));FC.positionHomeAd()});l.animate({top:"-3em"},400)})):($("a.date-picker-control",d).css({visibility:"hidden"}),d.slideDown(400,function(){d.addClass("return-open");d.children().css({visibility:"visible"});$("a.date-picker-control",d).css({visibility:"visible"});h.attr("class","remove-journey").empty().append("Remove return journey").unbind("click").bind("click",function(){f();return!1});h.css({visibility:"visible"});a();$("a.remove-journey").focus();b($("a.remove-journey"));
FC.positionHomeAd()}),l.animate({top:"-3em"},400))):(d.stop(),h.parent().animate({opacity:0},250,function(){j=="showhide"?$(this).hide(400,function(){d.show(400,function(){d.addClass("return-open");d.animate({opacity:1},250,function(){s.unbind("click").bind("click",function(){f();return!1});$("a.remove-journey").focus();b($("a.remove-journey"));FC.positionHomeAd()})});l.animate({top:"-3em"},400)}):d.show(400,function(){d.addClass("return-open");d.animate({opacity:1},250,function(){h.attr("class",
"remove-journey").empty().append("Remove return journey").unbind("click").bind("click",function(){f();return!1});h.parent().animate({opacity:1},250);$("a.remove-journey").focus();b($("a.remove-journey"));FC.positionHomeAd()});l.animate({top:"-3em"},400)})}));if(document.getElementById("jpState"))document.getElementById("jpState").value="1"+document.getElementById("jpState").value.slice(1)}function f(){FC.rePositionHomeAd();FC.journeyDates();FC.vars.slowSafari?(d.removeClass("return-open"),d.hide(),
l.animate({top:"0"},400),j=="showhide"?(h.parent().show(),h.unbind("click").bind("click",function(){e();return!1})):h.attr("class","add-journey").empty().append("Add a return journey").unbind("click").bind("click",function(){e();return!1}),a(),g(),$("a.add-journey").focus(),b($("a.add-journey")),FC.positionHomeAd()):FC.hasIE?(d.removeClass("return-open"),d.children().css({visibility:"hidden"}),d.find(".date-picker-control").css({visibility:"hidden"}),d.slideUp(400,function(){j=="showhide"?(h.parent().show(400,
function(){h.css({visibility:"visible"});$("a.add-journey").focus();b($("a.add-journey"))}),h.unbind("click").bind("click",function(){e();return!1}),a(),g()):(h.attr("class","add-journey").empty().append("Add a return journey").unbind("click").bind("click",function(){e();return!1}),a(),g(),$("a.add-journey").focus(),b($("a.add-journey")));FC.positionHomeAd()}),l.animate({top:"0"},400)):(d.stop(),d.animate({opacity:0},250,function(){d.removeClass("return-open");d.hide(400,function(){j=="showhide"?
(h.parent().show(400,function(){$(this).animate({opacity:1},250);$("a.add-journey").focus();b($("a.add-journey"))}),h.unbind("click").bind("click",function(){e();return!1})):h.parent().animate({opacity:0},250,function(){h.attr("class","add-journey").empty().append("Add a return journey").unbind("click").bind("click",function(){e();return!1});h.parent().animate({opacity:1},250);$("a.add-journey").focus();b($("a.add-journey"))});g();FC.positionHomeAd()});l.animate({top:"0"},400)}));if(document.getElementById("jpState"))document.getElementById("jpState").value=
"0"+document.getElementById("jpState").value.slice(1)}var d=$("div.journey-planner div.return"),j="showhide",k='<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>';$.find("div.return-prepend").length?d.prepend($(k)):d.append($(k));var h=$(FC.vars.selectors.ADD_JOURNEY),s=$("div.journey-planner a.remove-journey"),n=$(FC.vars.selectors.SEARCH_SUBMIT_BUTTON);n.css("bottom");
var l=$(".jp-acc .slower-trains");h.addClass("active").attr("title","");s.addClass("active").attr("title","");FC.hasIE?d.children().css({visibility:"hidden"}):d.css({opacity:0});d.hide();h.bind("click",function(a){a.preventDefault();e()});document.getElementById("jpState")&&document.getElementById("jpState").value.charAt(0)==="1"&&(FC.hasIE?d.children().css({visibility:"visible"}):(h.parent().css({opacity:0}),d.css({opacity:1})),c())};
FC.trainAction=function(){var a=$(FC.vars.selectors.TRAIN_ACTION),b=$(FC.vars.selectors.TRAIN_ACTION_FIRST),c=$(FC.vars.selectors.TRAIN_ACTION_SECOND);a.bind("change",function(){a.val()=="ARRIVALS"?(b.text("at"),c.text("from")):(b.text("from"),c.text("to"))})};FC.showHide=function(a,b,c,g,e){$(a).hide();$(c).bind("click",function(){$(b).find("input").attr("value","");$(b).hide();$(a).show();$(g).focus();var c=b;b=a;a=c;c=g;g=e;e=c;return!1})};
FC.showHideSli=function(a,b,c,g,e){$(a).addClass("sliderHide");$(c).bind("click",function(){$(b).find("input").attr("value","");$(b).addClass("sliderHide");$(a).removeClass("sliderHide");$(g).focus();var c=b;b=a;a=c;c=g;g=e;e=c;return!1})};
FC.journeyDates=function(a){function b(a){var b=document.getElementById(g.hours),a=parseFloat(a)+2;b.value=a<10?"0"+a.toString():a}var c={date:"txtDate",hours:"sltHours"},g={date:"txtDateRet",hours:"sltHoursRet"};if(a===!0)document.getElementById(g.date).value=document.getElementById(c.date).value,b(document.getElementById(c.hours).value);var e=$("#"+c.date).bind("change",function(){document.getElementById(g.date).value=this.value;$.find(".return-open").length&&(e.unbind("change"),e=null)}),f=$("#"+
c.hours).bind("change",function(){b(this.value);$.find(".return-open").length&&(f.unbind("change"),f=null);element=null})};FC.popup=function(a,b){var c=b[1],g=b[2];$("a"+b[0]).bind("click",function(){myLinkLocation=$(this).attr("href");window.open(myLinkLocation,"windowname1","width="+c+", height="+g+", scrollbars=1");return!1})};
FC.tableRollover=function(a,b){var c=$,g=c.find(a+" tr"),e=function(a){c(this).addClass(a.data.a)},f=function(a){c(this).removeClass(a.data.a)};(function(a){for(;a--;)c(g[a]).bind("mouseover",{a:b},e).bind("mouseout",{a:b},f)})(g.length)};
FC.tableRolloverRadio=function(a,b){var c=$(a),g=c.find("tr"),c=c.find("input[type=radio]");g.bind("mouseover",function(){$(this).addClass(b)});g.bind("mouseout",function(){$(this).find("input[type=radio]").attr("checked")!==!0&&$(this).removeClass(b)});c.bind("click",function(){g.removeClass("selected");$(this).parents("tr").addClass("selected")})};
FC.spOne=function(a){sp.init();sp.addInputSet({from:a,to:$("#txtTo"),useGroups:!0,useDLRLU:!0,useUserStations:!0,usePostcodes:!0});sp.addInputSet({from:$("#txtViaAvDest"),useGroups:!0})};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:!0})};
FC.spFive=function(a){sp.init();sp.addInputSet({from:a,to:$("#txtTo"),useGroups:!0,useDLRLU:!0,useUserStations:!0,usePostcodes:!1})};FC.askLisa=function(a){a.bind("submit",function(){var a=$(this).attr("action");window.open(a,"askLisa","width=350,height=580");return!1})};FC.positionHomeAd=function(){if($(FC.vars.selectors.HOMEAD).length>0){var a=$("#ad-placeholder-homepage").position(),b=a.top,a=a.left;$("div#ad-homepage").css({top:b+"px",left:a+"px",visibility:"visible"})}};
FC.rePositionHomeAd=function(){$(FC.vars.selectors.HOMEAD).length>0&&$("div#ad-homepage").css({visibility:"hidden"})};FC.positionAdlinkAds=function(){if($("#ad-placeholder-side").length>0){var a=$("#ad-placeholder-side").position(),b=a.top,a=a.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 a=$("#ad-placeholder-top").position().left;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 a=$("#ad-placeholder-pp-t").offset(),b=a.top,a=a.left;b+=5;a+=7;$("div#ad-postpurchase").css({top:b+"px",left:a+"px",visibility:"visible"})}if($("#ad-placeholder-pp-b").length>0)a=$("#ad-placeholder-pp-b").offset(),b=a.top,a=a.left,b+=5,a+=7,$("div#ad-postpurchase2").css({top:b+"px",left:a+"px",visibility:"visible"});if($("#ad-placeholder-pp-mb").length>0)a=$("#ad-placeholder-pp-mb").offset(),b=a.top,a=a.left,$("div#ad-postpurchase3").css({top:b+
"px",left:a+"px",visibility:"visible"})};
FC.preLoad=function(a,b){setTimeout(function(){for(var a=document.getElementsByTagName("head")[0];b[0].vars.preload.scripts.length;){var g=document.createElement("script");g.type="text/javascript";g.src="/redesign/default/javascript/"+b[0].vars.preload.scripts.shift();a.appendChild(g)}for(;b[0].vars.preload.css.length;)g=document.createElement("link"),g.type="text/css",g.rel="stylesheet",g.href="css/"+b[0].vars.preload.css.shift(),g.media="screen",a.appendChild(g)},6E3)};
FC.loadMap=function(a){getMap();getMap2();a.bind("click",function(){$this=$(this);$this.parent().find(".active").removeClass("active");$this.attr("class")=="toMapLink"&&($("#fromMap").hide(),$("#toMap").show());$this.attr("class")=="fromMapLink"&&($("#toMap").hide(),$("#fromMap").show());$this.addClass("active");return!1});$(".toMapLink").click()};
FC.tabs=function(){var a=$(FC.vars.selectors.TABS_CONTAINER),b=$(FC.vars.selectors.TAB_PANEL),c=FC.vars.selectors.TAB_HEADING;$(FC.vars.selectors.TAB_CONTENT);var g=FC.vars.selectors.TAB_START;$(a).addClass("tabs-active").prepend('<ul id="tabs" class="clear"></ul>');$(b,a).each(function(b){var f=b+1,d=b+1,j=$(this).children(c),k=j.text();$("#tabs",a).append('<li><a href="#tab-'+f+'"><span>'+k+"</span></a></li>");$(this).attr("id","tab-"+d++ +"");b===g?$(this).css({display:"block"}).addClass("active"):
$(this).css({display:"none"});FC.vars.selectors.HEADING_DISPLAY===0&&$(j).css({height:"1px",width:"1px",position:"absolute",overflow:"hidden",top:"-10px"})});$("#tabs li:eq("+g+")",a).addClass("selected");$("#tabs li a",a).click(function(c){var f=$(this).parent();$(f).hasClass("selected")||$(f).addClass("selected").siblings().removeClass("selected");$(b,a).each(function(a){a===f.index()&&($(this).siblings("div").css({display:"none"}).removeClass("active"),$(this).fadeIn(FC.vars.selectors.FX_SPEED).addClass("active"))});
c.preventDefault()})};FC.basemapEasementSlider=function(){var a=$(FC.vars.selectors.BASEMAP_EASEMANT_HANDLE),b=$(FC.vars.selectors.BASEMAP_EASEMANT_MESSAGEWINDOW);a.click(function(c){a.hasClass("open-handle")?(b.slideUp(),a.removeClass("open-handle")):(b.slideDown(),a.addClass("open-handle"));c.preventDefault()})};
(function(){var a=[],b=document.cookie.indexOf("rsi_segs=");if(b>=0&&(b=document.cookie.indexOf("=",b)+1,b>0)){a=document.cookie.indexOf(";",b);if(a==-1)a=document.cookie.length;a=document.cookie.substring(b,a).split("|")}var b=20,c="";if(a.length<b)b=a.length;for(var g=0;g<b;g++)c+="rsi="+a[g]+";";window.segQS=c})();$(function(){FC.positionAdlinkAds();FC.positionHomeAd();FC.positionFB();FC.placeFB();FC.positionPostPurchase()});
$(window).resize(function(){FC.positionAdlinkAds();FC.positionHomeAd();FC.positionFB();FC.positionPostPurchase()});
$(function(a){var b=FC,c=b.vars.selectors;b.clearFields();a.find(c.HOMEPAGE).length&&(a(window).bind("load",b.tickerInit),a.find(c.HP_LIVE_TRAINS),a.find(c.TRAIN_ACTION).length&&b.trainAction());var g=navigator.userAgent.toLowerCase().indexOf("webkit")>-1,e=navigator.userAgent.toLowerCase().indexOf("opera")>-1;if(g||e){var f=a("#skip-content");f.attr("href","#skip-content");f.text("Start of main content");f.attr("tabindex","0");a("#cont-skip").bind("click",function(){f.focus()});var d=a("#skip-nav");
d.attr("href","#skip-nav");d.text("Start of main navigation");d.attr("tabindex","0");a("#nav-skip").bind("click",function(){d.focus()})}b.presentPass([{test:c.REGISTER_BUTTON,func:b.registerFlyout},{test:c.JP_TIMES,func:b.callingPoints},{test:c.TOOLTIP_HOLDER,func:b.tooltip},{test:c.ACCORDIAN,func:b.accordian},{test:c.ACCORDIAN_TABLE,func:b.accordianTable},{test:c.SHOW_MORE,func:b.showMore},{test:c.SMS_OPTIONS,func:b.smsOptions},{test:c.ALERT_POPUP,func:b.popup,args:[".alert-popup","668","500"]},
{test:c.INPUT_BORDERS,func:b.formBorders},{test:c.SELECT_BORDERS,func:b.formBorders},{test:c.TXTAREA_BORDERS,func:b.formBorders},{test:c.CHKBOX_BORDERS,func:b.formBorders},{test:c.AMBIGOUS_STATION_ERROR_TO,func:b.resetUnknownStation},{test:c.AMBIGOUS_STATION_ERROR_FROM,func:b.resetUnknownStation},{test:c.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:c.CTF_PROVIDER,func:b.CtfChooseTOC},{test:"#pp-share",func:b.ppShare},{test:c.OTHER_FARES,
func:b.otherFaresPopup},{test:c.TABS_CONTAINER,func:b.tabs},{test:c.BASEMAP_EASEMANT_HANDLE,func:b.basemapEasementSlider}]);a.find(c.PT).length&&b.PT();a.find(c.JOURNEY_PLANNER).length&&(b.addJourney(),FC.presentPass([{test:c.AD_SEARCH_HOLDER,func:b.advancedSearch}]));a.find(c.FARE_FIND).length&&(b.timeRange(),b.rcards(),b.tocs(),b.fareStates(),b.increment("#adults"),b.increment("#children"),b.presentPass([{test:c.TICKET_PROVIDER,func:b.chooseTOC},{test:c.RESULTS_TABLE,func:b.resultsTable}]));a.find(c.RESULTS_TABLE).length&&
!a.find(c.JP_TIMES).length&&b.callingPoints();a.find("#ctf-details").length&&b.printButtonOld();a.find("#ctf-results").length&&(b.faresMore(),b.basket(),b.fareSwticher(),b.printButton(),b.editJourneyLink(a("#edit_ur_jorney_btn")),b.otherCheapFaresReveal(a("#other-cheap-fares")),b.resultsTable("#ctf-results table"),b.increment("#adults"),b.increment("#children"),b.rcards());a.find("table").length&&(b.tableRollover(".train-dates","rollover"),b.tableRolloverRadio(".train-times","selected"));dp.init()}(jQuery));

