function showHideReturnDate(thevalue){if(document.getElementById("retCH")){if(thevalue!="R"){document.getElementById("retCH").style.display="none"}else{document.getElementById("retCH").style.display="block"}}}function pageRefresh(){window.location.reload(true)}function GetDate(day,month,dayControlName,monthControlName){dayControl=window.opener.document.getElementById(dayControlName);dayControl.selectedIndex=day;monthControl=window.opener.document.getElementById(monthControlName);for(i=0;i<monthControl.length;i++){if(trim(monthControl.options[i].value)!=""&&parseInt(monthControl.options[i].value,10)==parseInt(month,10)){monthControl.selectedIndex=i;break}}window.close()}function trim(theString){while(theString.substring(0,1)==" "){theString=theString.substring(1,theString.length)}while(theString.substring(theString.length-1,theString.length)==" "){theString=theString.substring(0,theString.length-1)}return theString}function GetSelectedDateForTextBox(radioButtonListName,dateControlId){var RadioButtonList=document.getElementsByName(radioButtonListName);var DateControl=document.getElementById(dateControlId);var Index;var CheckedItem;for(Index=0;Index<RadioButtonList.length;Index++){if(RadioButtonList[Index].checked){CheckedItem=RadioButtonList[Index];break}}if(DateControl.type=="text"){DateControl.value=CheckedItem.value}}function GetSelectedDateMonth(radioButtonListName,dateControlId,monthControlId){var RadioButtonList=document.getElementsByName(radioButtonListName);var DateControl=document.getElementById(dateControlId);var MonthControl=document.getElementById(monthControlId);var Index;var CheckedItem;for(Index=0;Index<RadioButtonList.length;Index++){if(RadioButtonList[Index].checked){CheckedItem=RadioButtonList[Index];break}}var Value=CheckedItem.value;var Pos=Value.indexOf("/");var DateValue=Value.substr(0,2);var MonthValue=Value.substr(Pos+1,2);for(Index=0;Index<DateControl.length;Index++){if(DateControl.options[Index].value==DateValue){DateControl.selectedIndex=Index;break}}for(Index=0;Index<MonthControl.length;Index++){if(MonthControl.options[Index].value==MonthValue){MonthControl.selectedIndex=Index;break}}}function GetSelectedDateForDropDown(radioButtonListName,dateControlId){var RadioButtonList=document.getElementsByName(radioButtonListName);var DateControl=document.getElementById(dateControlId);var Index;var CheckedItem;for(Index=0;Index<RadioButtonList.length;Index++){if(RadioButtonList[Index].checked){CheckedItem=RadioButtonList[Index];break}}for(Index=0;Index<DateControl.length;Index++){if(DateControl.options[Index].value==CheckedItem.value){DateControl.selectedIndex=Index;break}}}function windowNewOpen(url,myHeight,myWidth){var myLeft=(screen.width-myWidth)/2;var myTop=(screen.height-myHeight)/2;var dayControl;var monthControl;var urlstring=url;var features="scrollbar=no,width="+myWidth+",height="+myHeight+",left="+myLeft+",top="+myTop;var openedWindow=window.open(urlstring,"test",features);return false}function windowOpen(url,journeytype,OPreviousDaydayValue,OPreviousMonth,RPreviousDay,RPreviousMonth,defaultModuleDate){var myHeight=330;var myWidth=260;var myLeft=(screen.width-myWidth)/2;var myTop=(screen.height-myHeight)/2;var dayControl;var monthControl;OdayControl=document.getElementById(OPreviousDaydayValue);OmonthControl=document.getElementById(OPreviousMonth);RdayControl=document.getElementById(RPreviousDay);RmonthControl=document.getElementById(RPreviousMonth);if(OPreviousDaydayValue==""||OPreviousMonth==""){var urlstring=url+"?JourneyType="+journeytype+"&OdayControl=&OmonthControl=&OPreviousDay=&OPreviousMonth=&RdayControl="+RPreviousDay+"&RmonthControl="+RPreviousMonth+"&RPreviousDay="+RdayControl.value+"&RPreviousMonth="+RmonthControl.value+"&DefaultModuleDate="+defaultModuleDate}else{var urlstring=url+"?JourneyType="+journeytype+"&OdayControl="+OPreviousDaydayValue+"&OmonthControl="+OPreviousMonth+"&OPreviousDay="+OdayControl.value+"&OPreviousMonth="+OmonthControl.value+"&RdayControl="+RPreviousDay+"&RmonthControl="+RPreviousMonth+"&RPreviousDay="+RdayControl.value+"&RPreviousMonth="+RmonthControl.value+"&DefaultModuleDate="+defaultModuleDate}var features="scrollbars=no,resizable=yes,status=no,width="+myWidth+",height="+myHeight+",left="+myLeft+",top="+myTop;var openedWindow=window.open(urlstring,"test",features);return false}function OpenPopUpWindowCentered(theURL,winName,features,myWidth,myHeight,isCenter){var re=/%26/g;theURL=theURL.replace(re,"&");if(window.screen){if(isCenter){if(isCenter=="true"){var myLeft=(screen.width-myWidth)/2;var myTop=(screen.height-myHeight)/2;features+=(features!="")?",":"";features+=",left="+myLeft+",top="+myTop}}}var new_win=window.open(theURL,winName,features+((features!="")?",":"")+"width="+myWidth+",height="+myHeight);new_win.focus()}function TextMeSMS(ddt1,ol1,tm1,adt1,dl1){var leftPosition=(screen.width)?(screen.width-520)/2:0;var topPosition=(screen.height)?(screen.height-480)/2:0;var settings="height=480,width=520,top="+topPosition+",left="+leftPosition+",scrollbars=no,resizable=no";var vurl="http://thetrainline.textme.kizoom.co.uk/?ddt1="+ddt1+"&ol1="+ol1+"&tm1="+tm1+"&adt1="+adt1+"&dl1="+dl1;var win=window.open(vurl,"SampleTest",settings);win.focus()}function SubmitToAcsUrl(){window.onload=doActualSubmit}function doActualSubmit(){var formVar=document.createElement("form");var paReq=document.getElementById("PaReq");var md=document.getElementById("MD");var termUrl=document.getElementById("TermUrl");formVar.appendChild(paReq);formVar.appendChild(md);formVar.appendChild(termUrl);formVar.method="post";formVar.action=document.getElementById("AcsUrl").value;document.body.appendChild(formVar);formVar.submit()}function LoadPageInParentWindow(){top.location=document.getElementById("ConfirmationPage").value}function LoadCurrentPageInTopmostWindow(){}function FetchCCTypeFromCreditCardTypeDD(){var objInput=document.getElementsByTagName("select");for(var i=0;i<objInput.length;i++){if(objInput[i].id.indexOf("CreditCardDetailsModule.CreditCardTypeDropdown")>=0){var myindex=objInput[i].selectedIndex;var hiddinCCC=document.getElementById("updateCCC");hiddinCCC.value=objInput[i].options[myindex].value}}return true}function FetchCCTypeFromChooseCardDD(){var objInput=document.getElementsByTagName("select");for(var i=0;i<objInput.length;i++){if(objInput[i].id.indexOf("CreditCardDetailsModule.ChooseCardDropdown")>=0){var myindex=objInput[i].selectedIndex;var hiddinCCC=document.getElementById("updateCCC");hiddinCCC.value=objInput[i].options[myindex].value}}return true}function SubmitFormWithHiddenField(name){var editAddress=document.createElement("input");editAddress.setAttribute("type","hidden");editAddress.setAttribute("name",name);editAddress.setAttribute("value",name);document.forms[0].appendChild(editAddress);document.forms[0].submit()}function RefreshAllElementVisibilities(eventSender,pattern){var RefreshElementVisibility=UpdateVanishingElementCssFromPattern(eventSender,pattern);return function(elementCollection){elementCollection.ForEach(RefreshElementVisibility)}}function RefreshVisibilitiesWith(eventSender,pattern){ElementCollections("div","legend","p").ForEach(RefreshAllElementVisibilities(eventSender,pattern))}function UpdateVanishingElementCssFromPattern(eventSender,pattern){return function(element){var match=element.id.match(/vanishing.*CaresAbout#(.*)-Match#(.*)-.*CssClass#(.*)-/);if(match==null||eventSender!=match[1]){return}var patternToMatchAgainst=match[2];var DefaultCssClass=match[3];var setCssClass=CssClassSetter(isSelected(patternToMatchAgainst,pattern)?DefaultCssClass:"hidden");setCssClass(element)}}function isSelected(patternToMatchAgainst,pattern){var elements=patternToMatchAgainst.split("|");for(var i=0;i<elements.length;i++){if(elements[i]==pattern){return true}}return false}function ElementCollections(){var elementsOfType=function(elementTagName){return document.getElementsByTagName(elementTagName)};var getCollection=function(elementTagName){return new CollectionWithDelegates(elementsOfType(elementTagName))};return new CollectionWithDelegates(arguments).ConvertAll(getCollection)}function CollectionWithDelegates(collection){this.ForEach=function(action){for(var i=0;i<collection.length;i++){action(this.item(i))}};this.ConvertAll=function(converter){var returnArr=new Array();for(var i=0;i<collection.length;i++){returnArr[i]=converter(this.item(i))}return new CollectionWithDelegates(returnArr)};this.length=collection.length;ithHTMLItem=function(i){return collection.item(i)};ithArrayItem=function(i){return collection[i]};this.item=(typeof collection.item!="undefined")?ithHTMLItem:ithArrayItem}function CssClassUpdater(cssClass){return CssClassSetter(cssClass)}function RemoveCssClass(element){return CssClassSetter("")(element)}function CssClassSetter(cssClass){return function(element){element.className=cssClass}}function submit_form(){document.forms[0].submit()}function suppressEnterKey(e){var keynum;if(window.event){keynum=e.keyCode}else{if(e.which){keynum=e.which}}if(keynum==13){return false}return true};
