Type.registerNamespace("Ecom.EarlyBooking");Ecom.Waiter=function(a){this.ShowWaitPanelDelegate=Function.createDelegate(this,this.ShowWaitPanel);this.HideWaitPanelDelegate=Function.createDelegate(this,this.HideWaitPanel);Ecom.Waiter.initializeBase(this,[a]);this.Mediator={}};Ecom.Waiter.prototype={initialize:function(){},DoPartialUpdateWithOmnitureLogging:function(a){Ecom.Waiter.callBaseMethod(this,"DoPartialUpdateWithOmnitureLogging",[a]);if(this.Mediator.AdjustSizeToCashTicket!=null){this.Mediator.AdjustSizeToCashTicket(null)}},UpdateValidFieldIndicator:function(c,b,a){if(c!=null){if(a){Sys.UI.DomElement.removeCssClass(c,b)}else{Sys.UI.DomElement.addCssClass(c,b)}}},ShowWaitPanel:function(){Ecom.Application.showWaiterBox()},HideWaitPanel:function(){Ecom.Application.hideWaiterBox()},GetDefaultWaitSpecificationInstance:function(){var a={wait:{showwaitmethod:this.ShowWaitPanelDelegate,hidewaitmethod:this.HideWaitPanelDelegate}};return a}};Ecom.Waiter.registerClass("Ecom.Waiter",Ecom.Omniture);Ecom.PaymentWaiter=function(a){this.ShowOverlayAndWaitPanelDelegate=Function.createDelegate(this,this.ShowOverlayAndWaitPanel);this.ShowOverlayDelegate=Function.createDelegate(this,this.ShowOverlay);this.HideOverlayAndWaitPanelDelegate=Function.createDelegate(this,this.HideOverlayAndWaitPanel);Ecom.PaymentWaiter.initializeBase(this,[a])};Ecom.PaymentWaiter.prototype={initialize:function(){},ShowOverlay:function(){this.HideWaitPanel()},ShowOverlayAndWaitPanel:function(){this.ShowWaitPanel()},HideOverlayAndWaitPanel:function(){this.HideWaitPanel()}};Ecom.PaymentWaiter.registerClass("Ecom.PaymentWaiter",Ecom.Waiter);Ecom.BookingDialogMediator=function(a){Ecom.BookingDialogMediator.initializeBase(this,[a]);this.isIndividualBookingDialog=null;IEDummyHistoryStateAdded=false;this.NamingContainer="";CurrentHistoryState=null;this._skippedSteps=new Array();this.quoteIdentification=null;this.InitializeNavigationDelegate=Function.createDelegate(this,this.InitializeNavigation);this.NavigationStateChangedDelegate=Function.createDelegate(this,this.NavigationStateChanged);this.OnReturnToOptionsAndExtrasStepDelegate=Function.createDelegate(this,this.OnReturnToOptionsAndExtrasStep);this.OnBookNowSubmittedDelegate=Function.createDelegate(this,this.OnBookNowSubmitted);Sys.Application.add_load(this.InitializeNavigationDelegate)};Ecom.BookingDialogMediator.prototype={initialize:function(){},InitializeNavigation:function(){try{Sys.Debug.trace("Initializing navigation");Sys.Application._enableHistoryInScriptManager();Sys.Application._ensureHistory();Sys.Application.add_navigate(this.NavigationStateChangedDelegate)}catch(a){Sys.Debug.trace("Navigation not supported")}},NavigationStateChanged:function(b,c){var a=c.get_state().s;Sys.Debug.trace("Navigating from "+CurrentHistoryState+" to "+a);a=this.AdjustForSkippedSteps(CurrentHistoryState,a);if(a==CurrentHistoryState){return}if(this.isIndividualBookingDialog&&(CurrentHistoryState!=null)&&(a==null||a=="ie special")){window.history.go(-1)}if(a==null){if(CurrentHistoryState==-1){this.ForwardToStepZero()}else{this.BackToStep0()}}if(a>CurrentHistoryState){return}if(a=="-1"){this.BackGoToGroupBooking()}if(a=="1"){this.BackToEditPersonaliaInfo()}if(a=="2"){this.BackToEditOptionsAndExtrasInfo()}if(a=="3"){this.BackToEditAddressInfo()}},AdjustForSkippedSteps:function(a,b){if(a==b){return b}if(jQuery.inArray(b,this._skippedSteps)>=0){if(a>b){return b-1}if(a<b){return b+1}}return b},RegisterSkippedStep:function(a){if(jQuery.inArray(a,this._skippedSteps)>=0){return}Sys.Debug.trace("Registering skipped navigation step: "+a);this._skippedSteps.push(a)},RegisterHistoryPoint:function(a){if((this.isIndividualBookingDialog)&&(IEDummyHistoryStateAdded==false)&&jQuery.browser.msie){Sys.Debug.trace("Adding an initial navigation state for IE");Sys.Application.addHistoryPoint({s:"ie special"},document.title);IEDummyHistoryStateAdded=true}CurrentHistoryState=a;Sys.Debug.trace("Adding history point for state "+a);Sys.Application.addHistoryPoint({s:a},document.title);this.notifyTeaLeafOnDomChanges()},notifyTeaLeafOnDomChanges:function(){if(typeof TeaLeaf!=="undefined"&&TeaLeaf!==null){if(typeof TeaLeaf.Client!=="undefined"&&TeaLeaf.Client!==null){if(typeof TeaLeaf.Client.tlProcessNode==="function"){TeaLeaf.Client.tlProcessNode(document.body)}}}},toogleGroupBooking:function(a){if(a){jQuery("#middlecolumn").hide();jQuery("#clickpricegrid").hide();jQuery("#groupbookbyemail").show()}else{jQuery("#middlecolumn").show();jQuery("#clickpricegrid").show();jQuery("#groupbookbyemail").hide()}},GoToGroupBooking:function(){this.RegisterHistoryPoint(-1);this.toogleGroupBooking(true);CurrentHistoryState=-1},BackGoToGroupBooking:function(){this.toogleGroupBooking(true);CurrentHistoryState=-1},GoToBookByEmail:function(f){hide("middlecolumn");hide("clickpricegrid");show("soldoutbookbyemail");var e=$find("soldoutbookbyemail");if(e!=null){e.HookChildSelects($get("soldoutbookbyemail"));var c=$find("SalesForceBookingFormComponent");if(c!=null){f.Title=jQuery("#product_title").text();for(var d=0;d<f.roomOccupations.length;d++){var b=d+1;var a=f.roomOccupations[d];a.selectedRoomDescription=jQuery("#roomtypeselect_"+b+" option:selected").text();a.boardTypeDescription=jQuery("#boardtypeselect_"+b+" option:selected").text()}c.Show(f)}else{e.InitializeDateControls()}}},BackFromBookByEmail:function(){show("middlecolumn");show("clickpricegrid");hide("soldoutbookbyemail")},ForwardToStepZero:function(){this.toogleGroupBooking(false);CurrentHistoryState=null},GroupBookBackToStepZero:function(){window.history.go(-1)},LoadBooking:function(c,a,b){this.BookNowExternalDelegate=Function.createDelegate(this,this.BookNowExternal);ThomasCook.Ecom.Web.BookingAvailability.BookNow("test","click",c,a,this.BookNowExternalDelegate,this.MethodTimeoutDelegate,b)},BookNowExternal:function(e,d,a){var b=$find("BookingPersonalia");if(b!=null){b.DisposePopups()}var c=e.divUpdates;this.DoPartialUpdateWithOmnitureLogging(e);this.AdjustSizeToCashTicket();this.Wait(d,false);this.OnBookNowSubmitted(e)},OnBookNowSubmitted:function(b){jQuery("#priceAdvanceTooltip").insertBefore(jQuery("#BookingDialog"));jQuery("#basicInsuranceTooltip").insertBefore(jQuery("#BookingDialog"));jQuery("#DetailComponent").hide();jQuery("#BookingCashTicket").show();var a=$find("BookingPersonalia");if(a!=null){a.OnShow();a.CreatePopups();if(b!=null){if(b.ShowBookingLoginPopup){a.ShowLoginOnSitePopup()}a.DepartureYear=b.DepartureYear;a.DepartureMonth=b.DepartureMonth;a.DepartureDay=b.DepartureDay}}jQuery("#BookingStartOverview").show().removeClass("currentStep nextStep").addClass("previousStep");jQuery("#BookingPersonalia").show().removeClass("previousStep nextStep").addClass("currentStep");jQuery("#OptionsAndExtrasCollapsedBlock").hide().removeClass("currentStep previousStep").addClass("nextStep");jQuery("#BookingAddressCollapsedBlock").show().removeClass("currentStep previousStep").addClass("nextStep");jQuery("#BookingPaymentCollapsedBlock").show().removeClass("currentStep previousStep").addClass("nextStep");jQuery(".help-icon").tooltip({tip:"#infoBubble",position:"bottom center",offset:[1,-2],onBeforeShow:function(){if(jQuery.fn.bgiframe){this.getTip().bgiframe()}}});this.ScrollComponentIntoView("BookingPersonalia");this.AdjustSizeToCashTicket("BookingPersonalia");this.RegisterHistoryPoint(1)},CheckAdultAgesOnPersonaliaSubmit:function(){return false},PersonaliaInfoSubmit:function(g,f,b,c,a,d){var e=$find("OptionsAndExtras");if(e!=null){e.DisposePopups()}ThomasCook.Ecom.Web.BookingAvailability.ShowOptionsAndExtras(g,f,b,c,a,d)},OnPersonaliaInfoSubmitted:function(a){var b=$find("BookingPersonalia");if(a.HasCriticalRoomOccupationError){if(b!=null){b.ShowCriticalRoomOccupationErrorPopup(a.RedirectToDetailPageUrl)}return}if(a.HasRoomOccupationError){if(b!=null){b.ShowRoomOccupationErrorPopup()}return}if((a.BackendError!=null)&&(a.BackendError!="")){if(b!=null){b.ShowErrorPopup(a.BackendError)}}else{var d=$find("OptionsAndExtrasOverview");if(d!=null){d.ShouldShowOptionsAndExtras=a.ShouldShowOptionsAndExtras;d.UpdateControlsToCurrentState()}jQuery("#BookingStartOverview").show().removeClass("currentStep nextStep").addClass("previousStep");jQuery("#BookingStartOverviewCollapsed").hide();jQuery("#BookingPersonalia").hide();jQuery("#BookingPersonaliaOverview").show().removeClass("currentStep nextStep").addClass("previousStep");jQuery("#BookingPersonaliaOverview .content").hide();jQuery("#OptionsAndExtrasCollapsedBlock").hide();this.ScrollComponentIntoView("OptionsAndExtras");this.AdjustSizeToCashTicket("OptionsAndExtras");this.RegisterHistoryPoint(2);var e=$find("OptionsAndExtras");if(e!=null){if(a.ShouldShowOptionsAndExtras==false){ThomasCook.Ecom.Web.BookingAvailability.BookingDialogGoToAddress("dummy","autoclick",null,e.OnOptionsAndExtrasSubmittedDelegate,e.MethodTimeoutDelegate,e.waitSpecificationInstance);this.RegisterSkippedStep("2");return}e.ValidDateTimeWithDurations=a.ValidDateTimeWithDurations;var c=$get("OptionsAndExtras");if(c!=null){e.HookChildSelects(c)}}e.CreateConfirmationPopup();e.CreateRemovePopup();e.CreateErrorPopup();e.CreateInsurancePopup();e.CreateTooltips();jQuery("#OptionsAndExtras").show().removeClass("previousStep nextStep").addClass("currentStep")}},AddressInfoSubmit:function(g,f,b,d,a,e){var c=$find("BookingPayment");if(c!=null){c.DisposePopups()}ThomasCook.Ecom.Web.BookingAvailability.ShowPrePaymentOverview(g,f,b,d,a,e)},OnAddressInfoSubmitted:function(){jQuery("#BookingStartOverview").hide();jQuery("#BookingStartOverviewCollapsed").show().removeClass("currentStep nextStep").addClass("previousStep");jQuery("#BookingAddress").hide();jQuery("#BookingAddressOverview").show().removeClass("currentStep nextStep").addClass("previousStep");jQuery("#BookingAddressOverview .content").hide();jQuery("#BookingPaymentCollapsedBlock").hide();jQuery("#paymentLogos").prependTo("#paymentMethodsHeader");jQuery("#privacy").appendTo("#paymentMethodsHeader");jQuery("#paymentTermsDesc").show();jQuery("#BookingPayment div.payContent").removeClass("agreedWithPaymentTerms").addClass("notAgreedWithPaymentTerms");jQuery("#BookingPayment").show().removeClass("previousStep nextStep").addClass("currentStep");jQuery("#defaultPaymentMethods .jqPaymentGroupInfoTooltip").each(function(){jQuery(this).bubble("#tooltippaymentGroupInfo_"+jQuery(this).attr("id").split("_")[1],false,true)});this.ScrollComponentIntoView("BookingPayment");this.AdjustSizeToCashTicket("BookingPayment");this.RegisterHistoryPoint(4);var a=$find("BookingPayment");if(a!=null){a.CreatePopups()}jQuery(".payment-agent-introduction .payment-agreement-option .prepayment-info").bubble("#prepaymentinfo",false,true)},EditStep0:function(c,b,a){window.history.go(-CurrentHistoryState)},BackToStep0:function(c,b,a){hide("BookingStartOverview");hide("BookingStartOverviewCollapsed");hide("BookingPersonalia");hide("BookingPersonaliaOverview");hide("OptionsAndExtras");hide("OptionsAndExtrasOverview");hide("BookingAddress");hide("BookingAddressOverview");hide("BookingPayment");hide("BookingCashTicket");jQuery("#OptionsAndExtrasCollapsedBlock").hide();jQuery("#BookingAddressCollapsedBlock").hide();jQuery("#BookingPaymentCollapsedBlock").hide();show("DetailComponent");CurrentHistoryState=0},EditPersonaliaInfo:function(){window.history.go(1-CurrentHistoryState)},BackToEditPersonaliaInfo:function(){show("BookingPersonalia");hide("BookingStartOverviewCollapsed");hide("BookingPersonaliaOverview");hide("OptionsAndExtras");hide("OptionsAndExtrasOverview");hide("BookingAddress");hide("BookingAddressOverview");hide("BookingPayment");jQuery("#BookingStartOverview").show();jQuery("#BookingStartOverviewCollapsed").hide();jQuery("#OptionsAndExtrasCollapsedBlock").hide();jQuery("#BookingAddressCollapsedBlock").show();jQuery("#BookingPaymentCollapsedBlock").show();CurrentHistoryState=1},EditAddressInfo:function(){window.history.go(3-CurrentHistoryState)},BackToEditAddressInfo:function(){hide("BookingAddressOverview");hide("BookingPayment");show("BookingAddress");jQuery("#BookingPaymentCollapsedBlock").show();jQuery("#BookingStartOverview").show();jQuery("#BookingStartOverviewCollapsed").hide();this.ScrollComponentIntoView("BookingAddress");this.AdjustSizeToCashTicket("BookingAddress");CurrentHistoryState=3},EditOptionsAndExtrasInfo:function(){window.history.go(2-CurrentHistoryState)},BackToEditOptionsAndExtrasInfo:function(){var a=new ThomasCook.Ecom.Core.PageComponents.ContextObject.OptionsAndExtras.OptionsAndExtrasInput();a.Operation="ClearCancellationInsurance";var c;var b=$find("OptionsAndExtrasOverview");if(b!=null){c=b.FindWaitSpecificationInstance($get("editOptionsAndExtras"),"click");this.Wait(c,true)}ThomasCook.Ecom.Web.BookingAvailability.ClearCancellationInsurance("editOptionsAndExtras","click",a,this.OnReturnToOptionsAndExtrasStepDelegate,null,c)},OnReturnToOptionsAndExtrasStep:function(d,c,b){var a=$find("OptionsAndExtras");if(a!=null){a.OnOptionsAndExtrasBooked(d)}hide("OptionsAndExtrasOverview");hide("BookingAddress");hide("BookingAddressOverview");hide("BookingPayment");show("OptionsAndExtras");jQuery("#BookingStartOverview").show();jQuery("#BookingStartOverviewCollapsed").hide();jQuery("#BookingAddressCollapsedBlock").show();jQuery("#BookingPaymentCollapsedBlock").show();CurrentHistoryState=2;this.Wait(c,false)},OptionsAndExtrasSubmit:function(f,e,b,c,a,d){ThomasCook.Ecom.Web.BookingAvailability.BookingDialogGoToAddress(f,e,b,c,a,d)},OnOptionsAndExtrasSubmitted:function(){jQuery("#BookingStartOverview").show();jQuery("#BookingStartOverviewCollapsed").hide();jQuery("#OptionsAndExtras").hide();jQuery("#OptionsAndExtrasOverview").removeClass("currentStep nextStep").addClass("previousStep");var a=$find("OptionsAndExtrasOverview");if(a!=null){a.UpdateControlsToCurrentState()}jQuery("#BookingAddressCollapsedBlock").hide();jQuery("#BookingAddress").show().removeClass("previousStep nextStep").addClass("currentStep");this.ScrollComponentIntoView("BookingAddress");this.AdjustSizeToCashTicket("BookingAddress");this.RegisterHistoryPoint(3)},AdjustSizeToCashTicket:function(b){var a=$find("BookingCashTicket");if(a!==null){a.BringCashTicketIntoView(null,b)}},DialogMinHeightFix:function(){jQuery(".ui-dialog-content").css("min-height","0")},GetBookByEmailTravelInfo:function(){var a=$find("clickmain");if(a!=null){return a.GetCurrentTravelInfo()}},StartIndividualBookingDialog:function(){var a=null;var b=this.GetDefaultWaitSpecificationInstance();if(b!=null){this.Wait(b,true)}this.LoadBooking(this.quoteIdentification,a,b)}};Ecom.BookingDialogMediator.registerClass("Ecom.BookingDialogMediator",Ecom.Waiter);Ecom.BookingStepZero=function(a){ThomasCook.Ecom.Web.BookingAvailability.set_timeout(150000);Ecom.BookingStepZero.initializeBase(this,[a]);this.SetTravelInfoAndChoicesDelegate=Function.createDelegate(this,this.SetTravelInfoAndChoices);this.UpdateLocationInfoDelegate=Function.createDelegate(this,this.UpdateLocationInfo);this.GetSuperDealRadioBtnStateDelegate=Function.createDelegate(this,this.GetSuperDealRadioBtnState);this.UpdatePriceGridInfoDelegate=Function.createDelegate(this,this.UpdatePriceGridInfo);this.OnDurationDropdownChangedDelegate=Function.createDelegate(this,this.OnDurationDropdownChanged);this.ShowEmailBookingDelegate=Function.createDelegate(this,this.ShowEmailBooking);this.ShowWaitPanelDelegate=Function.createDelegate(this,this.ShowWaitPanel);this.HideWaitPanelDelegate=Function.createDelegate(this,this.HideWaitPanel);this.DisplayMostRecentQuoteDelegate=Function.createDelegate(this,this.DisplayMostRecentQuote);this.CheckTransportAvailabilityDelegate=Function.createDelegate(this,this.CheckTransportAvailability);this.SyncPriceGridTabControlWithSelectedPriceGridTabDelegate=Function.createDelegate(this,this.SyncPriceGridTabControlWithSelectedPriceGridTab);this.GetCurrentTravelInfoDelegate=Function.createDelegate(this,this.GetCurrentTravelInfo);this.ShowImportantTravelInfoDelegate=Function.createDelegate(this,this.ShowImportantTravelInfo);this.SwitchToGroupBookingDelegate=Function.createDelegate(this,this.SwitchToGroupBooking);this.SwitchToStepZeroDelegate=Function.createDelegate(this,this.SwitchToStepZero);this.ChangeTransportDelegate=Function.createDelegate(this,this.ChangeTransport);this.CollapseDelegate=Function.createDelegate(this,this.Collapse);this.ExpandDelegate=Function.createDelegate(this,this.Expand);this.AccordeonCollapseDelegate=Function.createDelegate(this,this.AccordeonCollapse);this.AccordeonExpandDelegate=Function.createDelegate(this,this.AccordeonExpand);this.ShowBookByEmailDelegate=Function.createDelegate(this,this.ShowBookByEmail);this.OnMultimediaDataReceivedDelegate=Function.createDelegate(this,this.OnMultimediaDataReceived);this.NextRoomTriggerLabelClickedDelegate=Function.createDelegate(this,this.NextRoomTriggerLabelClicked);this.StuntApplyRightLayoutDelegate=Function.createDelegate(this,this.StuntApplyRightLayout);this.SeasonSwitchResponseDelegate=Function.createDelegate(this,this.SeasonSwitchResponse);this.RegisterEventHandler("childrenCountSelect","change",false,ThomasCook.Ecom.Web.BookingAvailability.ChangeTravelInfo,this.UpdatePriceGridInfoDelegate,this.GetCurrentTravelInfoDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);this.RegisterEventHandler("removechildbutton","click",true,ThomasCook.Ecom.Web.BookingAvailability.ChangeTravelInfo,this.UpdatePriceGridInfoDelegate,this.GetCurrentTravelInfoDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);this.RegisterEventHandler("removeprice","click",true,ThomasCook.Ecom.Web.BookingAvailability.ChangeTravelInfo,this.UpdatePriceGridInfoDelegate,this.GetCurrentTravelInfoDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);this.RegisterEventHandler("startemailbooking","click",false,this.ShowBookByEmailDelegate,this.ShowEmailBookingDelegate,this.GetCurrentTravelInfoDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);this.RegisterEventHandler("adultcountselect","change",false,ThomasCook.Ecom.Web.BookingAvailability.ChangeTravelInfo,this.UpdatePriceGridInfoDelegate,this.GetCurrentTravelInfoDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);this.RegisterEventHandler("boardtypeselect","change",false,ThomasCook.Ecom.Web.BookingAvailability.ChangeTravelInfo,this.UpdatePriceGridInfoDelegate,this.GetCurrentTravelInfoDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);this.RegisterEventHandler("roomtypeselect","change",false,ThomasCook.Ecom.Web.BookingAvailability.ChangeTravelInfo,this.UpdatePriceGridInfoDelegate,this.GetCurrentTravelInfoDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);this.RegisterEventHandler("childageselect","change",false,ThomasCook.Ecom.Web.BookingAvailability.ChangeTravelInfo,this.UpdatePriceGridInfoDelegate,this.GetCurrentTravelInfoDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);this.RegisterEventHandler("airportselect","change",false,ThomasCook.Ecom.Web.BookingAvailability.UpdateInfoForHoliday,this.SetTravelInfoAndChoicesDelegate,this.GetCurrentTravelInfoDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);this.RegisterEventHandler("durationselect","change",false,this.OnDurationDropdownChangedDelegate,this.UpdatePriceGridInfoDelegate,this.GetCurrentTravelInfoDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);this.RegisterEventHandler("periodselect","change",false,ThomasCook.Ecom.Web.BookingAvailability.ChangeTravelInfo,this.UpdatePriceGridInfoDelegate,this.GetCurrentTravelInfoDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);this.RegisterEventHandler("transportclassselect","change",false,ThomasCook.Ecom.Web.BookingAvailability.ChangeTravelInfo,this.UpdatePriceGridInfoDelegate,this.GetCurrentTravelInfoDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);this.RegisterEventHandler("nextRoomTrigger","click",false,ThomasCook.Ecom.Web.BookingAvailability.ChangeTravelInfo,this.UpdatePriceGridInfoDelegate,this.GetCurrentTravelInfoDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);this.RegisterEventHandler("arrangementselect","change",false,ThomasCook.Ecom.Web.BookingAvailability.UpdateInfoForHoliday,this.SetTravelInfoAndChoicesDelegate,this.GetCurrentTravelInfoDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);this.RegisterEventHandler("main","change",false,ThomasCook.Ecom.Web.BookingAvailability.UpdateInfoForHoliday,this.SetTravelInfoAndChoicesDelegate,this.GetCurrentTravelInfoDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);this.RegisterEventHandler("rbregularOffer","click",false,this.GetSuperDealRadioBtnStateDelegate,null,null,null,null);this.RegisterEventHandler("rbsuperDealsOffer","click",false,this.GetSuperDealRadioBtnStateDelegate,null,null,null,null);this.RegisterEventHandler("bbemShowImportantTravelInfo","click",true,this.ShowImportantTravelInfoDelegate,null,null,null,null);this.RegisterEventHandler("superDealsBannerActivateTab","click",false,this.SuperDealsBannerActivateTab,null,null,null,null);this.RegisterEventHandler("superDealsBannerDisactivateTab","click",false,this.SuperDealsBannerDisactivateTab,null,null,null,null);this.RegisterEventHandler("collapse","click",false,this.CollapseDelegate,null,null,null,null);this.RegisterEventHandler("expand","click",false,this.ExpandDelegate,null,null,null,null);this.RegisterEventHandler("accordeoncollapse","click",false,this.AccordeonCollapseDelegate,null,null,null,null);this.RegisterEventHandler("accordeonexpand","click",false,this.AccordeonExpandDelegate,null,null,null,null);this.RegisterEventHandler("groupbooking","click",false,this.SwitchToGroupBookingDelegate,null,null,null,null);this.RegisterEventHandler("groupbookBackbtn","click",false,this.SwitchToStepZeroDelegate,null,null,null,null);this.RegisterEventHandler("priceChangeTransport","click",false,this.ChangeTransportDelegate,null,null,null,null);this.ShowTransportParametersSelectionDelegate=Function.createDelegate(this,this.ShowTransportParametersSelection);this.CheckForTransportBeforeCalculatePriceDelegate=Function.createDelegate(this,this.checkForTransportBeforeCalculatePrice);this.UpdatePriceGridInfoAndHideTransportSelectionDelegate=Function.createDelegate(this,this.UpdatePriceGridInfoAndHideTransportSelection);this.RegisterEventHandler("calcbuttonspan","click",false,this.CheckForTransportBeforeCalculatePriceDelegate,null,null,null,null);this.LoadBookingDelegate=Function.createDelegate(this,this.LoadBooking);this.CheckStartBookingDelegate=Function.createDelegate(this,this.CheckStartBooking);this.RegisterEventHandler("bookNowButton","click",true,this.LoadBookingDelegate,this.CheckStartBookingDelegate,this.GetClickedIndexDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);this.RegisterEventHandler("bookAlternativeNowButton","click",true,this.LoadBookingDelegate,this.CheckStartBookingDelegate,this.GetClickedIndexDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);this.RegisterEventHandler("advanceBookNowButton","click",true,this.LoadBookingDelegate,this.CheckStartBookingDelegate,this.GetClickedIndexDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);$addHandler(a,"click",this.OnClickDelegate);this.HandleBasicInsuranceInfoDelegate=Function.createDelegate(this,this.HandleBasicInsuranceInfo);jQuery("#priceTicketBasicInsuranceInfo").live("mouseover mouseout",this.HandleBasicInsuranceInfoDelegate);jQuery("[id^=nextRoomTriggerLabel]").live("click",this.NextRoomTriggerLabelClickedDelegate);this.HookChildSelects(a);Sys.Application.add_load(Function.createDelegate(this,this._onDetailPageLoad));this.commonDetailComponent=$create(Ecom.Detail.CommonDetailComponent,null,null,null);this.commonDetailComponent.setParentComponent(this);this.bestPriceFinder=null;this.superDealRadioBtnState=null;this.ShouldCollapsePriceCalculationsAfterUserAction=true;this.startBookingInfo={};this.mmComponent=null;this.mmContext=null;this.isMMMEnabled=false;this.mmmDataReceived=false;this.scrollPriceTicketIntoView=true;this.SalesForceProductCode=null;this.ReferringChannelShortDescription=null};Ecom.BookingStepZero.prototype={initialize:function Proto$BookStepZero$initialize(){if(Ecom.Detail.BestPriceFinder.isBestPriceFinderEnabled()){this.bestPriceFinder=$create(Ecom.Detail.BestPriceFinder,null,null,null,$get("bestPriceFinderComponent"));this.RegisterEventHandler("startBestPriceFinder","click",false,Function.createDelegate(this,this.onShowBestPriceFinder),null,null,null,null)}this.InitializeCollapseExpandOnLocationInfo();Ecom.BookingStepZero.callBaseMethod(this,"initialize");var a=$find("clickpricegrid");if(a!=null){a.RegisterCellSelectionNotificationHandler(Function.createDelegate(this,this.OnPricegridCellSelectionChanged))}},SynchDateDurationControlsSelectionWithPricegrid:function(b,a){jQuery("#durationselect").val(a);var c=new Date(b.substr(0,4),b.substr(4,2)-1,b.substr(6,2));jQuery("#departureDateCalender").datepicker("setDate",c);this.UpdateSelectedDateLabel(c)},OnPricegridCellSelectionChanged:function(e,d){this.SynchDateDurationControlsSelectionWithPricegrid(e,d);var c=$find("clickpricegrid");if(c!=null){if(!c.ShouldScrollToExistingCell(e,d)){var f=this.FindWaitSpecificationInstance($get("main"),"change");var a=$get("main");var b=this.GetCurrentTravelInfo();this.Wait(f,true);c.hidePriceExampleTooltip();ThomasCook.Ecom.Web.BookingAvailability.ChangeTravelInfo("dummy","select",b,this.UpdatePriceGridInfoDelegate,this.MethodTimeoutDelegate,f)}}},Collapse:function(d){var c=d.replace("collapse","expanded");jQuery("#"+c).hide();var a=d.replace("collapse","collapsed");jQuery("#"+a).show();var b=d.replace("collapse","expand");jQuery("#"+b).show();jQuery("#"+d).hide();this.CheckAdvanceBookLinkVisibility(d)},Expand:function(d){var c=d.replace("expand","expanded");jQuery("#"+c).show();var a=d.replace("expand","collapsed");jQuery("#"+a).hide();var b=d.replace("expand","collapse");jQuery("#"+b).show();jQuery("#"+d).hide();this.CheckAdvanceBookLinkVisibility(d)},CheckAdvanceBookLinkVisibility:function(c){var d=c.split("_");var b=d[d.length-1];var a=jQuery("#pricequote_"+b+" .toggle a.opened:visible").size();if(a>0){jQuery("#pricequote_"+b+" p.advance-book-link").show()}else{jQuery("#pricequote_"+b+" p.advance-book-link").hide()}},ShowBookByEmail:function(g,f,e,c,a,d){var b=$find("SalesForceBookingFormComponent");if(b!=null){this.ShowSalesForceEmailBooking(e,d)}else{ThomasCook.Ecom.Web.BookingAvailability.ShowBookByEmail(g,f,e,c,a,d)}},HandleBasicInsuranceInfo:function(a){var b=jQuery("#basicInsuranceTooltip");if(a.type=="mouseover"){var d=jQuery(a.currentTarget);var c=d.offset();b.showAsPopup({mouseX:c.left,mouseY:c.top,xOffset:-(b.width()+15),yOffset:-50,alignMiddle:false})}else{b.hide()}},AccordeonCollapse:function(a){this.Collapse(a)},AccordeonExpand:function(j){var h=j.split("_");var g=h.length-1;var c=true;var f=1;do{var a="";for(var e=0;e<g;e++){a+=h[e]+"_"}a+=f;f+=1;var d=$get(a);c=(d!=null);if(j==a){this.Expand(a)}else{var b=a.replace("expand","collapse");this.Collapse(b)}}while(c)},checkForTransportBeforeCalculatePrice:function(){var c=jQuery("#tsTransportAvailable").find("input[name='SearchTransport']").filter(":checked"),a=c.val();Sys.Debug.trace("Selected transport :"+a);var b=this.FindWaitSpecificationInstance($get("main"),"change");this.Wait(b,true);this.ShouldCollapsePriceCalculationsAfterUserAction=false;if(a==="train"||a==="flight"){ThomasCook.Ecom.Web.BookingAvailability.ShowTransportParametersSelection(this.GetCurrentTravelInfo(),this.ShowTransportParametersSelectionDelegate,this.MethodTimeoutDelegate,b)}else{ThomasCook.Ecom.Web.BookingAvailability.ChangeTravelInfo("calcbuttonspan",null,this.GetCurrentTravelInfo(),this.UpdatePriceGridInfoAndHideTransportSelectionDelegate,this.MethodTimeoutDelegate,b)}},bindRoomAnchorsToRoomPriceGridTab:function(){var a=$find("clickpricegrid");if(a!=null){jQuery("#roomselection .room-title-link").each(function(c){var b=c+1;if(!a.hasRoom(b)){jQuery(this).hide()}else{jQuery(this).click(function(d){a.selectRoom(b)})}})}},_openMultimediaModule:function(c){var b=jQuery(c.currentTarget);if(Shadowbox.isOpen()){Shadowbox.close()}var e;if(c){e=b.attr("data-item-id")}if(this.mmContext.data&&this.mmComponent==null){this.mmComponent=new mm(this.mmContext.data);jQuery("#mm-data-wrapper, #mm-accommodation-wrapper").hide()}if(this.mmComponent!==null){var a=this.mmComponent.getModule();a.disableCategory("Information");a.switchView("fullscreen");if(e!=""){a.select(e)}a.open();if(b.hasClass("show-on-map")||b.hasClass("google-maps-static")){a.switchView("map");var f=b.attr("data-item-code");if(f!=undefined&&f!=""){a.enableCategory(f.toUpperCase())}}var d=jQuery(".mm-accommodation-title").offset();jQuery.scrollTo("body","{top:"+d.top+", left:"+d.left+"}")}},_onDetailPageLoad:function(){if(this.isMMMEnabled){ThomasCook.Ecom.Web.BookingAvailability.ReceiveMultimediaData(this.OnMultimediaDataReceivedDelegate)}if(jQuery("#earlybookingdetailcontent").length!=1){this.GetInitialContent()}},OnMultimediaDataReceived:function(a){if(a==null&&a==""){return}Sys.Debug.trace("mm data is received");this.mmContext={data:a||null,isEnabled:this.isMMMEnabled||false};try{isEnabled=this.mmContext.isEnabled&&this.mmContext.data&&(typeof mm!=="undefined");if(isEnabled){jQuery(".mm-trigger").live("click",Function.createDelegate(this,this._openMultimediaModule))}this.mmContext.isEnabled=isEnabled;this.mmmDataReceived=true}catch(b){Sys.Debug.trace("Error initializing multimediamodule")}this._resetMMMTriggers()},_resetMMMTriggers:function(){if(!this.mmmDataReceived){jQuery(".thumb-image-link.mm-trigger").hide();if(gmComponent){gmComponent.reinitializeEventBinding(this.mmmDataReceived);jQuery(".google-maps-viewport").removeAttr("style")}}},onShowBestPriceFinder:function(){if(this.bestPriceFinder!=null){this.bestPriceFinder.show()}},updateStartBookingInfo:function(){var b=jQuery("#startbooking").attr("initialHidden");var a=jQuery("#_priceTicketsInfo");var c={totalQuotesCount:parseInt(a.attr("quotesCount"),10)||0,failedQuotesCount:parseInt(a.attr("failedQuotesCount"),10)||0,isInitialHidden:(b!==undefined&&b==="true")};c.succeedQuotesCount=c.totalQuotesCount-c.failedQuotesCount;c.showStartBookingBlock=(!c.isInitialHidden||c.totalQuotesCount>0);jQuery.extend(this.startBookingInfo,c)},toggleCalculateLabel:function(){var a=this.startBookingInfo.totalQuotesCount||0;if(a>0){jQuery("#calcbuttonspan_calc").css("display","none");jQuery("#calcbuttonspan_recalc").css("display","inline-block");jQuery("#calcbuttonspan_calctransport").css("display","none");jQuery("#calcbuttonspan_recalctransport").css("display","inline-block")}else{jQuery("#calcbuttonspan_recalc").css("display","none");jQuery("#calcbuttonspan_calc").css("display","inline-block");jQuery("#calcbuttonspan_recalctransport").css("display","none");jQuery("#calcbuttonspan_calctransport").css("display","inline-block")}},toggleBlocksVisibility:function(g,f){jQuery(".middle-column-container").show();jQuery("#clickpricegrid").show();jQuery("#showAlternatives").show();var j=this.NoPriceGridModus();jQuery("#calcbuttonspan").closest("div.bgPrice").hide();var c=jQuery("#tsTransportAvailable");var h=(c!==undefined&&c.is(":visible"));var a=this.startBookingInfo.totalQuotesCount||0;if(this.startBookingInfo.showStartBookingBlock||(h&&a>0)){jQuery("#startbooking").show()}else{jQuery("#startbooking").hide()}if(j){if(g&&jQuery("#calcbuttonspan").attr("hasPrice")==="True"){jQuery("#clickpricegrid").hide()}else{jQuery("#calcbuttonspan").closest("div.bgPrice").show()}}else{if(!f&&!h){jQuery("#calcbuttonspan").closest("div.bgPrice").show()}}this.toggleCalculateLabel();var d=jQuery("#startemailbooking"),e=(d.hasClass("btAction")&&d.is(":visible"));if(e){jQuery("#transporttypeselectionpanel").hide();this.toggleButtonHighlighting("#startemailbooking")}if(f){var b;if(this.scrollPriceTicketIntoView){b=$get("priceticket")}else{b=$get("pricegrid")}if(b!=null){b.scrollIntoView(true)}}},toggleButtonHighlighting:function(c){var b=jQuery(c);var a=(this.startBookingInfo.succeedQuotesCount===0&&b.hasClass("btAction")&&b.is(":visible"));b.toggleClass("highlighted-button",a)},CheckStartBooking:function(c,b,a){if(c!=null){this.DoPartialUpdateWithOmnitureLogging(c)}this.Wait(b,false);if(c.MultipleDetailPagesDetected){alert("Multiple open detail pages are not supported")}},LoadBooking:function(b,h,c,d,j,f){var g=$find("BookingDialog");if(g!=null){var e=$get("main");var a=e.attributes.packageCode.value;g.LoadBooking(c,a,f)}},SwitchToGroupBooking:function(){var a=$find("BookingDialog");if(a!=null){a.GoToGroupBooking()}},SwitchToStepZero:function(){var a=$find("BookingDialog");if(a!=null){a.GroupBookBackToStepZero()}},GetInitialContent:function(){var a=this.FindWaitSpecificationInstance($get("main"),"change");this.Wait(a,true);ThomasCook.Ecom.Web.BookingAvailability.GetInitialInfoForHoliday(null,null,this.GetInitialTravelInfo(),this.SetTravelInfoAndChoicesDelegate,this.MethodTimeoutDelegate,a)},SetTravelInfoAndChoices:function(g,b,h){if(g===null){this.Wait(b,false);return}this.DoPartialUpdateWithOmnitureLogging(g);var c=this;var a=this.populateDropdown({data:g.airports,select:"airportselect",label:"airporttext"});jQuery("#airportSelectContainer").toggle(a);var e=this.populateDropdown({data:g.transportClasses,select:"transportclassselect",label:"transportclasstext"});jQuery("#transportClassSelectContainer").toggle((Ecom.Application.brand==="nvb")?a&&e:false);var d=this.ReinitializeDepartureCalendar(g.departureDateRange);jQuery("#noavailmessage").toggle(!d);var f=this.populateDropdown({data:g.durations,select:"durationselect",label:"durationtext"});jQuery("#durationSelectContainer, #roomselection").toggle(f);if(!this.NoPriceGridModus()){jQuery("#periodSelectContainer").toggle(f)}if(g.HasValidGridSelection){jQuery("#startemailbooking").addClass("btAction").attr("disableClick",false)}this.UpdateSuperDealBanner();this.updateStartBookingInfo();this.bindRoomAnchorsToRoomPriceGridTab();this.Wait(b,false);var j=$find("clickpricegrid");if(j!=null){j.SetGridData(g.GridData);j.UpdateTransportAvailabilityForSelectedCell()}this.UpdateSelectedCell();jQuery("#tabstrip li[id^='tabstrip_']").each(function(){jQuery(this).bind("click",function(){if(jQuery(this).attr("id")=="tabstrip_SUPERDEALS"){jQuery("#rbsuperDealsOffer").attr("checked","checked")}else{if(jQuery(this).attr("id")=="tabstrip_ENVIRONMENT"){c.LoadLocationInfoData()}else{jQuery("#rbregularOffer").attr("checked","checked")}}c.GetSuperDealRadioBtnState()})});if(this.bestPriceFinder!=null){this.bestPriceFinder.update({isInitialUpdate:g.isInitialUpdate,initialAirports:g.airports,initialDurations:g.AllPossibleDurations,preferences:g.userPreferences})}this.HandlePriceTicketsCollapsing();this.toggleBlocksVisibility(true,this.NoPriceGridModus());this.UpdateScrollContainer()},ShouldDoPartialUpdateForNewCellPosition:function(c,b){var a=$find("clickpricegrid");return !a.ShouldScrollToExistingCell(c,b)},SyncPricegridSelectionWithDateDurationControls:function(c,b){var a=$find("clickpricegrid");var d=$get("main").attributes.selectedcellroom.value;a.SelectCell(c,b,d);a.ScrollSelectedCellIntoView();this.UpdatePriceGridInfo(null,null,null)},OnDurationDropdownChanged:function(h,g,c,e,b,f){var a=jQuery("#durationselect").val();var d=$get("main").attributes.selectedcelldate.value;if(this.ShouldDoPartialUpdateForNewCellPosition(d,a)){c.selectedCellDuration=a;ThomasCook.Ecom.Web.BookingAvailability.ChangeTravelInfo("dummy","select",c,e,b,f)}else{this.SyncPricegridSelectionWithDateDurationControls(d,a);this.Wait(f,false)}},ReinitializeDepartureCalendar:function(e){if((e!=null)&&(e.initiallySelectedDepartureDate!=null)){this.UpdateSelectedDateLabel(e.initiallySelectedDepartureDate);var c=this;var d=$get("main").attributes.language.value;if(d==null){d="nl"}jQuery.datepicker.setDefaults(jQuery.datepicker.regional[d]);var b=jQuery("#departureDateCalender");b.datepicker("destroy");b.datepicker({onSelect:function(k,f){var o=f.input.datepicker("getDate");var g=o.format("yyyyMMdd");if(e.departureDateSeasons[g]!=e.season){var n=c.FindWaitSpecificationInstance($get("main"),"change");c.Wait(n,true);var p=c.GetCurrentTravelInfo();p.seasonCode=e.departureDateSeasons[g];ThomasCook.Ecom.Web.BookingAvailability.GetProductUrl("dummy","click",p,c.SeasonSwitchResponseDelegate,c.MethodTimeoutDelegate,n)}else{c.UpdateSelectedDateLabel(o);var n=c.FindWaitSpecificationInstance($get("main"),"change");var j=$get("main");hide("SeasonSwitchMessage");var l=j.attributes.selectedcellduration.value;var m=g;if(c.ShouldDoPartialUpdateForNewCellPosition(m,l)){j.attributes.selectedcelldate.value=m;var h=c.GetCurrentTravelInfo();c.Wait(n,true);ThomasCook.Ecom.Web.BookingAvailability.ChangeTravelInfo("dummy","select",h,c.UpdatePriceGridInfoDelegate,c.MethodTimeoutDelegate,n)}else{c.SyncPricegridSelectionWithDateDurationControls(m,l)}}return[false,""]},beforeShowDay:function(g){var f=jQuery.datepicker.formatDate("yymmdd",g);if(f in e.departureDateSeasons){return[true,""]}return[false,""]},dateFormat:"yyyyMMdd",minDate:e.minimumDepartureDate,maxDate:e.maximumDepartureDate,defaultDate:e.initiallySelectedDepartureDate,hideIfNoPrevNext:true,changeFirstDay:false,showOtherMonths:false,duration:"fast",showAnim:"fadeIn",showOn:"button",buttonImage:"/App/Upload/Css/NVB/Images/calendar.gif",buttonImageOnly:true,buttonText:jQuery("#departureDateCalenderImageAlt").attr("value"),changeMonth:true,changeYear:true,beforeShow:function(f,g){g.dpDiv.css({marginTop:20+"px",marginLeft:-127+"px"})}});b.datepicker("setDate",e.initiallySelectedDepartureDate);jQuery("#periodSelectContainer span.period-calender-trigger").click(function(){b.datepicker("show")});if(e.departureDateSeasons!=null){for(var a in e.departureDateSeasons){return true}}return false}},UpdateSelectedDateLabel:function(b){var a=$get("departureDateCalenderText");if(a!=null){a.innerHTML=b.format("dd/MM/yyyy")}},GetRoomPromoType:function(){if(jQuery("#rbregularOffer").length){return jQuery("input[name='superDeals']:checked").val()}return"NotSuperDeal"},GetInitialTravelInfo:function(){var f=new ThomasCook.Ecom.Core.PageComponents.Data.CommonView.Booking.BookingStepZero.TravelInfo();var a=$get("main");f.channelName=a.attributes.channel.value;f.SalesForceProductCode=this.SalesForceProductCode;f.shortDescription=a.attributes.shortDescription.value;f.pageKey=a.attributes.pageKey.value;f.packageCode=a.attributes.packageCode.value;f.catalogCode=a.attributes.catalogCode.value;f.brandCode=a.attributes.brandCode.value;f.seasonCode=a.attributes.seasonCode.value;f.selectedCellDate=a.attributes.selectedcelldate.value;f.selectedCellDuration=a.attributes.selectedcellduration.value;f.Language=a.attributes.languageISO.value;var e=a.attributes.defaultDepartureDay.value;f.departureDate=e;f.selectedPeriod=e;f.selectedAirport=a.attributes.defaultAirport.value;var b=$get("arrangementselect").value;if(b==""){b=a.attributes.standardPackageCode.value}f.arrangement=b;f.transportClass=a.attributes.defaultTransportClass.value;f.selectedDuration=a.attributes.defaultDuration.value;f.numberOfRooms=a.attributes.defaultNumberOfRooms.value;f.roomPromoType=a.attributes.roomPromoType.value;this.superDealRadioBtnState=a.attributes.roomPromoType.value;f.selectedRoom=1;f.roomOccupations=new Array();for(var c=0;c<f.numberOfRooms;c++){var d=this.GetInitialRoomOccupation(c+1,a);f.roomOccupations[c]=d}return f},GetInitialRoomOccupation:function(roomIdx,main){var roomInfo=new ThomasCook.Ecom.Core.PageComponents.Data.CommonView.Booking.BookingStepZero.RoomOccupation();var defaultPackageCode=main.attributes["defaultRoomPackageCode"+roomIdx].value;var defaultRoomBookCode=main.attributes["defaultRoomBookCode"+roomIdx].value;roomInfo.numberOfAdults=main.attributes["defaultNumberOfTravelers"+roomIdx].value;roomInfo.boardType=main.attributes["defaultBoardType"+roomIdx].value;roomInfo.roomNumber=roomIdx;roomInfo.roomIdentification=defaultPackageCode+"__"+defaultRoomBookCode;var defaultChildAges=main.attributes["defaultChildAges"+roomIdx].value;roomInfo.childAges=eval(defaultChildAges);return roomInfo},NextRoomTriggerLabelClicked:function(a){jQuery(a.target).siblings("input:checkbox").click()},GetCurrentTravelInfo:function(){var e=$get("main");var m=new ThomasCook.Ecom.Core.PageComponents.Data.CommonView.Booking.BookingStepZero.TravelInfo();var c=jQuery("input[name='SearchTransport']:checked").val();if(c!=null){m.selectedTransportType=c}m.ReferringChannelShortDescription=this.ReferringChannelShortDescription;m.channelName=e.attributes.channel.value;m.SalesForceProductCode=this.SalesForceProductCode;m.shortDescription=e.attributes.shortDescription.value;m.pageKey=e.attributes.pageKey.value;m.packageCode=e.attributes.packageCode.value;m.catalogCode=e.attributes.catalogCode.value;m.Language=e.attributes.languageISO.value;m.brandCode=e.attributes.brandCode.value;m.seasonCode=e.attributes.seasonCode.value;m.selectedCellDate=e.attributes.selectedcelldate.value;m.selectedCellDuration=e.attributes.selectedcellduration.value||1;m.roomPromoType=this.GetRoomPromoType();m.selectedDuration=$get("durationselect").value||e.attributes.defaultDuration.value||1;var h=jQuery("#departureDateCalender").datepicker("getDate");var k=(h?h.format("yyyyMMdd"):e.attributes.defaultDepartureDay.value)||"";m.departureDate=k;m.selectedPeriod=k;var b=$find("clickpricegrid");m.selectedRoom=(b!=null)?b.getSelectedRoom():1;var f=jQuery(".jqAdditionalRoom");if(f.is(":checked")){var j=f.attr("id").split("_")[1];m.numberOfRooms=j}else{m.numberOfRooms=jQuery("input[id^=nextRoomTrigger]:checked").length+1}var g=jQuery("#airportselect option:selected");m.selectedAirport=g.val()||e.attributes.defaultAirport.value;if(g.val()){m.selectedAirportDescription=g.text()}if(m.roomPromoType=="SuperDeal"){m.arrangement=e.attributes.standardPackageCode.value}else{m.arrangement=$get("arrangementselect").value||e.attributes.standardPackageCode.value}var a=jQuery("#transportclassselect option:selected");m.transportClass=a.val()||e.attributes.defaultTransportClass.value;if(a.val()){m.transportClassDescription=a.text()}var l=$get("travelAgentProvincesSelect");if(l!=null){m.selectedTravelAgentRegion=l.value}var d=$get("travelAgentCitiesSelect");if(d!=null){m.selectedTravelAgentCity=d.value}m.roomOccupations=[];var n=0;jQuery("#roomselection div.room-details[id]").each(function(s){if(s==0||jQuery("input[id^=nextRoomTrigger]",this).is(":checked")){++n;var q=new ThomasCook.Ecom.Core.PageComponents.Data.CommonView.Booking.BookingStepZero.RoomOccupation();q.roomNumber=n;var p=s+1;if($get("roomDetails_"+p)){q.numberOfAdults=jQuery('select[id^="adultcountselect"] option:selected',this).val();q.childrenCount=jQuery('select[id^="childrenCountSelect_"] option:selected',this).val()||0;q.boardType=jQuery('select[id^="boardtypeselect"] option:selected',this).val();q.roomIdentification=jQuery('select[id^="roomtypeselect"] option:selected',this).val()}var t=jQuery("#cell_"+p+"_"+m.selectedCellDuration+"_"+m.selectedCellDate);if(t.length){q.selectedPackageCode=t.attr("pricePackageCodeTo");q.selectedRoomBookCode=t.attr("priceRoomBookCode");q.selectedCatalogCode=t.attr("priceCatalogCode");q.selectedBrandCode=t.attr("priceBrandCode");var o=$find("clickpricegrid");if(o){var r=o.getPriceExampleTooltipInfo(t);if(r!=null){q.selectedPrice=r.priceAmount}}m.SelectedDestinationAirport=t.attr("arrivalAirportCode")}q.childAges=[];jQuery('select[id^="childageselect"]',this).each(function(u){q.childAges[u]=jQuery("option:selected",this).val()});m.roomOccupations[n-1]=q;m.Place=jQuery("#holiday_place").text();m.Country=jQuery("#holiday_country").text()}});return m},UpdateSelectedCell:function(){var d,e;var a=jQuery("#main");var c=$find("clickpricegrid");if(c){var b=c.getSelectedCell();if(b&&b.length>0){d=b.attr("date")||"";e=b.attr("duration")||"";a.attr({selectedcelldate:d,selectedcellduration:e});this.SynchDateDurationControlsSelectionWithPricegrid(d,e);Sys.Debug.trace("new selected cell: "+a.attr("selectedcelldate")+"/"+a.attr("selectedcellduration"))}}if(c){c.priceExampleTooltipInitialization({selectedColumn:d,selectedRow:e})}},UpdatePriceGridInfoAndHideTransportSelection:function(c,b,a){this.UpdatePriceGridInfo(c,b,a);hide("tsTransportAvailable");this.toggleBlocksVisibility(true,true)},UpdatePriceGridInfo:function(d,c,b){if(d!=null){this.DoPartialUpdateWithOmnitureLogging(d);if(this.bestPriceFinder!=null){this.bestPriceFinder.update({preferences:d.userPreferences})}}this.updateStartBookingInfo();this.bindRoomAnchorsToRoomPriceGridTab();var a=$find("clickpricegrid");if(a){if(d!=null){a.SetGridData(d.GridData)}a.UpdateTransportAvailabilityForSelectedCell()}this.UpdateSelectedCell();this.Wait(c,false);this.HandlePriceTicketsCollapsing();this.toggleBlocksVisibility(false,false);this.UpdateScrollContainer()},UpdateScrollContainer:function(){var a=jQuery("#pricegrid table.container:visible").height();if(a!=null){jQuery("#pricegrid div.scrollContainer").height(a-1+"px")}},SeasonSwitchResponse:function(d,c,a){if(d!=null){this.DoPartialUpdateWithOmnitureLogging(d)}this.Wait(c,false);var b=d.RedirectLocation;if((b!=null)&&(b.length>0)){var e=new Object();jQuery(".jqpreviouslink").each(function(){var f=jQuery(this).attr("href");if((f!=null)&&(f.length>0)){e.pl=encodeURIComponent(f)}});jQuery(".jqnextlink").each(function(){var f=jQuery(this).attr("href");if((f!=null)&&(f.length>0)){e.nl=encodeURIComponent(f)}});jQuery(".jqlisterlink").each(function(){var f=jQuery(this).attr("title");if((f!=null)&&(f.length>0)){e.ll=encodeURIComponent(f)}});jQuery(".jqcurrentpos").each(function(){var f=jQuery(this).text();if((f!=null)&&(f.length>0)){e.clp=encodeURIComponent(f)}});jQuery(".jqlastpos").each(function(){var f=jQuery(this).text();if((f!=null)&&(f.length>0)){e.llp=encodeURIComponent(f)}});this.PostToSeasonSwitchPage(b,e)}},RedirectToSeasonSwitchPage:function(a,b){for(var c in b){a+="&"+c+"="+b[c]}document.location.href=a},PostToSeasonSwitchPage:function(a,c){var b=document.createElement("form");b.method="post";b.action=a;for(var d in c){var e=document.createElement("input");e.setAttribute("name",d);e.setAttribute("value",c[d]);b.appendChild(e)}document.body.appendChild(b);b.submit();document.body.removeChild(b)},ShowTransportParametersSelection:function(c,b,a){this.UpdatePriceGridInfo(c,b,a);var d=$find("transportParametersComponent");if(d!==null){d.showTransportDialog(c)}},ShowEmailBooking:function(c,b,a){if(c!=null){this.DoPartialUpdateWithOmnitureLogging(c)}this.Wait(b,false);var d=$find("BookingDialog");if(d!=null){d.GoToBookByEmail(c)}},ShowSalesForceEmailBooking:function(c,a){this.Wait(a,false);var b=$find("BookingDialog");if(b!=null){b.GoToBookByEmail(c)}},ShowWaitPanel:function(){if(Ecom.Application.waiterBox==null){return}var c=jQuery("#middlecolumn");if(!c.is(":visible")){c=jQuery("#bookbyemailcolumn")}var g=c.offset();var a=c.width();var h=c.height();var f=0;var d=g.top;if(g.left>0){f=g.left}var b=f+((a-Ecom.Application.waiterBox.width())/2);var e=d+100;Ecom.Application.showWaiterBox({left:b,top:e,overlay:{left:f,top:d,width:a,height:h}})},HideWaitPanel:function(){Ecom.Application.hideWaiterBox()},DisplayMostRecentQuote:function(){show("comparepricesinfo")},CheckTransportAvailability:function(){var a=$find("clickpricegrid");if(a!=null){a.UpdateTransportAvailabilityForSelectedCell()}},SyncPriceGridTabControlWithSelectedPriceGridTab:function(){var a=$find("clickpricegrid");if(a!=null){a.updateTabControl()}},ShowImportantTravelInfo:function(){var a=$get("bbemImportantTravelInfo");var e=a.getAttribute("bbembrandcode");var d="<html><head><title>Info</title>";d+='<link rel="stylesheet" href="/App/Upload/Css/'+e+'/common.css">';d+='<link rel="stylesheet" href="/App/Upload/Css/'+e+'/detailview.css"></head>';d+='<body><div class="importantTravelInfoModalBody" style="height:497;width:649"><div>';d+=a.innerHTML;d+="</div></div></body>";var c=window.open("","name","height=497,width=649,scrollbars=yes");var b=c.document;b.write(d);b.close()},StuntApplyRightLayout:function(){this.UpdateRoomDivsStyle()},getSelectMode:function(a){return(a.length==1)?"readonly":"select"},UpdateRoomDivsStyle:function(){var a=this;jQuery("#roomselection div.room-details[id]").each(function(e){var d="_"+(e+1);var c=jQuery("#roomDetails"+d);var b=jQuery.map(["adultcount","boardtype","roomtype"],function(f){return{selectId:f+"select"+d,labelId:f+"text"+d}});b.push({selectId:"childrenCountSelect",labelId:"childrenCountText"});jQuery.each(b,function(g,j){var h=$get(j.selectId);if(h!=null){a.ChangeSelectToMode(h,$get(j.labelId),a.getSelectMode(h));if(/^boardtype/i.test(j.selectId)){var f=(h.options&&h.options.length>0);jQuery("tr.board-type-container",c).toggle(f)}}});jQuery('select[id^="childageselect"]',this).each(function(g){var f=d+"_"+(g+1);a.ChangeSelectToMode(this,$get("childagetext"+f),a.getSelectMode(this));show("divRemoveChild"+f)})})},SuperDealsBannerActivateTab:function(){detailTabControl.SetTabFocus("SUPERDEALS");switchToSmallPhotoModule()},SuperDealsBannerDisactivateTab:function(){detailTabControl.SetTabFocus("OVERVIEW");switchToBigPhotoModule()},UpdateSuperDealBanner:function(){if(jQuery(".super-deals-banner").length>0){var a=this.GetRoomPromoType();if(a=="SuperDeal"){jQuery(".super-deals-banner.disabled").css("display","none");jQuery(".super-deals-banner.enabled").css("display","block");jQuery(".holiday-section.preferences-arrangement").css("display","none");this.SuperDealsBannerActivateTab();jQuery("#middlecolumn").addClass("super-deals-mode-selected")}else{jQuery(".super-deals-banner.enabled").css("display","none");jQuery(".super-deals-banner.disabled").css("display","block");if(jQuery("#main").attr("hasArrangement")=="true"){jQuery(".holiday-section.preferences-arrangement").css("display","block")}jQuery("#middlecolumn").removeClass("super-deals-mode-selected")}}},GetSuperDealRadioBtnState:function(c){var b=jQuery("input[name='superDeals']:checked").val();if(b==undefined){return}if(b!=this.superDealRadioBtnState){if(b=="SuperDeal"){this.SuperDealsBannerActivateTab()}else{this.SuperDealsBannerDisactivateTab()}this.superDealRadioBtnState=b;var a=this.FindWaitSpecificationInstance($get("main"),"change");this.Wait(a,true);ThomasCook.Ecom.Web.BookingAvailability.UpdateInfoForHoliday("superDeals","click",this.GetCurrentTravelInfo(),this.SetTravelInfoAndChoicesDelegate,this.MethodTimeoutDelegate,a)}},LoadLocationInfoData:function(){var a=jQuery("#locationInfoPlaceholder");if(a.length>0){var b=this.FindWaitSpecificationInstance($get("main"),"change");this.Wait(b,true);ThomasCook.Ecom.Web.BookingAvailability.RetrieveLocationInfoData("locationInfoPlaceholder","click",this.GetCurrentTravelInfo(),this.UpdateLocationInfoDelegate,this.MethodTimeoutDelegate,b)}},UpdateLocationInfo:function(a){if(a){var c=jQuery("#locationInfoPlaceholder");c.html(a.DivHtml);c.attr("id","locationInfo");this.InitializeShadowboxForLocationInfo();this.InitializeCollapseExpandOnLocationInfo()}var b=this.FindWaitSpecificationInstance($get("main"),"change");this.Wait(b,false)},InitializeShadowboxForLocationInfo:function(){jQuery("#locationInfo").find('a[rel^="shadowbox"]').each(function(a){if(jQuery(this).hasClass("shadowbox-trigger")){jQuery(this).bind("click",function(){var b=jQuery(this).attr("rel");var c=jQuery("a[rel^='"+b+"']:first");if(c&&!jQuery(c).hasClass("more-photos-link")){c.click()}})}else{jQuery(this).shadowbox()}})},NoPriceGridModus:function(){var a=$get("nopricegridmoduscontrol");return(a!=null)},ChangeTransport:function(){show("tsTransportAvailable")},HandlePriceTicketsCollapsing:function(){if(this.ShouldCollapsePriceCalculationsAfterUserAction){jQuery("#priceChangeTransportContainer").hide();this.CollapsePriceTickets()}else{this.ShouldCollapsePriceCalculationsAfterUserAction=true}},CollapsePriceTickets:function(){var a=this;jQuery("[id^='accordeoncollapse_entirepricequote']").each(function(){var b=jQuery(this).attr("id");a.Collapse(b)})},InitializeCollapseExpandOnLocationInfo:function(){jQuery(".location-info .location .title, .location-info .topic .title").bind("click",function(){jQuery(this).closest(".location").toggleClass("expanded");jQuery(this).closest(".topic").toggleClass("expanded")});jQuery(".location-info .topic .topic-title, .location-info .item .title").bind("click",function(){jQuery(this).closest(".topic").toggleClass("expanded");var b=jQuery(this).closest(".item");var a=b.siblings(".expanded");var c=b.closest(".topic").siblings().find(".item.expanded");a.removeClass("expanded");c.removeClass("expanded");b.toggleClass("expanded");jQuery.scrollTo(jQuery(this).closest(".topic"),{duration:500})});jQuery(".location-info .expand-all").bind("click",function(){jQuery(".location").addClass("expanded");jQuery(".topic").addClass("expanded");jQuery(".location-info .toggle-button").toggle()});jQuery(".location-info .collapse-all").bind("click",function(){jQuery(".location").removeClass("expanded");jQuery(".topic").removeClass("expanded");jQuery(".item").removeClass("expanded");jQuery(".location-info .toggle-button").toggle()})}};Ecom.BookingStepZero.registerClass("Ecom.BookingStepZero",Ecom.Omniture);Ecom.BookingStartOverview=function(a){Ecom.BookingStartOverview.initializeBase(this,[a]);this.OnBookingStartOverviewBackButtonClickDelegate=Function.createDelegate(this,this.OnBookingStartOverviewBackButtonClick);this.RegisterEventHandler("bookingOverviewBackButton","click",true,this.OnBookingStartOverviewBackButtonClickDelegate,null,null,null,null);$addHandler(a,"click",this.OnClickDelegate)};Ecom.BookingStartOverview.prototype={initialize:function(){},OnBookingStartOverviewBackButtonClick:function(){this.Mediator.EditStep0()}};Ecom.BookingStartOverview.registerClass("Ecom.BookingStartOverview",Ecom.Waiter);Ecom.BookingStartOverviewCollapsed=function(a){Ecom.BookingStartOverviewCollapsed.initializeBase(this,[a]);this.OnComponentClickDelegate=Function.createDelegate(this,this.OnComponentClick);this.RegisterEventHandler("editFlightOnlyCollapsedOverview","click",true,this.OnComponentClickDelegate,null,null,null,null);$addHandler(a,"click",this.OnClickDelegate)};Ecom.BookingStartOverviewCollapsed.prototype={initialize:function(){},OnComponentClick:function(){this.Mediator.EditStep0()}};Ecom.BookingStartOverviewCollapsed.registerClass("Ecom.BookingStartOverviewCollapsed",Ecom.Waiter);Ecom.BookingPersonalia=function(a){Ecom.BookingPersonalia.initializeBase(this,[a]);this.OnComponentClickDelegate=Function.createDelegate(this,this.OnComponentClick);this.RegisterEventHandler("","click",true,this.OnComponentClickDelegate,null,null,null,null);$addHandler(a,"click",this.OnClickDelegate);this.OnSubmitPersonalInfoDelegate=Function.createDelegate(this,this.OnSubmitPersonalInfo);this.GetCurrentPersonalInfoDelegate=Function.createDelegate(this,this.GetCurrentPersonalInfo);this.GetCurrentPersonalInfoToProceedDelegate=Function.createDelegate(this,this.GetCurrentPersonalInfoToProceed);this.OnPersonalInfoSubmittedDelegate=Function.createDelegate(this,this.OnPersonalInfoSubmitted);this.RegisterEventHandler("foSubmit","click",true,this.OnSubmitPersonalInfoDelegate,this.OnPersonalInfoSubmittedDelegate,this.GetCurrentPersonalInfoDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);this.CreateAutoCompleteLastNamesDelegate=Function.createDelegate(this,this.CreateAutoCompleteLastNames);jQuery.showInfoPopupOnClick("#importantTravelInfoLink","#importantTravelInfoPopup")};Ecom.BookingPersonalia.prototype={initialize:function(){this.DepartureYear=null;this.DepartureMonth=null;this.DepartureDay=null},OnComponentClick:function(){},OnPersonalInfoSubmitted:function(d,c,a){var b=d.divUpdates;this.DoPartialUpdateWithOmnitureLogging(d);this.Wait(c,false);this.Mediator.OnPersonaliaInfoSubmitted(d)},ValidatePersonAdultness:function(d,f){var b=$get(d+"_years").value;var c=$get(d+"_months").value;var a=$get(d+"_days").value;var e=new Date();e.setFullYear(parseInt(b)+18,parseInt(c)-1,parseInt(a));if(this.ClearTimePartOfDate(e)>this.ClearTimePartOfDate(f)){return false}return true},ValidatePersonBornYet:function(d,f){var b=$get(d+"_years").value;var c=$get(d+"_months").value;var a=$get(d+"_days").value;var e=new Date();e.setFullYear(parseInt(b),parseInt(c)-1,parseInt(a));if(this.ClearTimePartOfDate(e)>this.ClearTimePartOfDate(f)){return false}return true},ClearTimePartOfDate:function(a){a.setMilliseconds(0);a.setSeconds(0);a.setMinutes(0);a.setHours(0);return a},OnSubmitPersonalInfo:function(q,c,C,w,f,h){var y=true;var k=true;var A=true;var z=true;var x="";var a=null;var B=null;var t=null;var r=null;var j=null;var g=parseInt($get("travellersCount").value);var p=0;var v=1;do{var e="TravellerDetails_"+v;var o=false;a=$get(e+"_firstName");t=$get(e+"_lastName");r=$get(e+"_gender");j=$find(e);if(null!=j){j.Validate()}if(v==1){B=jQuery("#TravellerDetails_1_middleName");if(B&&B.hasClass("watermark")&&B.val()==B.attr("name")){B.val("");o=true}var b=this.UpdateMandatoryWaterMarkFieldIndicator(a,"invalid");var n=this.UpdateMandatoryWaterMarkFieldIndicator(t,"invalid");if(!b||!n){A=false}}else{var u=this.UpdateMandatoryFieldIndicator(a,"invalid");var d=this.UpdateMandatoryFieldIndicator(t,"invalid");if(!u||!d){z=false}}var s=this.UpdateMandatoryFieldIndicator(r,"invalid");if(null!=j&&a!=null&&k==true){if(!A||!z||!s||!j.IsValidDate()){y=false;k=false;if(o&&B){B.watermark(B.attr("name"))}}}var m=new Date();if(this.DepartureYear!=null&&this.DepartureMonth&&this.DepartureDay){m.setFullYear(this.DepartureYear,this.DepartureMonth-1,this.DepartureDay)}if((v==1)&&(null!=j)){if(this.ValidatePersonAdultness(e,new Date())==false){y=false;x+=$get("foErrorContactPersonShouldBeAdult").innerHTML+"\n"}p++}if(this.ValidatePersonBornYet(e,new Date())==false){y=false;x+=$get("foErrorBirthDateInFuture").innerHTML+"\n"}if(v>1&&this.ValidatePersonAdultness(e,m)&&(null!=j)){p++}v++}while(v<=g);if(this.Mediator.CheckAdultAgesOnPersonaliaSubmit()==true){var l=parseInt($get("adultcount").value);if(p!=l){y=false;x+=$get("foErrorWrongNumberOfAdults").innerHTML+"\n"}}if(y==true){hide("personaliaMandatoryFieldExplanation");this.Mediator.PersonaliaInfoSubmit(q,c,C,w,f,h)}else{this.HideWaitPanel();show("personaliaMandatoryFieldExplanation");if(x!=""){this.ShowErrorPopup(x)}GetOmnitureEventSuite().Booking_TravellersSubmit_InvalidData()}},GetCurrentPersonalInfo:function(){var a=new ThomasCook.Ecom.Core.PageComponents.Data.CommonView.Booking.BookByEmail.EmailBookingUI();a.travellers=new Array();var d=1;do{var e="TravellerDetails_"+d;var b=$get(e+"_firstName");if(b!=null){var c=new ThomasCook.Ecom.Core.PageComponents.Data.CommonView.Booking.BookByEmail.EmailBookingTraveller();c.firstName=$get(e+"_firstName").value;c.middleName=$get(e+"_middleName").value;c.lastName=$get(e+"_lastName").value;c.gender=$get(e+"_gender").value;c.year=$get(e+"_years").value;c.month=$get(e+"_months").value;c.day=$get(e+"_days").value;a.travellers[d-1]=c}d++}while(b!=null);return a},GetCurrentPersonalInfoToProceed:function(){var a=this.GetCurrentPersonalInfo();a.ProceedWithEnteredAges=true;return a},GetAttributeValue:function(b,c){var d=$get(b);if(d!=null){var a=d.getAttribute(c);if((a!=null)&&(a.length>0)){return a}}return null},OnShow:function(){var e=1;var h=null;do{var f="TravellerDetails_"+e;h=$get(f);if(h!=null){var a=$find(f);if(a!=null){a.dispose()}var c=$create(Ecom.DateControl,{hasBlankDefault:true},null,null,h);if(c!=null){var d=this.GetAttributeValue(f+"_days","defaultvalue");var b=this.GetAttributeValue(f+"_months","defaultvalue");var g=this.GetAttributeValue(f+"_years","defaultvalue");c.SetDate(g,b,d)}e++}}while(h!=null);this.AttachAutoCompleteHandlers();this.AttachWaterMarks()},DoLoginOnSite:function(){var a="flightOnlyPersonaliaLoginOnSitePopup";var d=$get(a+"Password");var c=$get(a+"Login");if(d!=null&&c!=null){var b=true;if(d.value.length==0){this.UpdateMandatoryFieldIndicator(d,"invalid");b=false}else{this.UpdateMandatoryFieldIndicator(d,"invalid",false)}if(c.value.length==0){this.UpdateMandatoryFieldIndicator(c,"invalid");b=false}else{this.UpdateMandatoryFieldIndicator(c,"invalid",false)}if(b){this.CloseLoginOnSitePopup()}}},CancelLoginOnSite:function(){document.location.href="/"},CreateAutoCompleteLastNames:function(a){if(a!=null&&a.target!=null){jQuery("#"+a.target.id).autocomplete({source:function(f,n){var c=f.term;var d="<strong>"+c+"</strong>";var k=new Array();var g=1;var l=null;do{var h="TravellerDetails_"+g+"_lastName";l=$get(h);if(l!=null&&l.value!=null&&l.value!=""){if(a==null||a.target==null||h!=a.target.id){var m=false;for(var e=0;e<k.length;e++){if(k[e].value==l.value){m=true}}if(m==false){var b=new Object();b.value=l.value;b.label=l.value.replace(c,d);k[k.length]=b}}}g++}while(l!=null);n(k)},minLength:0,autoFocus:true,open:function(b,c){jQuery(".ui-autocomplete li.ui-menu-item:even").addClass("ui-menu-item-alternate")}}).data("autocomplete")._renderItem=function(b,c){return jQuery("<li></li>").data("item.autocomplete",c).append("<a>"+c.label+"</a>").appendTo(b)}}},AttachAutoCompleteHandlers:function(){var c=1;var a=null;do{var b="TravellerDetails_"+c+"_lastName";a=$get(b);if(a!=null){jQuery("#"+b).focus(this.CreateAutoCompleteLastNamesDelegate)}c++}while(a!=null)},AttachWaterMarks:function(){jQuery(".personalia .watermarked-input").each(function(){jQuery(this).watermark(jQuery(this).attr("name"))})},RedirectCriticalRoomOccupationErrorPopup:function(){document.location.href=this.CriticalRoomOccupationErrorRedirectUrl},ContinueRoomOccupationErrorPopup:function(){this.roomOccupationErrorPopup.hide();var a="foSubmit";var c="click";var b=this.FindWaitSpecificationInstance($get(a),c);this.Wait(b,true);ThomasCook.Ecom.Web.BookingAvailability.ShowOptionsAndExtras(a,c,this.GetCurrentPersonalInfoToProceed(),this.OnPersonalInfoSubmittedDelegate,this.MethodTimeoutDelegate,b)},CreatePopups:function(){var c={dialogClass:"option",width:400};this.criticalRoomOccupationErrorPopup=new Ecom.UI.ModalBox("#criticalRoomOccupationErrorPopup",c);this.roomOccupationErrorPopup=new Ecom.UI.ModalBox("#roomOccupationErrorPopup",c);this.personaliaLoginOnSitePopup=new Ecom.UI.ModalBox("#personaliaLoginOnSitePopup",c);var a=jQuery.extend(c,{dialogClass:"error",width:320});this.personaliaErrorPopup=new Ecom.UI.ModalBox("#personaliaErrorPopup",a);var b=this;jQuery("#criticalRoomOccupationErrorPopupRedirectBtn").click(function(){b.RedirectCriticalRoomOccupationErrorPopup()});jQuery("#roomOccupationErrorPopupContinueBtn").click(function(){b.ContinueRoomOccupationErrorPopup()});jQuery("#personaliaLoginOnSitePopupOkBtn").click(function(){b.DoLoginOnSite()});jQuery("#personaliaLoginOnSitePopupCancelBtn").click(function(){b.CancelLoginOnSite()})},DisposePopups:function(){(this.criticalRoomOccupationErrorPopup!=null&&this.criticalRoomOccupationErrorPopup.dispose());(this.personaliaErrorPopup!=null&&this.personaliaErrorPopup.dispose());(this.personaliaLoginOnSitePopup!=null&&this.personaliaLoginOnSitePopup.dispose());(this.roomOccupationErrorPopup!=null&&this.roomOccupationErrorPopup.dispose())},ShowErrorPopup:function(a){(this.personaliaErrorPopup!=null&&this.personaliaErrorPopup.show({content:a}))},ShowLoginOnSitePopup:function(a){(this.personaliaLoginOnSitePopup!=null&&this.personaliaLoginOnSitePopup.show({content:a}))},CloseLoginOnSitePopup:function(){(this.personaliaLoginOnSitePopup!=null&&this.personaliaLoginOnSitePopup.hide())},ShowCriticalRoomOccupationErrorPopup:function(a){this.CriticalRoomOccupationErrorRedirectUrl=a;(this.criticalRoomOccupationErrorPopup!=null&&this.criticalRoomOccupationErrorPopup.show())},ShowRoomOccupationErrorPopup:function(){(this.roomOccupationErrorPopup!=null&&this.roomOccupationErrorPopup.show())}};Ecom.BookingPersonalia.registerClass("Ecom.BookingPersonalia",Ecom.Waiter);Ecom.BookingPersonaliaOverview=function(a){Ecom.BookingPersonaliaOverview.initializeBase(this,[a]);this.OnComponentClickDelegate=Function.createDelegate(this,this.OnComponentClick);this.RegisterEventHandler("editPersonalia","click",true,this.OnComponentClickDelegate,null,null,null,null);$addHandler(a,"click",this.OnClickDelegate)};Ecom.BookingPersonaliaOverview.prototype={initialize:function(){},OnComponentClick:function(){this.Mediator.EditPersonaliaInfo()}};Ecom.BookingPersonaliaOverview.registerClass("Ecom.BookingPersonaliaOverview",Ecom.Waiter);Ecom.OptionsAndExtraDialog=function(a){Ecom.OptionsAndExtraDialog.initializeBase(this,[a]);this.NamingContainer="";this.GetCurrentOptionsAndExtrasAddDelegate=Function.createDelegate(this,this.GetCurrentOptionsAndExtrasAdd);this.GetCurrentOptionsAndExtrasEditDelegate=Function.createDelegate(this,this.GetCurrentOptionsAndExtrasEdit);this.OnOptionsAndExtrasBookedDelegate=Function.createDelegate(this,this.OnOptionsAndExtrasBooked);this.OnOptionsAndExtrasBookedAfterConfirmationDialogDelegate=Function.createDelegate(this,this.OnOptionsAndExtrasBookedAfterConfirmationDialog);this.OnShowInputForSelectedOptionsAndExtrasDelegate=Function.createDelegate(this,this.OnShowInputForSelectedOptionsAndExtras);this.ShowInputForSelectedOptionsAndExtrasDelegate=Function.createDelegate(this,this.ShowInputForSelectedOptionsAndExtras);this.FetchDateDurationCombinationsForSelectedExtraDelegate=Function.createDelegate(this,this.FetchDateDurationCombinationsForSelectedExtra);this.HandleBasicInsuranceInfoDelegate=Function.createDelegate(this,this.HandleBasicInsuranceInfo);this.ClearUpdateStatusParametersDelegate=Function.createDelegate(this,this.ClearUpdateStatusParameters);this.OptionsAndExtrasEditDelegate=Function.createDelegate(this,this.OptionsAndExtrasEdit);this.BeforeShowDateDelegate=Function.createDelegate(this,this.BeforeShowDate);this.OnSelectDateDelegate=Function.createDelegate(this,this.OnSelectDate);this.OptionsAndExtrasRemoveDelegate=Function.createDelegate(this,this.OptionsAndExtrasRemove);this.ModifyOptionsAndExtrasDelegate=Function.createDelegate(this,this.CallModifyOptionsAndExtras);this.RestartBookingDelegate=Function.createDelegate(this,this.RestartBooking);this.OnSubmitOptionsAndExtrasDelegate=Function.createDelegate(this,this.OnSubmitOptionsAndExtras);this.OnOptionsAndExtrasSubmittedDelegate=Function.createDelegate(this,this.OnOptionsAndExtrasSubmitted);this.OnOptionCalculatedDelegate=Function.createDelegate(this,this.OnOptionCalculated);this.CloseConfirmationPopupAddDelegate=Function.createDelegate(this,this.CloseConfirmationAddPopup);this.CloseConfirmationPopupNoAddDelegate=Function.createDelegate(this,this.CloseConfirmationNoAddPopup);this.CloseRemovePopupDelegate=Function.createDelegate(this,this.CloseRemovePopup);this.ShowRemovePopupDelegate=Function.createDelegate(this,this.ShowRemovePopup);this.CloseErrorPopupDelegate=Function.createDelegate(this,this.CloseErrorPopup);this.ShowErrorPopupDelegate=Function.createDelegate(this,this.ShowErrorPopup);this.CloseInsurancePopupDelegate=Function.createDelegate(this,this.CloseInsurancePopup);this.ShowInsurancePopupDelegate=Function.createDelegate(this,this.ShowInsurancePopup);this.CloseIncludeInsurancePopupDelegate=Function.createDelegate(this,this.CloseIncludeInsurancePopup);this.CloseNoInsurancePopupDelegate=Function.createDelegate(this,this.CloseNoInsurancePopup);jQuery("#bookingCashTicketBasicInsuranceInfo").live("mouseover mouseout",this.HandleBasicInsuranceInfoDelegate);$addHandler(a,"click",this.OnClickDelegate);this.HookChildSelects(a)};Ecom.OptionsAndExtraDialog.prototype={initialize:function(){this.ValidDateTimeWithDurations=null;this.SelectedExtrasInfo=null;jQuery("[id^=bookingOptionsAndExtras]").live("click",{methodToCall:this.OnSubmitOptionsAndExtrasDelegate,delegateForResult:this.OnOptionsAndExtrasSubmittedDelegate,showWaitMethod:this.ShowWaitPanelDelegate,hideWaitMethod:this.HideWaitPanelDelegate,cancel:true},this.HandleLiveEventDelegate);jQuery("[id^=removeextra]").live("click",{stateRetriever:this.ShowRemovePopupDelegate},this.HandleLiveEventDelegate);jQuery("[id^=editextra]").live("click",{stateRetriever:this.OptionsAndExtrasEditDelegate},this.HandleLiveEventDelegate);jQuery("[id^=extraDropdown]").live("change",{stateRetriever:this.OnShowInputForSelectedOptionsAndExtrasDelegate,methodToCall:this.FetchDateDurationCombinationsForSelectedExtraDelegate,delegateForResult:this.ShowInputForSelectedOptionsAndExtrasDelegate,showWaitMethod:this.ShowWaitPanelDelegate,hideWaitMethod:this.HideWaitPanelDelegate,cancel:true},this.HandleLiveEventDelegate);jQuery("[id^=bookextra]").live("click",{inputDelegate:this.GetCurrentOptionsAndExtrasAddDelegate},this.ModifyOptionsAndExtrasDelegate);jQuery("[id^=editbookextra]").live("click",{inputDelegate:this.GetCurrentOptionsAndExtrasEditDelegate},this.ModifyOptionsAndExtrasDelegate)},HandleBasicInsuranceInfo:function(a){var b=jQuery("#basicInsuranceTooltip");if(a.type=="mouseover"){var d=jQuery(a.currentTarget);var c=d.offset();b.showAsPopup({mouseX:c.left,mouseY:c.top,xOffset:-(b.width()+15),yOffset:-50,alignMiddle:false})}else{b.hide()}},OnOptionCalculated:function(c,a){this.Wait(a,false);if(c.HasError){var b=c.ErrorMessage;if((b==null)||(b.length==0)){b="Unexpected error occured!"}this.ShowErrorPopup(b,false)}else{this.ShowInsurancePopup(c.Price,this.CancellationInsuranceTitle)}},OnSubmitOptionsAndExtras:function(b,g,h,d,k,e){var c=this.RetrieveSelectedExtraState();if(c.Extra!=null){this.Wait(e,false);this.ShowConfirmationPopup(c);return}this.CancellationInsuranceTitle=null;this.ClearStatusInformation();this.ClearSelectedExtraAndUICategory();this.ClearCurrentExtraAndUICategory();var j=null;var f=false;var l=null;var a=1;do{l=$get("CancellationInsuranceOptionsAndExtras_"+a);if(l!=null){if(l.checked){f=true;j=new ThomasCook.Ecom.Core.PageComponents.ContextObject.OptionsAndExtras.OptionsAndExtrasInput();j.OptionType=l.getAttribute("optionType");j.OptionCode=l.getAttribute("optionCode");j.UICategoryCode=l.getAttribute("uiCategoryCode");j.Operation="Add";this.CancellationInsuranceTitle=l.getAttribute("title")}}a++}while(l!=null);if(f){this.insuranceInput=j;ThomasCook.Ecom.Web.BookingAvailability.CalculateOptionPrice(j,this.OnOptionCalculatedDelegate,k,e)}else{this.Mediator.OptionsAndExtrasSubmit("","",null,this.OnOptionsAndExtrasSubmittedDelegate,this.MethodTimeoutDelegate,e)}},OnOptionsAndExtrasSubmitted:function(d,c,a){var e=d.PreOmnitureLogging;if(e!=null){this.DoOmnitureCall(e)}var b=d.divUpdates;this.DoPartialUpdateWithOmnitureLogging(d);this.Wait(c,false);if((d.ErrorMessage!=null)&&(d.ErrorMessage.length>0)){this.ShowErrorPopup(d.ErrorMessage)}else{this.Mediator.OnOptionsAndExtrasSubmitted()}},GetCurrentOptionsAndExtrasEdit:function(d,a,c){var b=this.GetCurrentOptionsAndExtrasOperation(d,a,c);if(b!=null){b.Operation="Update"}return b},ClearStatusInformation:function(){var a=$get("operationStatusInfo");if(a!=null){if(a.parentNode!=null){a.parentNode.removeChild(a)}}},SwitchFromAddToEditMode:function(c,d){hide("bookextra_"+c);show("editbookextra_"+c);var a=$get("extraEditContainer_"+d);var b=$get("extra_"+c);if(a!=null&&b!=null){a.appendChild(b)}show("extra_"+c);jQuery("#optionguid_"+d).children(".action-buttons-section").hide();this.optionAndExtraMode="edit"},SwitchFromEditToAddMode:function(c,a){show("bookextra_"+c);hide("editbookextra_"+c);var d=$get("extraAddContainer_"+a);var b=$get("extra_"+c);if(d!=null&&b!=null){d.appendChild(b)}show("extra_"+c);show("extraQuantityPanel_"+c);this.optionAndExtraMode="add"},OptionsAndExtrasEdit:function(d){this.ClearSelectedExtraAndUICategory();this.ClearStatusInformation();var e=d.target;if(e!=null){var b=e.getAttribute("sequence");this.UpdateSequence=b;var l=e.getAttribute("optionCode");var g=e.getAttribute("optionType");var h=e.getAttribute("uiCategoryCode");if(l!=null&&h!=null){this.SwitchFromAddToEditMode(l,b);this.CurrentExtra=l;this.CurrentOptionType=g;var k=$get("extraDropdown_"+h);if(k!=null){this.CurrentExtraText=jQuery(k).find("option[value="+l+"]").text();this.CurrentExtraTitle=$get("extraDropdown_"+h+"_title").innerHTML;this.CurrentUICategory=h;if(this.SelectedExtrasInfo!=null){var c=this.SelectedExtrasInfo[b];if(c!=null){this.SetPersonCheckboxes(this.CurrentExtra,c.PassengerIds);if($get("extraStartDateCalendar_"+this.CurrentExtra)!=null){var j=jQuery("#extraStartDateCalendar_"+this.CurrentExtra);if(j!=null){var f=Date.parseInvariant(c.StartDate,"yyyyMMdd");j.datepicker("setDate",f);var a=$get("extraDurationDropdown_"+this.CurrentExtra);if(a!=null){a.value=c.Duration}}}}}}}}return null},SetPersonCheckboxes:function(c,d){var f;var a=1;do{f=$get("extraperson_"+c+"_"+a);if(f!=null){var e=false;if(d!=null){for(var b=0;b<d.length;b++){if(d[b]==a){e=true}}}f.checked=e}a++}while(f!=null)},DisposePopups:function(){jQuery("#optionsAndExtrasConfirmationPopup").dialog("destroy").remove();jQuery("#optionsandextrasRemovePopup").dialog("destroy").remove();jQuery("#optionsandextrasErrorPopup").dialog("destroy").remove();jQuery("#optionsandextrasInsurancePopup").dialog("destroy").remove()},CreateTooltips:function(){jQuery("#insuranceInfo").bubble("#cancellationInsuranceInfo",false,false);jQuery("#OptionsAndExtras .item span[id^='InsuranceInfo_']").bubble("",true,false)},CreateConfirmationPopup:function(){this.ConfirmationPopupTitleStart=jQuery("#optionsAndExtrasConfirmationPopup").attr("title");jQuery("#optionsAndExtrasConfirmationPopup").dialog({closeOnEscape:false,autoOpen:false,modal:true,overlay:{opacity:0.7,background:"#fff"},draggable:false,dialogClass:"option",resizable:false,width:320,height:"auto",position:["center","center"],bgiframe:true});jQuery("#optionsAndExtrasConfirmationPopup").css("margin-bottom","20px");jQuery("#optionsAndExtrasConfirmationNoBtn").click(this.CloseConfirmationPopupNoAddDelegate);jQuery("#optionsAndExtrasConfirmationYesBtn").click(this.CloseConfirmationPopupAddDelegate)},CreateRemovePopup:function(){jQuery("#optionsandextrasRemovePopup").dialog({closeOnEscape:false,autoOpen:false,modal:true,overlay:{opacity:0.7,background:"#fff"},draggable:false,dialogClass:"error",resizable:false,width:320,height:"auto",position:["center","center"],bgiframe:true});var a=jQuery("#optionsandextrasRemovePopup").attr("title");jQuery("ui-dialog-title-optionsandextrasRemovePopup").append(a);jQuery("#optionsandextrasRemoveNoBtn").click(this.CloseRemovePopupDelegate);jQuery("#optionsandextrasRemoveYesBtn").click(this.OptionsAndExtrasRemoveDelegate)},CreateErrorPopup:function(){var a="optionsandextrasErrorPopup";var b=jQuery("#"+a).attr("title");jQuery("#"+a).dialog({closeOnEscape:false,autoOpen:false,modal:true,overlay:{opacity:0.7,background:"#fff"},draggable:false,dialogClass:"error",resizable:false,width:320,height:"auto",position:["center","center"],bgiframe:true});jQuery("ui-dialog-title-"+a).append(b);jQuery("#"+a+"OkBtn").click(this.CloseErrorPopupDelegate);jQuery("#"+a+"RestartBooking").click(this.RestartBookingDelegate)},RestartBooking:function(){location.reload(true)},CreateInsurancePopup:function(){var a="optionsandextrasInsurancePopup";var b=jQuery("#optionsandextrasInsurancePopup").attr("title");jQuery("#"+a).dialog({closeOnEscape:false,autoOpen:false,modal:true,overlay:{opacity:0.7,background:"#fff"},draggable:false,dialogClass:"option",resizable:false,width:350,height:"auto",position:["center","center"],bgiframe:true});jQuery("ui-dialog-title-"+a).append(b);jQuery("#"+a+"NoBtn").click(this.CloseNoInsurancePopupDelegate);jQuery("#"+a+"YesBtn").click(this.CloseIncludeInsurancePopupDelegate)},ShowConfirmationPopup:function(a){if(a.OptionAndExtraMode=="add"){jQuery("#jqConfirmationContentAdd").show();jQuery("#jqConfirmationContentEdit").hide();jQuery("[id^=optionsAndExtrasConfirmationContentAddLabel]").text(a.ExtraText)}else{jQuery("#jqConfirmationContentAdd").hide();jQuery("#jqConfirmationContentEdit").show();jQuery("[id^=optionsAndExtrasConfirmationContentEditLabel]").text(a.ExtraText)}jQuery("#ui-dialog-title-optionsAndExtrasConfirmationPopup").text(this.ConfirmationPopupTitleStart+" "+a.ExtraTitle);jQuery("#optionsAndExtrasConfirmationPopup").dialog("open")},CloseConfirmationPopup:function(){jQuery("#optionsAndExtrasConfirmationPopup").dialog("close")},CloseConfirmationAddPopup:function(){this.CloseConfirmationPopup();var b=jQuery('[id^="bookextra_"]:visible');var a=jQuery('[id^="editbookextra_"]:visible');if(b.length>0){this.ModifyOptionsAndExtras(b.first(),this.GetCurrentOptionsAndExtrasAddDelegate,true)}else{if(a.length>0){this.ModifyOptionsAndExtras(a.first(),this.GetCurrentOptionsAndExtrasEditDelegate,true)}}},CloseConfirmationNoAddPopup:function(){this.CloseConfirmationPopup();this.CallSubmitOptionsAndExtras()},CallSubmitOptionsAndExtras:function(){var a={wait:{showwaitmethod:this.ShowWaitPanelDelegate,hidewaitmethod:this.HideWaitPanelDelegate}};this.Wait(a,true);this.ClearSelectedExtraAndUICategory();this.ClearCurrentExtraAndUICategory();this.OnSubmitOptionsAndExtras("","",null,this.OnOptionsAndExtrasSubmittedDelegate,null,a)},ShowRemovePopup:function(a){jQuery("#optionsandextrasRemoveContentLabel").empty().append("'"+a.target.getAttribute("optionName")+"'");jQuery("#optionsandextrasRemovePopup").dialog("open");if(a!=null){this.UpdateSequence=a.target.getAttribute("sequence");this.UpdateUICategoryCode=a.target.getAttribute("uiCategoryCode");this.UpdateOptionCode=a.target.getAttribute("optionCode");this.UpdateOptionType=a.target.getAttribute("optionType")}},CloseRemovePopup:function(){jQuery("#optionsandextrasRemovePopup").dialog("close")},ShowErrorPopup:function(c,b){var a="optionsandextrasErrorPopup";jQuery("#"+a+"Content").empty();jQuery("#"+a+"Content").append(c);if(b!=null&&b){hide(a+"OkBtn");show(a+"RestartBooking");show(a+"RestartBookingErrorPart1");show(a+"RestartBookingErrorPart2")}else{show(a+"OkBtn");hide(a+"RestartBooking");hide(a+"RestartBookingErrorPart1");hide(a+"RestartBookingErrorPart2")}jQuery("#"+a).dialog("open")},CloseErrorPopup:function(){var a="optionsandextrasErrorPopup";jQuery("#"+a).dialog("close");this.ClearCurrentExtraAndUICategory()},ShowInsurancePopup:function(b,a){jQuery("#optionsandextrasInsuranceContentLabel").empty();jQuery("#optionsandextrasInsuranceContentLabel").append(b);jQuery("#optionsandextrasInsuranceLabel").empty();if(a!=null&&a.length>0){a="("+a+")";jQuery("#optionsandextrasInsuranceLabel").append(a);show("optionsandextrasInsuranceLabel")}else{hide("optionsandextrasInsuranceLabel")}jQuery("#optionsandextrasInsurancePopup").dialog("open")},CloseInsurancePopup:function(){jQuery("#optionsandextrasInsurancePopup").dialog("close");var a={wait:{showwaitmethod:this.ShowWaitPanelDelegate,hidewaitmethod:this.HideWaitPanelDelegate}};this.Wait(a,true);if(this.insuranceInput!=null){this.insuranceInput.CalculationOnly=false}this.Mediator.OptionsAndExtrasSubmit("","",this.insuranceInput,this.OnOptionsAndExtrasSubmittedDelegate,this.MethodTimeoutDelegate,a);this.insuranceInput=null},CloseIncludeInsurancePopup:function(){this.CloseInsurancePopup()},CloseNoInsurancePopup:function(){this.insuranceInput=null;this.CloseInsurancePopup()},GetCurrentOptionsAndExtrasAdd:function(d,a,c){this.ClearUpdateStatusParameters();var b=this.GetCurrentOptionsAndExtrasOperation(d,a,c);if(b!=null){b.Operation="Add"}return b},GetCurrentOptionsAndExtrasOperation:function(b,h,f){this.ClearStatusInformation();if((b!=null)&&(h!=null)&&(f!=null)){var g=new ThomasCook.Ecom.Core.PageComponents.ContextObject.OptionsAndExtras.OptionsAndExtrasInput();g.OptionType=f;g.OptionCode=b;g.UICategoryCode=h;var e=new Array();var c="extraperson_"+b+"_";var m=1;var k=null;do{k=$get(c+m);if(k!=null){if(k.checked){e.push(m)}}m++}while(k!=null);g.PassengerIds=e;g.Sequence=this.UpdateSequence;if($get("extraStartDateCalendar_"+this.CurrentExtra)!=null){var l=jQuery("#extraStartDateCalendar_"+this.CurrentExtra);if(l!=null){var d=l.datepicker("getDate");if(d!=null){g.StartDateText=d.format("yyyyMMdd");var a=$get("extraDurationDropdown_"+this.CurrentExtra);if(a!=null){g.Duration=a.value}}}}var j=$get("extraQuantity_"+this.CurrentExtra);if(j!=null){g.Quantity=j.value}this.CurrentError="";if($get(c+"1")!=null&&e!=null&&e.length==0){this.CurrentError="passengerrequired";return null}return g}return null},StoreExtraPanels:function(){var a=jQuery(".extraEditContainer");if(a!=null&&a.length>0){var e=$get("extraStoreContainer");if(e!=null){for(var d=0;d<a.length;d++){var f=a[d];if(f!=null&&f.childNodes.length>0){for(var b=0;b<f.childNodes.length;b++){var c=f.childNodes[b];if(c!=null){e.appendChild(c)}}}}}}},RetrieveSelectedExtraState:function(){var a=new Object();if(this.CurrentExtra!=null&&this.CurrentExtra!=""&&this.CurrentUICategory!=null){a.Extra=this.CurrentExtra;a.UICategory=this.CurrentUICategory;a.ExtraText=this.CurrentExtraText;a.OptionAndExtraMode=this.optionAndExtraMode;a.ExtraTitle=this.CurrentExtraTitle;a.OptionType=this.CurrentOptionType}return a},CallModifyOptionsAndExtras:function(b){var a=jQuery(b.target);return this.ModifyOptionsAndExtras(a,b.data.inputDelegate,false)},ModifyOptionsAndExtras:function(c,b,k){var a=c.attr("optionCode");var j=c.attr("uiCategoryCode");var g=c.attr("optionType");var h=b(a,j,g);var d=c.attr("id");if(this.CurrentError=="passengerrequired"){var e="";if($get("passengerRequired_"+a)!=null){show("passengerRequired_"+a);this.MarkPersonCheckboxes(d,true)}return null}else{if($get("passengerRequired_"+a)!=null){hide("passengerRequired_"+a);this.MarkPersonCheckboxes(d,false)}}var f={wait:{showwaitmethod:this.ShowWaitPanelDelegate,hidewaitmethod:this.HideWaitPanelDelegate}};this.Wait(f,true);this.StoreExtraPanels();if(k){return ThomasCook.Ecom.Web.BookingAvailability.ModifyOptionsAndExtras("","",h,this.OnOptionsAndExtrasBookedAfterConfirmationDialogDelegate,this.MethodTimeoutDelegate,f)}else{return ThomasCook.Ecom.Web.BookingAvailability.ModifyOptionsAndExtras("","",h,this.OnOptionsAndExtrasBookedDelegate,this.MethodTimeoutDelegate,f)}},MarkPersonCheckboxes:function(g,b){if(g!=null){var f=$get(g).getAttribute("optionCode");if(f!=null){var c="extraperson_"+f+"_";var d="extrapersonLabel_"+f+"_";var e=1;var a=null;do{a=$get(c+e);personLabel=jQuery("#"+d+e);if(a!=null&&personLabel!=null){if(b){personLabel.addClass("passengersError")}else{personLabel.removeClass("passengersError")}}e++}while(a!=null)}}},AllowMoreOptionsToBeBookedInSameUICategory:function(c,d){var b="extraDropdown_"+d;var a=$get(b);if(a!=null){if(c){show(b)}else{hide(b)}}},OnOptionsAndExtrasBookedAfterConfirmationDialog:function(c,b,a){this.OnOptionsAndExtrasBooked(c,b,a);this.CallSubmitOptionsAndExtras()},OnOptionsAndExtrasBooked:function(d,c,a){this.AllowMoreOptionsToBeBookedInSameUICategory(d.CanAddMoreFromSameUICategory,d.ActiveUICategoryCode);this.ClearSelectedExtraAndUICategory();this.ClearCurrentExtraAndUICategory();this.ClearUpdateStatusParameters();this.SelectedExtrasInfo=d.SelectedExtrasInfo;var b=d.divUpdates;this.DoPartialUpdateWithOmnitureLogging(d);this.Wait(c,false);if(d.IsRemoved){setTimeout(function(){jQuery("#operationStatusInfo").hide()},10000)}if(d.HasCriticalError||d.HasNonCriticalError){var e=d.ErrorMessage;if((e==null)||(e.length==0)){e="Unexpected error occured!"}this.ShowErrorPopup(e,d.HasCriticalError)}},OptionsAndExtrasRemove:function(){this.CloseRemovePopup();this.ClearStatusInformation();var a=new ThomasCook.Ecom.Core.PageComponents.ContextObject.OptionsAndExtras.OptionsAndExtrasInput();a.Operation="Remove";a.OptionType=this.UpdateOptionType;a.OptionCode=this.UpdateOptionCode;a.UICategoryCode=this.UpdateUICategoryCode;a.Sequence=this.UpdateSequence;var b={wait:{showwaitmethod:this.ShowWaitPanelDelegate,hidewaitmethod:this.HideWaitPanelDelegate}};this.Wait(b,true);this.StoreExtraPanels();ThomasCook.Ecom.Web.BookingAvailability.ModifyOptionsAndExtras("","",a,this.OnOptionsAndExtrasBookedDelegate,this.MethodTimeoutDelegate,b);this.ClearUpdateStatusParameters()},BeforeShowDate:function(a){var d=this.ValidDateTimeWithDurations[this.CurrentExtra];var b=a.format("yyyyMMdd");for(var c in d){if(c==b){return[true,""]}}return[false,""]},OnShowInputForSelectedOptionsAndExtras:function(d){if(d!=null){var c=d.target.value;var b=d.target.getAttribute("uiCategoryCode");var a=d.target;this.CurrentExtraText=d.target.options[d.target.selectedIndex].text;this.CurrentExtraTitle=$get("extraDropdown_"+b+"_title").innerHTML;this.ClearSelectedExtraAndUICategory();this.CurrentExtra=c;this.CurrentOptionType=a.getAttribute("optionType");this.SwitchFromEditToAddMode(c,b);this.SetSelectedExtraInUICategory(c,a);this.CurrentUICategory=b;this.SetPersonCheckboxes(this.CurrentExtra,null)}},FetchDateDurationCombinationsForSelectedExtra:function(j,b,h,c,k,e){var g=this.ValidDateTimeWithDurations[this.CurrentExtra];var f=0;for(var a in g){if(g.hasOwnProperty(a)){++f}}if(this.CurrentOptionType=="COMMON"&&f==1){var d=new ThomasCook.Ecom.Core.PageComponents.ContextObject.OptionsAndExtras.OptionsAndExtrasInput();d.OptionCode=this.CurrentExtra;d.UICategoryCode=this.CurrentUICategory;d.OptionType=this.CurrentOptionType;ThomasCook.Ecom.Web.BookingAvailability.GetExtraDateDurationCombinationsForExtra("dummyId","dummyEventType",d,c,k,e)}else{c(null,e)}},ShowInputForSelectedOptionsAndExtras:function(b,d){if(b!=null&&b.ValidDateTimeWithDurations!=null){this.ValidDateTimeWithDurations[this.CurrentExtra]=b.ValidDateTimeWithDurations}var f=this.ValidDateTimeWithDurations[this.CurrentExtra];if(f!=null){var a;var e;for(var c in f){if(a==null){a=Date.parseInvariant(c,"yyyyMMdd");this.UpdateSelectedDateLabel(a);this.ShowDurationsForSelectedStartDate(f[c],this.CurrentExtra)}e=Date.parseInvariant(c,"yyyyMMdd")}jQuery.datepicker.setDefaults(jQuery.datepicker.regional.nl);var g=jQuery("#extraStartDateCalendar_"+this.CurrentExtra);g.datepicker({onSelect:this.OnSelectDateDelegate,beforeShowDay:this.BeforeShowDateDelegate,dateFormat:"yyyyMMdd",minDate:a,maxDate:e,defaultDate:a,hideIfNoPrevNext:true,changeFirstDay:false,showOtherMonths:false,duration:"fast",showAnim:"fadeIn",showOn:"button",buttonImage:"/App/Upload/Css/NVB/Images/calendar.gif",buttonImageOnly:true}).datepicker("setDate",a,e)}this.Wait(d,false)},UpdateSelectedDateLabel:function(b){var a=$get("extraStartDateLabel_"+this.CurrentExtra);if(a!=null){a.innerHTML=b.format("dd/MM/yyyy")}},OnSelectDate:function(e,c){var d=this.ValidDateTimeWithDurations[this.CurrentExtra];if(c!=null&&c.input!=null){var a=c.input.datepicker("getDate");if(this.ValidDateTimeWithDurations!=null&&this.ValidDateTimeWithDurations[this.CurrentExtra]!=null){var b=a.format("yyyyMMdd");this.UpdateSelectedDateLabel(a);this.ShowDurationsForSelectedStartDate(d[b],this.CurrentExtra)}}},ShowDurationsForSelectedStartDate:function(a,f){if(a!=null&&f!=null){var e=$get("extraDurationDropdown_"+f);if(e!=null){for(var d=e.length-1;d>=0;d--){e.remove(d)}for(var b=0;b<a.length;b++){var g=document.createElement("option");g.text=a[b];g.value=a[b];try{e.add(g,null)}catch(c){e.add(g)}}}}},ClearCurrentExtraAndUICategory:function(){this.CurrentExtra=null;this.CurrentOptionType=null;this.CurrentUICategory=null;this.CurrentExtraText=null;this.UpdateSequence=null},ClearSelectedExtraAndUICategory:function(){if(this.CurrentExtra!=null){hide("extra_"+this.CurrentExtra);jQuery("#optionguid_"+this.UpdateSequence).children(".action-buttons-section").show();hide("extraQuantityPanel_"+this.CurrentExtra)}if(this.CurrentUICategory!=null){var a=$get("extraDropdown_"+this.CurrentUICategory);if(a!=null){a.value=""}}},SetSelectedExtraInUICategory:function(a,b){if(b!=null){b.value=a}},ClearUpdateStatusParameters:function(){this.UpdateSequence=null;this.UpdateUICategoryCode=null;this.UpdateOptionCode=null;this.UpdateOptionType=null}};Ecom.OptionsAndExtraDialog.registerClass("Ecom.OptionsAndExtraDialog",Ecom.Waiter);Ecom.OptionsAndExtrasOverview=function(a){Ecom.OptionsAndExtrasOverview.initializeBase(this,[a]);this.ShouldShowOptionsAndExtras=false;this.GoBackToOptionsAndExtrasStepDelegate=Function.createDelegate(this,this.GoBackToOptionsAndExtrasStep);this.RegisterEventHandler("editOptionsAndExtras","click",true,this.GoBackToOptionsAndExtrasStepDelegate,null,null,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);$addHandler(a,"click",this.OnClickDelegate)};Ecom.OptionsAndExtrasOverview.prototype={initialize:function(){},GoBackToOptionsAndExtrasStep:function(){this.Mediator.EditOptionsAndExtrasInfo()},UpdateControlsToCurrentState:function(){if(this.ShouldShowOptionsAndExtras){jQuery("#OptionsAndExtrasOverview").show()}else{jQuery("#OptionsAndExtrasOverview").hide()}}};Ecom.OptionsAndExtrasOverview.registerClass("Ecom.OptionsAndExtrasOverview",Ecom.Waiter);Ecom.BookingAddress=function(a){Ecom.BookingAddress.initializeBase(this,[a]);$addHandler(a,"click",this.OnClickDelegate);this.OnSubmitPersonalInfoDelegate=Function.createDelegate(this,this.OnSubmitPersonalInfo);this.GetCurrentPersonalInfoDelegate=Function.createDelegate(this,this.GetCurrentPersonalInfo);this.OnPersonalInfoSubmittedDelegate=Function.createDelegate(this,this.OnPersonalInfoSubmitted);this.RegisterEventHandler("toPaymentButton","click",true,this.OnSubmitPersonalInfoDelegate,this.OnPersonalInfoSubmittedDelegate,this.GetCurrentPersonalInfoDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);this.mobileIsMandatory=false};Ecom.BookingAddress.prototype={initialize:function(){},OnPersonalInfoSubmitted:function(d,c,a){var e=$find("BookingPayment");if(e!=null){e.OnPrepareContentUpdate();e.DisposePopups()}var b=d.divUpdates;this.DoPartialUpdateWithOmnitureLogging(d);this.Wait(c,false);if(e!=null){e.SetApplicationUrls(d);e.OnContentUpdated()}this.Mediator.OnAddressInfoSubmitted()},OnSubmitPersonalInfo:function(n,d,x,r,f,g){var v=true;var k=true;var t="";var a=null;var o=null;var m=null;var b=null;var l=null;var u=null;var j=null;var s=null;var w=null;var q=1;do{var e="TravellerDetails_"+q;a=$get(e+"_firstName");o=$get(e+"_lastName");this.UpdateMandatoryFieldIndicator(a,"invalid");this.UpdateMandatoryFieldIndicator(o,"invalid");if(q==1){m=$get(e+"_street");this.UpdateMandatoryFieldIndicator(m,"invalid");b=$get(e+"_houseNumber");this.UpdateMandatoryFieldIndicator(b,"invalid");l=$get(e+"_zipCode");this.UpdateMandatoryFieldIndicator(l,"invalid");city=$get(e+"_city");this.UpdateMandatoryFieldIndicator(city,"invalid");j=$get(e+"_phoneNumber");this.UpdateMandatoryFieldIndicator(j,"invalid");if(this.mobileIsMandatory){s=$get(e+"_mobilePhoneNumber");this.UpdateMandatoryFieldIndicator(s,"invalid")}w=$get(e+"_email1");this.UpdateMandatoryFieldIndicator(w,"invalid")}if(a!=null&&k==true){if(a.value==""||o.value==""){v=false;k=false}if(q==1){if(m.value==""||b.value==""||l.value==""||j.value==""||city.value==""){v=false}if(this.mobileIsMandatory&&s.value==""){v=false}var p="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?";if(w.value==""||w.value.toLowerCase().match(p)!=w.value.toLowerCase()){this.UpdateValidFieldIndicator(w,"invalid",false);v=false}else{this.UpdateValidFieldIndicator(w,"invalid",true)}}}q++}while(a!=null);var c=$get("emergencyContact");if(c!=null){this.UpdateMandatoryFieldIndicator(c,"invalid");if(c.value==""){v=false}}var h=$get("emergencyPhoneNumber");if(h!=null){this.UpdateMandatoryFieldIndicator(h,"invalid");if(h.value==""){v=false}}if(v==true){hide("addressMandatoryFieldExplanation");this.Mediator.AddressInfoSubmit(n,d,x,r,f,g)}else{this.HideWaitPanel();show("addressMandatoryFieldExplanation");GetOmnitureEventSuite().Booking_AddressInfoSubmit_InvalidData()}},GetCurrentPersonalInfo:function(){var a=new ThomasCook.Ecom.Core.PageComponents.Data.CommonView.Booking.BookByEmail.EmailBookingUI();a.emergencyContact=jQuery("#emergencyContact").val();a.emergencyPhoneNr=jQuery("#emergencyPhoneNumber").val();a.travellers=new Array();var e=1;do{var f="TravellerDetails_"+e;var c=$get(f+"_firstName");if(c!=null){if(e==1){var b=new ThomasCook.Ecom.Core.PageComponents.Data.CommonView.Booking.BookByEmail.EmailBookingMainContactInfo();a.mainContactInfo=b;a.mainContactInfo.street=$get(f+"_street").value;a.mainContactInfo.houseNr=$get(f+"_houseNumber").value;a.mainContactInfo.zipCode=$get(f+"_zipCode").value;a.mainContactInfo.city=$get(f+"_city").value;a.mainContactInfo.country=$get(f+"_country").value;a.mainContactInfo.phoneNr=$get(f+"_phoneNumber").value;a.mainContactInfo.mobilePhoneNr=$get(f+"_mobilePhoneNumber").value;a.mainContactInfo.eMail=$get(f+"_email1").value}var d=new ThomasCook.Ecom.Core.PageComponents.Data.CommonView.Booking.BookByEmail.EmailBookingTraveller();d.firstName=$get(f+"_firstName").value;d.middleName=$get(f+"_middleName").value;d.lastName=$get(f+"_lastName").value;d.gender=$get(f+"_gender").value;d.year=$get(f+"_years").value;d.month=$get(f+"_months").value;d.day=$get(f+"_days").value;a.travellers[e-1]=d}e++}while(c!=null);return a},OnShow:function(){var b=1;var d=null;do{var c="TravellerDetails_"+b;d=$get(c);if(d!=null){var a=$find(c);if(a!=null){a.dispose()}$create(Ecom.DateControl,{hasBlankDefault:true},null,null,d);b++}}while(d!=null)}};Ecom.BookingAddress.registerClass("Ecom.BookingAddress",Ecom.Waiter);Ecom.BookingAddressOverview=function(a){Ecom.BookingAddressOverview.initializeBase(this,[a]);this.OnComponentClickDelegate=Function.createDelegate(this,this.OnComponentClick);this.RegisterEventHandler("editAddress","click",true,this.OnComponentClickDelegate,null,null,null,null);$addHandler(a,"click",this.OnClickDelegate)};Ecom.BookingAddressOverview.prototype={initialize:function(){},OnComponentClick:function(){this.Mediator.EditAddressInfo()}};Ecom.BookingAddressOverview.registerClass("Ecom.BookingAddressOverview",Ecom.Waiter);function pollForPaymentStatus(){var a=$find("BookingPayment");if(a!=null){a.PollForPaymentStatus()}}function ScrollPaymentMethodsIntoView(){var a=$get("defaultPaymentPane");if(a!=null){a.scrollIntoView(true)}}function ScrollAgentPaymentMethodsIntoView(){var a=$get("agentRequiredPaymentPane");if(a!=null){a.scrollIntoView(true)}}Ecom.BookingPayment=function(a){Ecom.BookingPayment.initializeBase(this,[a]);this.PaymentWindowUrl=null;this.ContactUserUrl=null;this.UserCancelledUrl=null;this.ConfirmationPageUrl=null;this.PaymentsActive=null;this.IsOgonePaymentPollingDelegate=Function.createDelegate(this,this.IsOgonePaymentPolling);this.GetTravelAgentFilterDelegate=Function.createDelegate(this,this.GetTravelAgentFilter);this.OnTravelAgentFilterAppliedDelegate=Function.createDelegate(this,this.OnTravelAgentFilterApplied);this.ShowCancellationPageDelegate=Function.createDelegate(this,this.ShowCancellationPage);this.ShowPaymentContactUserPageDelegate=Function.createDelegate(this,this.ShowPaymentContactUserPage);this.IsOgonePaymentPollingErrDelegate=Function.createDelegate(this,this.IsOgonePaymentPollingErr);this.ShowTravellingTermsDelegate=Function.createDelegate(this,this.ShowTravellingTerms);this.OnInitiatePaymentRetrySubmittedDelegate=Function.createDelegate(this,this.OnInitiatePaymentRetrySubmitted);this.SelectorsChangedDelegate=Function.createDelegate(this,this.SelectorsChanged);this.OnDsTravelAgentFilterAppliedDelegate=Function.createDelegate(this,this.OnDsTravelAgentFilterApplied);this.AgreedWithDefaultPaymentTermsDelegate=Function.createDelegate(this,this.AgreedWithDefaultPaymentTerms);this.AgreedWithAgentRequiredPaymentTermsDelegate=Function.createDelegate(this,this.AgreedWithAgentRequiredPaymentTerms);this.RegisterEventHandler("defaultPaymentAgreed","click",false,this.AgreedWithDefaultPaymentTermsDelegate,null,null,null,null);this.RegisterEventHandler("agentRequiredPaymentAgreed","click",false,this.AgreedWithAgentRequiredPaymentTermsDelegate,null,null,null,null);this.RegisterEventHandler("travelAgentProvincesSelect","change",false,ThomasCook.Ecom.Web.BookingAvailability.ShowTravelAgentCities,this.OnTravelAgentFilterAppliedDelegate,this.GetTravelAgentFilterDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);this.RegisterEventHandler("travelAgentCitiesSelect","change",false,ThomasCook.Ecom.Web.BookingAvailability.ShowTravelAgents,this.OnTravelAgentFilterAppliedDelegate,this.GetTravelAgentFilterDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);this.RegisterEventHandler("travellingterms","click",false,this.ShowTravellingTermsDelegate,null,null,null,null);this.RegisterEventHandler("dsTravelAgentCitySelect","change",false,ThomasCook.Ecom.Web.BookingAvailability.ShowDirectSalesTravelAgents,this.OnDsTravelAgentFilterAppliedDelegate,this.GetTravelAgentFilterDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);this.RegisterEventHandler("dsTravelAgentZipCodeSelect","change",false,ThomasCook.Ecom.Web.BookingAvailability.ShowDirectSalesTravelAgents,this.OnDsTravelAgentFilterAppliedDelegate,this.GetTravelAgentFilterDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);this.RegisterEventHandler("UseAdvance","click",false,this.SelectorsChangedDelegate,null,null,null,null);this.RegisterEventHandler("UseNoAdvance","click",false,this.SelectorsChangedDelegate,null,null,null,null);this.RegisterEventHandler("UseVoucher","click",false,this.SelectorsChangedDelegate,null,null,null,null);$addHandler(a,"click",this.OnClickDelegate)};Ecom.BookingPayment.prototype={initialize:function(){this.currentPaymentMethod=null;this.pollInterval=1000},DisableEditButtons:function(){hide("editFlightOnlyCollapsedOverview");hide("editOptionsAndExtras");hide("editTravelChoices");hide("editPersonalia");hide("editAddress")},AgreedWithAgentRequiredPaymentTerms:function(){jQuery("#defaultPaymentPane").hide();jQuery("#agentRequiredPaymentPane").addClass("payment-selected-agent").find(".payment-agreement-option").toggle();this.PaymentsActive=true;this.SelectorsChanged();if(this.pollForPaymentStatustimeout==null){this.pollForPaymentStatustimeout=setTimeout("pollForPaymentStatus()",this.pollInterval)}this.DisableEditButtons();jQuery("[id^='returnToDetailPagePane']").hide();setTimeout("ScrollAgentPaymentMethodsIntoView()",0)},AgreedWithDefaultPaymentTerms:function(){jQuery("#agentRequiredPaymentPane").hide();jQuery("#defaultPaymentPane").addClass("payment-selected-agent").find(".payment-agreement-option").toggle();jQuery("#defaultPaymentPane").find(".payment-options-description").toggle();jQuery("#defaultPaymentPane").find(".payment-agent-introduction").addClass("accepted");this.PaymentsActive=true;this.SelectorsChanged();if(this.pollForPaymentStatustimeout==null){this.pollForPaymentStatustimeout=setTimeout("pollForPaymentStatus()",this.pollInterval)}this.DisableEditButtons();jQuery("[id^='returnToDetailPagePane']").hide();setTimeout("ScrollPaymentMethodsIntoView()",0)},SetApplicationUrls:function(a){if(a!=null){this.PaymentWindowUrl=a.PaymentWindowUrl;this.ContactUserUrl=a.ContactUserUrl;this.UserCancelledUrl=a.UserCancelledUrl;this.ConfirmationPageUrl=a.ConfirmationPageUrl;this.PaymentsActive=false;this.SelectorsChanged()}},SelectorsChanged:function(){this.advanceSelected=false;this.voucherSelected=false;var b=$get("UseAdvance");if(b!=null&&b.checked){this.advanceSelected=true;jQuery(".cash-ticket .total-price #advanceAmountFinalStepToggle").show();jQuery(".cash-ticket .total-price #advanceRemainderFinalStepToggle").show()}else{jQuery(".cash-ticket .total-price #advanceAmountFinalStepToggle").hide();jQuery(".cash-ticket .total-price #advanceRemainderFinalStepToggle").hide()}var a=$get("UseVoucher");if(a!=null&&a.checked){this.voucherSelected=true}if(this.voucherSelected){jQuery("#voucherEnabledPaymentMethods").show();jQuery("#defaultPaymentMethods").hide();jQuery("#bridgetoolsprivacyurl").show();jQuery("#ogoneprivacyurl").hide()}else{jQuery("#voucherEnabledPaymentMethods").hide();jQuery("#defaultPaymentMethods").show();jQuery("#bridgetoolsprivacyurl").hide();jQuery("#ogoneprivacyurl").show()}this.UpdatePossiblePaymentMethods(null,null)},UpdatePossiblePaymentMethods:function(a,d){var e=jQuery("#defaultPaymentPane a[id^=doPayment_]");this.UpdatePaymentMethods(e,a,d,false);var c=jQuery("#defaultPaymentPane a[id^=doDsPayment_]");this.UpdatePaymentMethods(c,a,d,true);var b=jQuery("#agentRequiredPaymentPane a[id^=doPayment_]");b.each(function(g){var j=$find("BookingPayment");var k=jQuery(this).attr("agent");var f=jQuery(this).attr("code");if((a==f&&d==k)||(j.PaymentsActive&&a==null)){var h=j.PaymentWindowUrl+"&PaymentMethod="+f+"&UseAdvance=false&UseVoucher=false&TravelAgent="+k;jQuery(this).attr("href",h).removeAttr("disabled");jQuery(this).removeClass("disabled")}else{jQuery(this).removeAttr("href").attr("disabled","disabled");jQuery(this).addClass("disabled")}})},UpdatePaymentMethods:function(b,a,c,d){b.each(function(f){var l=$find("BookingPayment");var j=l.advanceSelected;var g=l.voucherSelected;var e=jQuery(this).attr("code");if(d){var m=jQuery(this).attr("agent")}if(a==e||(l.PaymentsActive&&a==null)){var h=l.PaymentWindowUrl+"&PaymentMethod="+e+"&UseAdvance="+j+"&UseVoucher="+g;if(d){h=h+"&TravelAgent="+m}jQuery(this).attr("href",h).removeAttr("disabled");jQuery(this).removeClass("disabled");jQuery(this).unbind("click")}else{jQuery(this).removeAttr("href");jQuery(this).addClass("disabled");var k=jQuery(this).attr("showdisabledpopup");if(k!=null&&k=="true"&&a==null){jQuery(this).click(function(){l.ShowPaymentMethodDisabledPopup()})}else{jQuery(this).attr("disabled","disabled")}}})},ShowTravellingTerms:function(){var a=$get("travellingterms");if(a!=null){var b=a.getAttribute("link");if(b!=null){window.open(b,"_blank","scrollbars=1, width="+screen.width/1.2+",height="+screen.height/1.2+"'")}}},OnTravelAgentFilterApplied:function(c,b,a){this.DoPartialUpdateWithOmnitureLogging(c);this.SelectorsChanged();this.Wait(b,false)},OnDsTravelAgentFilterApplied:function(d,c,b){this.DoPartialUpdateWithOmnitureLogging(d);var e=jQuery("#cityFilter").val();var f=jQuery("#zipCodeFilter").val();var a=jQuery("#dsTravelAgents").attr("paymentMethod");jQuery("#dsTravelAgentCitySelect").val(e);jQuery("#dsTravelAgentZipCodeSelect").val(f);jQuery("a[id^=doDsPayment_]").attr("code",a);this.UpdatePossiblePaymentMethods(null,null);this.Wait(c,false)},GetTravelAgentFilter:function(f){var b=new ThomasCook.Ecom.Core.PageComponents.Data.CommonView.Booking.BookingStepZero.TravelAgentsFilter();var j=$get("travelAgentProvincesSelect");if(j!=null){b.RegionFilter=j.value}var c=$get("travelAgentCitiesSelect");if(c!=null){b.CityFilter=c.value}var g=$get("dsTravelAgentCitySelect");if(g!=null){b.CityFilter=g.value}var h=$get("dsTravelAgentZipCodeSelect");if(h!=null){b.ZipCodeFilter=h.value}if(f!=null&&f.target!=null){var a=f.target.id;var d=jQuery("#"+a).attr("filter");b.Selected=d}var e=jQuery("#agentRequiredPaymentMethods a[id^=doPayment_]");if(e.length==1){b.PaymentCode=e.attr("code")}return b},PollForPaymentStatus:function(){ThomasCook.Ecom.Web.BookingAvailability.GetPaymentStatus(this.IsOgonePaymentPollingDelegate,this.IsOgonePaymentPollingErrDelegate,null)},IsOgonePaymentPolling:function(a){if(a.sessionLost){alert("Connection to server lost, please refresh the page.");return}this.UpdatePossiblePaymentMethods(a.paymentMethod,a.travelAgent);if(!a.isFinished){this.pollForPaymentStatustimeout=setTimeout("pollForPaymentStatus()",this.pollInterval)}else{if(a.doRetry){this.ShowRetryFlowPopup();var b=a.OmnitureLogging;if(b!=null){this.DoOmnitureCall(b)}}else{this.ShowConfirmationPage()}}},IsOgonePaymentPollingErr:function(){this.pollForPaymentStatustimeout=setTimeout("pollForPaymentStatus()",this.pollInterval)},RetryBooking:function(){ThomasCook.Ecom.Web.BookingAvailability.InitiatePaymentRetry(this.OnInitiatePaymentRetrySubmittedDelegate,null,null)},CancelBooking:function(){this.HideRetryFlowPopup();ThomasCook.Ecom.Web.BookingAvailability.SetPaymentStatusAfterFailure("Canceled",this.ShowCancellationPageDelegate,null,null)},ContactByCustomerService:function(){this.HideRetryFlowPopup();ThomasCook.Ecom.Web.BookingAvailability.SetPaymentStatusAfterFailure("Contact",this.ShowPaymentContactUserPageDelegate,null,null)},OnInitiatePaymentRetrySubmitted:function(a){if(a!=null&&a==true){this.HideRetryFlowPopup();this.pollForPaymentStatustimeout=setTimeout("pollForPaymentStatus()",this.pollInterval)}},ShowConfirmationPage:function(){document.location.href=this.ConfirmationPageUrl},ShowCancellationPage:function(){document.location.href=this.UserCancelledUrl},ShowPaymentContactUserPage:function(){document.location.href=this.ContactUserUrl},CreatePopups:function(){var b=this;var c={dialogClass:"option",width:350};this.paymentMethodDisabledPopup=new Ecom.UI.ModalBox("#bookingPaymentMethodDisabledPopup",c);jQuery("#bookingPaymentMethodDisabledPopupCloseButton").click(function(){b.HidePaymentMethodDisabledPopup()});var a=jQuery.extend(c,{width:420,dialogClass:"retry-flow-box"});this.retryFlowPopup=new Ecom.UI.ModalBox("#retryFlowContainer",a);jQuery("#startRetry").click(function(){b.RetryBooking()});jQuery("#cancelBooking").click(function(){b.CancelBooking()});jQuery("#contactByService").click(function(){b.ContactByCustomerService()});ScrollPaymentMethodsIntoView()},DisposePopups:function(){(this.retryFlowPopup!=null&&this.retryFlowPopup.dispose());(this.paymentMethodDisabledPopup!=null&&this.paymentMethodDisabledPopup.dispose())},ShowRetryFlowPopup:function(){this.ShowOverlay();(this.retryFlowPopup!=null&&this.retryFlowPopup.show())},HideRetryFlowPopup:function(){(this.retryFlowPopup!=null&&this.retryFlowPopup.hide());this.HideOverlayAndWaitPanel()},ShowPaymentMethodDisabledPopup:function(){(this.paymentMethodDisabledPopup!=null&&this.paymentMethodDisabledPopup.show())},HidePaymentMethodDisabledPopup:function(){(this.paymentMethodDisabledPopup!=null&&this.paymentMethodDisabledPopup.hide())}};Ecom.BookingPayment.registerClass("Ecom.BookingPayment",Ecom.PaymentWaiter);Ecom.BookingCashTicket=function(a){Ecom.BookingCashTicket.initializeBase(this,[a]);this.OnComponentClickDelegate=Function.createDelegate(this,this.OnComponentClick);this.RegisterEventHandler("","click",true,this.OnComponentClickDelegate,null,null,null,null);$addHandler(a,"click",this.OnClickDelegate);this.BringCashTicketIntoViewDelegate=Function.createDelegate(this,this.BringCashTicketIntoView);var b=window;$addHandler(b,"resize",this.BringCashTicketIntoViewDelegate);$addHandler(b,"scroll",this.BringCashTicketIntoViewDelegate);this.CollapseDelegate=Function.createDelegate(this,this.Collapse);this.ExpandDelegate=Function.createDelegate(this,this.Expand);this.RegisterEventHandler("collapse","click",false,this.CollapseDelegate,null,null,null,null);this.RegisterEventHandler("expand","click",false,this.ExpandDelegate,null,null,null,null);this.HandlePriceTicketAdvanceInfoDelegate=Function.createDelegate(this,this.HandlePriceTicketAdvanceInfo);jQuery("#bookingCashTicketAdvanceInfo").live("mouseover mouseout",this.HandlePriceTicketAdvanceInfoDelegate);jQuery("[id^=priceTicketAdvanceInfo_]").live("mouseover mouseout",this.HandlePriceTicketAdvanceInfoDelegate);this.TopMostCashTicketPosition=0;this.BottomMostCashTicketPosition=0};Ecom.BookingCashTicket.prototype={initialize:function(){},OnComponentClick:function(){},Collapse:function(d){var c=d.replace("collapse","expanded");jQuery("#"+c).hide();var a=d.replace("collapse","collapsed");jQuery("#"+a).show();var b=d.replace("collapse","expand");jQuery("#"+b).show();jQuery("#"+d).hide();this.Mediator.AdjustSizeToCashTicket(null)},Expand:function(d){var c=d.replace("expand","expanded");jQuery("#"+c).show();var a=d.replace("expand","collapsed");jQuery("#"+a).hide();var b=d.replace("expand","collapse");jQuery("#"+b).show();jQuery("#"+d).hide();this.Mediator.AdjustSizeToCashTicket(null)},BringCashTicketIntoView:function(h,a){var d=jQuery("#foCashTicket");if(d.length>0){var e=d.closest("div.cashTicketHost");var j=e.find("div.bookingStep").filter(":visible").eq(0);if(j==null||j.length==0){this.TopMostCashTicketPosition=0}else{this.TopMostCashTicketPosition=j.offset().top||0}if(a!=null){var g=jQuery("#"+a);this.BottomMostCashTicketPosition=g.offset().top+g.height()}var c=jQuery("#DummyCashTicketHeightPusher");var b=jQuery(window).scrollTop()||0;var f=Math.min(Math.max(b,this.TopMostCashTicketPosition),this.BottomMostCashTicketPosition);d.css("top",f+"px");c.height(d.outerHeight()+f-e.offset().top+"px")}},HandlePriceTicketAdvanceInfo:function(a){var b=jQuery("#priceAdvanceTooltip");if(a.type=="mouseover"){var d=jQuery(a.currentTarget);var c=d.offset().top;var e=d.offset().left;b.showAsPopup({mouseX:e,mouseY:c,xOffset:-(b.width()+15),yOffset:-50,alignMiddle:false})}else{b.hide()}}};Ecom.BookingCashTicket.registerClass("Ecom.BookingCashTicket",Ecom.Waiter);Ecom.EarlyBooking.EarlyBookingDetailComponent=function(a){this.numberOfTravellers=1;this.isDebug=false;Ecom.EarlyBooking.EarlyBookingDetailComponent.initializeBase(this,[a]);this.ShowWaitPanelDelegate=Function.createDelegate(this,this.ShowWaitPanel);this.HideWaitPanelDelegate=Function.createDelegate(this,this.HideWaitPanel);this.EnableNewTravellerInputLineDelegate=Function.createDelegate(this,this.EnableNewTravellerInputLine);this.DisableNewTravellerInputLineDelegate=Function.createDelegate(this,this.DisableNewTravellerInputLine);this.InitializeControlsDelegate=Function.createDelegate(this,this.InitializeControls);this.ShowImportantTravelInfoDelegate=Function.createDelegate(this,this.ShowImportantTravelInfo);this.AcceptGeneralConditionsDelegate=Function.createDelegate(this,this.AcceptGeneralConditions);this.SubmitEarlyBookingInfoDelegate=Function.createDelegate(this,this.SubmitEarlyBookingInfo);this.EarlyBookingInfoSubmittedDelegate=Function.createDelegate(this,this.EarlyBookingInfoSubmitted);this.GetCurrentBookByEmailInfoDelegate=Function.createDelegate(this,this.GetCurrentBookByEmailInfo);this.RegisterEventHandler("earlybookingaddtraveller","click",true,this.EnableNewTravellerInputLineDelegate,null,null,null,null);this.RegisterEventHandler("earlybookingremovetraveller","click",true,this.DisableNewTravellerInputLineDelegate,null,null,null,null);this.RegisterEventHandler("earlybookingShowImportantTravelInfo","click",true,this.ShowImportantTravelInfoDelegate,null,null,null,null);this.RegisterEventHandler("earlybookingAcceptGeneralConditions","click",false,this.AcceptGeneralConditionsDelegate,null,null,null,null);this.RegisterEventHandler("earlybookbyemailsubmit","click",true,this.SubmitEarlyBookingInfoDelegate,this.EarlyBookingInfoSubmittedDelegate,this.GetCurrentBookByEmailInfoDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);$addHandler(a,"click",this.OnClickDelegate);Sys.Application.add_load(this.InitializeControlsDelegate);this.commonDetailComponent=$create(Ecom.Detail.CommonDetailComponent,null,null,null);this.commonDetailComponent.setParentComponent(this)};Ecom.EarlyBooking.EarlyBookingDetailComponent.prototype={initialize:function(){},EnableNewTravellerInputLine:function(){this.numberOfTravellers++;this.CreateTravellerTemplate(this.numberOfTravellers,false);this.EnableDateControl("bbemTravellerDetails_"+this.numberOfTravellers);if(this.numberOfTravellers>1){show("earlybookingremovetraveller")}var a=jQuery("#maxBbemTravellers").val();if(this.numberOfTravellers>=a){hide("earlybookingaddtraveller")}},DisableNewTravellerInputLine:function(){if(this.numberOfTravellers>1){jQuery("#bbemTravellerDetails_"+this.numberOfTravellers).remove();this.numberOfTravellers--;if(this.numberOfTravellers==1){hide("earlybookingremovetraveller")}}show("earlybookingaddtraveller")},CreateTravellerTemplate:function(c,e){var d=jQuery("#bbemTravellerDetailItem").parseTemplate("bbemTravellerDetailItem");var a="";if(e){a=" <span>*</span>"}var b={itemNumber:c,firstItemHtml:a};jQuery("#shownTable").appendTemplate(d,b)},InitializeControls:function(){this.CreatePopups();var c="nl";if($get("earlybookbyemailcontent")!=null){c=$get("earlybookbyemailcontent").attributes.language.value}this.CreateTravellerTemplate(1,true);jQuery.datepicker.setDefaults(jQuery.datepicker.regional[c]);var a=new Date();jQuery("#earlybookingarrivaldate").datepicker({altField:"#earlybookingarrivaldatelabel",altFormat:"dd/mm/yy",dateFormat:"yyyyMMdd",minDate:a,defaultDate:a,hideIfNoPrevNext:true,changeFirstDay:false,showOtherMonths:false,duration:"fast",showAnim:"fadeIn",showOn:"button",buttonImage:"/App/Upload/Css/NVB/Images/calendar.gif",buttonImageOnly:true});var b=this;jQuery("#shownTable tr[id^='bbemTravellerDetails']").each(function(){b.EnableDateControl(this.id)})},EnableDateControl:function(c){var b=1;var e=null;var d=c;e=$get(d);if(e!=null){var a=$find(c);if(a!=null){a.dispose()}$create(Ecom.DateControl,{hasBlankDefault:true},null,null,e);b++}},ShowImportantTravelInfo:function(){var a=$get("bbemImportantTravelInfoEarlyBooking");var e=a.getAttribute("bbembrandcode");var d="<html><head><title>Info</title>";d+='<link rel="stylesheet" href="/App/Upload/Css/'+e+'/common.css">';d+='<link rel="stylesheet" href="/App/Upload/Css/'+e+'/detailview.css"></head>';d+='<body><div class="importantTravelInfoModalBody" style="height:497;width:649"><div>';d+=a.innerHTML;d+="</div></div></body>";var c=window.open("","name","height=497,width=649,scrollbars=yes");var b=c.document;b.write(d);b.close()},CheckMandatoryCombobox:function(b){var a="invalid";combobox=$get(b);if((combobox==null)||(combobox.selectedIndex==0)){Sys.UI.DomElement.addCssClass(combobox,a);return false}Sys.UI.DomElement.removeCssClass(combobox,a);return true},ValidateCurrentBookByEmailInfo:function(){var g=true;var f="";if($get("bbemBookNow")&&$get("bbemCheckPriceAndAvailability")){var l=$get("bbemBookNow");var j=$get("bbemCheckPriceAndAvailability");if(!(l.checked||j.checked)){g=false;f+=$get("bbemErrorPurpose").innerHTML}}if(!jQuery("#earlybookingarrivaldate").datepicker("getDate")){g=false;f+=$get("bbemErrorArrivalDate").innerHTML}if(this.CheckMandatoryCombobox("earlybookingdurations")==false){g=false;f+=$get("bbemErrorDuration").innerHTML}var c=$get("earlybookingairports");if(c!=null){if(this.CheckMandatoryCombobox("earlybookingairports")==false){g=false;f+=$get("bbemErrorAirport").innerHTML}}if(this.CheckMandatoryCombobox("earlybookingboardtypes")==false){g=false;f+=$get("bbemErrorBoardType").innerHTML}var a=this;var n=true;jQuery('#shownTable tr[id^="bbemTravellerDetails"]').each(function(r){var t=r+1;var s=$get("bbemTravellerDetails_"+t+"_firstName");var q=$get("bbemTravellerDetails_"+t+"_lastName");a.UpdateMandatoryFieldIndicator(s,"invalid");a.UpdateMandatoryFieldIndicator(q,"invalid");var p=$find("bbemTravellerDetails_"+t);if(p){p.Validate()}if(!s.value||!q.value||!p||!p.IsValidDate()){n=false}});if(!n){g=false;f+=$get("bbemErrorTravelers").innerHTML}var o=$get("bbemStreet");this.UpdateMandatoryFieldIndicator(o,"invalid");var b=$get("bbemHomenumber");this.UpdateMandatoryFieldIndicator(b,"invalid");var d=$get("bbemZipcode");this.UpdateMandatoryFieldIndicator(d,"invalid");var k=$get("bbemCity");this.UpdateMandatoryFieldIndicator(k,"invalid");var m=$get("bbemTelephone");this.UpdateMandatoryFieldIndicator(m,"invalid");if(o.value==""||b.value==""||d.value==""||k.value==""||m.value==""){g=false;f+=$get("bbemErrorContactInfo").innerHTML}var e=$get("bbemEmail");var h="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?";if(e.value==""||e.value.toLowerCase().match(h)!=e.value.toLowerCase()){this.UpdateValidFieldIndicator(e,"invalid",false);g=false;f+=$get("bbemErrorEmail").innerHTML}else{this.UpdateValidFieldIndicator(e,"invalid",true)}if(!jQuery("#earlybookingAcceptGeneralConditions").is(":checked")){g=false;f+=$get("bbemErrorAcceptGeneralConditions").innerHTML}if(g==false){this.ShowErrorPopup(f)}return g},GetCurrentBookByEmailInfo:function(){var b=new ThomasCook.Ecom.Core.PageComponents.Data.CommonView.Booking.BookByEmail.EmailBookingUI();b.travelinfo=this.GetCurrentTravelInfo();b.BookNow=jQuery("bbemBookNow").is(":checked")||false;b.CheckPriceAndAvailability=jQuery("bbemCheckPriceAndAvailability").is(":checked")||false;b.mainContactInfo=new ThomasCook.Ecom.Core.PageComponents.Data.CommonView.Booking.BookByEmail.EmailBookingMainContactInfo();b.mainContactInfo.street=$get("bbemStreet").value;b.mainContactInfo.houseNr=$get("bbemHomenumber").value;b.mainContactInfo.zipCode=$get("bbemZipcode").value;b.mainContactInfo.city=$get("bbemCity").value;b.mainContactInfo.country=$get("bbemCountry").value;b.mainContactInfo.phoneNr=$get("bbemTelephone").value;b.mainContactInfo.mobilePhoneNr=$get("bbemMobile").value;b.mainContactInfo.eMail=$get("bbemEmail").value;b.remarks=$get("bbemRemarks").value;b.travellers=[];var d=0;var h=null;do{var g="bbemTravellerDetails_"+(d+1);h=$get(g);if(h!=null){var e=new ThomasCook.Ecom.Core.PageComponents.Data.CommonView.Booking.BookByEmail.EmailBookingTraveller();e.firstName=$get(g+"_firstName").value;e.middleName=$get(g+"_middleName").value;e.lastName=$get(g+"_lastName").value;e.gender=$get(g+"_gender").value;e.year=$get(g+"_years").value;e.month=$get(g+"_months").value;e.day=$get(g+"_days").value;b.travellers[d++]=e}}while(d<this.numberOfTravellers);b.insurances=[];d=0;arrayIndex=0;var f=null;do{var a="bbemInsuranceType_"+(d+1);f=$get(a);if(f!=null){var c=new ThomasCook.Ecom.Core.PageComponents.Data.CommonView.Booking.BookByEmail.EmailBookingInsurance();if(f.value!=null&&f.value!=""){c.uiCategory=f.getAttribute("insuranceType");c.insurance=f.value;b.insurances[arrayIndex++]=c}d++}}while(f!=null);if(this.get_element().id=="earlybookbyemailcontent"){b.EmailType="EarlyBooking"}if(this.get_element().id=="groupbookbyemailcontent"){b.EmailType="GroupBooking"}return b},AcceptGeneralConditions:function(){var c=$get("earlybookingAcceptGeneralConditions");if(c!=null){var b=$get("earlybookbyemailsubmit");if(b!=null){var a=b.className;if(c.checked){b.className=a.replace("btActionDisabled","btAction");b.setAttribute("disableClick",false)}else{b.setAttribute("disableClick",true);b.className=a.replace("btAction","btActionDisabled")}}}},SubmitEarlyBookingInfo:function(f,e,d,b,a,c){if(this.ValidateCurrentBookByEmailInfo()){ThomasCook.Ecom.Web.BookingAvailability.BookEarlyBooking(f,e,d,b,a,c)}},EarlyBookingInfoSubmitted:function(a){if(a==null){this.ShowErrorPopup("Unexpected Error")}else{if(a.ErrorOccurred){this.ShowErrorPopup(a.Message)}else{this.ShowStatusPopup(a.Message)}}},GetCurrentTravelInfo:function(){var a=this.get_element();var g=new ThomasCook.Ecom.Core.PageComponents.Data.CommonView.Booking.BookingStepZero.TravelInfo();g.channelName=a.attributes.channel.value;g.shortDescription=a.attributes.shortDescription.value;g.pageKey=a.attributes.pageKey.value;g.packageCode=a.attributes.packageCode.value;g.catalogCode=a.attributes.catalogCode.value;g.brandCode=a.attributes.brandCode.value;g.seasonCode=a.attributes.seasonCode.value;var e=parseInt($get("earlybookingrooms").value);g.numberOfRooms=isNaN(e)?1:e;var f=parseInt($get("earlybookingdurations").value);g.selectedDuration=isNaN(f)?7:f;var d=jQuery("#earlybookingarrivaldate").datepicker("getDate");var c=d?d.format("yyyyMMdd"):"";g.departureDate=c;g.selectedCellDate=c;var b=jQuery("#earlybookingairports option:selected");g.selectedAirport=b.val();g.selectedAirportDescription=b.text();g.roomOccupations=[];return g},CreatePopups:function(){var c=this;var b={dialogClass:"option",width:400};this.bookByEmailStatusPopup=new Ecom.UI.ModalBox("#bookByEmailStatusPopup",b);var a=jQuery.extend(b,{dialogClass:"error"});this.bookByEmailErrorPopup=new Ecom.UI.ModalBox("#bookByEmailErrorPopup",a)},ShowStatusPopup:function(a){this.HideWaitPanel();(this.bookByEmailStatusPopup&&this.bookByEmailStatusPopup.show({content:a}))},ShowErrorPopup:function(a){this.HideWaitPanel();(this.bookByEmailErrorPopup&&this.bookByEmailErrorPopup.show({content:a}))},CloseStatusPopup:function(){this.bookByEmailStatusPopup.hide()},CloseErrorPopup:function(){this.bookByEmailErrorPopup.hide()},HideWaitPanel:function(){Ecom.Application.hideWaiterBox()},ShowWaitPanel:function(){Ecom.Application.showWaiterBox()}};Ecom.EarlyBooking.EarlyBookingDetailComponent.registerClass("Ecom.EarlyBooking.EarlyBookingDetailComponent",Ecom.ControlBase);Ecom.BookByEmail=function(a){this.Mediator=null;this.SubmitBookByEmailDelegate=Function.createDelegate(this,this.SubmitBookByEmail);this.GetCurrentBookByEmailInfoDelegate=Function.createDelegate(this,this.GetCurrentBookByEmailInfo);this.BookingFinishedDelegate=Function.createDelegate(this,this.BookingFinished);this.AcceptGeneralConditionsDelegate=Function.createDelegate(this,this.AcceptGeneralConditions);this.BackToDetailDelegate=Function.createDelegate(this,this.BackToDetail);this.ChooseNoBookByTravelAgentDelegate=Function.createDelegate(this,this.ChooseNoBookByTravelAgent);this.ChooseBookByTravelAgentDelegate=Function.createDelegate(this,this.ChooseBookByTravelAgent);this.GetCurrentTravelInfoDelegate=Function.createDelegate(this,this.GetCurrentTravelInfo);this.OnPartialUpdateDelegate=Function.createDelegate(this,this.OnPartialUpdate);Ecom.BookByEmail.initializeBase(this,[a]);this.RegisterEventHandler("bbemAcceptGeneralConditions","click",false,this.AcceptGeneralConditionsDelegate,null,null,null,null);this.RegisterEventHandler("bookbyemailsubmit","click",true,this.SubmitBookByEmailDelegate,this.BookingFinishedDelegate,this.GetCurrentBookByEmailInfoDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);this.RegisterEventHandler("BackToDetail","click",true,this.BackToDetailDelegate,null,null,null,null);this.RegisterEventHandler("travelAgentProvincesSelect","change",false,ThomasCook.Ecom.Web.BookingAvailability.GetTravelAgentCitiesForRegion,this.OnPartialUpdateDelegate,this.GetCurrentTravelInfoDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);this.RegisterEventHandler("travelAgentCitiesSelect","change",false,ThomasCook.Ecom.Web.BookingAvailability.GetTravelAgentsForCity,this.OnPartialUpdateDelegate,this.GetCurrentTravelInfoDelegate,this.ShowWaitPanelDelegate,this.HideWaitPanelDelegate);this.RegisterEventHandler("ChooseNotBookbyTravelAgent","click",false,this.ChooseNoBookByTravelAgentDelegate,null,null,null,null);this.RegisterEventHandler("ChooseBookbyTravelAgent","click",false,this.ChooseBookByTravelAgentDelegate,null,null,null,null);$addHandler(a,"click",this.OnClickDelegate)};Ecom.BookByEmail.prototype={initialize:function(){},OnPartialUpdate:function(c,b,a){if(c!=null){this.DoPartialUpdateWithOmnitureLogging(c)}this.Wait(b,false)},GetCurrentTravelInfo:function(){return this.Mediator.GetBookByEmailTravelInfo()},ChooseNoBookByTravelAgent:function(){var a=null;i=1;do{a=$get("travelAgent_"+i);if(a!=null){if(a.checked){a.checked=false}}i++}while(a!=null);hide("showtravelagentmode")},ChooseBookByTravelAgent:function(){show("showtravelagentmode")},SubmitBookByEmail:function(v,l,F,y,m,o){var C=true;var A="";var t=$get("bbemBookNow");var s=$get("bbemCheckPriceAndAvailability");if(!(t.checked||s.checked)){C=false;A+=$get("bbemErrorPurpose").innerHTML+"\n"}var z=1;var c=null;var w=null;do{c=$get("TravellerDetails_"+z+"_firstName");if(c!=null){w=$get("TravellerDetails_"+z+"_lastName");this.UpdateMandatoryFieldIndicator(c,"invalid");this.UpdateMandatoryFieldIndicator(w,"invalid");var n=$find("TravellerDetails_"+z);if(n){n.Validate()}z++;if(!c.value||!w.value||!n||!n.IsValidDate()){C=false;A+=$get("bbemErrorTravelers").innerHTML+"\n";break}}}while(c!==null);var b=$get("bbemStreet");this.UpdateMandatoryFieldIndicator(b,"invalid");var j=$get("bbemHomenumber");this.UpdateMandatoryFieldIndicator(j,"invalid");var h=$get("bbemZipcode");this.UpdateMandatoryFieldIndicator(h,"invalid");var g=$get("bbemCity");this.UpdateMandatoryFieldIndicator(g,"invalid");var p=$get("bbemTelephone");this.UpdateMandatoryFieldIndicator(p,"invalid");if(b.value==""||j.value==""||h.value==""||g.value==""||p.value==""){C=false;A+=$get("bbemErrorContactInfo").innerHTML+"\n"}var E=$get("bbemEmail");var D=$get("bbemEmailConfirmation");var x="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?";if(E.value==""||E.value!=D.value||E.value.toLowerCase().match(x)!=E.value.toLowerCase()){this.UpdateValidFieldIndicator(E,"invalid",false);this.UpdateValidFieldIndicator(D,"invalid",false);C=false;A+=$get("bbemErrorEmail").innerHTML+"\n"}else{this.UpdateValidFieldIndicator(E,"invalid",true);this.UpdateValidFieldIndicator(D,"invalid",true)}var B=$get("bbemEmergencyContact");this.UpdateMandatoryFieldIndicator(B,"invalid");var q=$get("bbemEmergencyPhone");this.UpdateMandatoryFieldIndicator(q,"invalid");if(B.value==""||q.value==""){C=false;A+=$get("bbemErrorEmergencyInfo").innerHTML+"\n"}var a=$get("bookbyemailsubmit");if(a!=null){var d=a.getAttribute("MandatoryBookingByTravelAgent");var u=false;var k=$get("ChooseBookbyTravelAgent");if(k!=null){u=k.checked}if(u||(d=="MandatoryBookingByTravelAgent")){var e=false;var r=null;i=1;do{r=$get("travelAgent_"+i);if(r!=null){if(r.checked){e=true}}i++}while(r!=null);if(!e){C=false;A+=$get("bbemErrorTravelAgentInfo").innerHTML+"\n"}}var f=$get("bbemAcceptGeneralConditions");if(f!=null){if(!f.checked){C=false;A+=$get("bbemErrorAcceptGeneralConditions").innerHTML+"\n"}}}if(C==true){this.Wait(o,true);ThomasCook.Ecom.Web.BookingAvailability.BookByEmail(v,l,F,y,m,o)}else{this.HideWaitPanel();alert(A)}},AcceptGeneralConditions:function(){var c=$get("bbemAcceptGeneralConditions");if(c!=null){var b=$get("bookbyemailsubmit");if(b!=null){var a=b.className;if(c.checked){b.className=a.replace("btActionDisabled","btAction");b.setAttribute("disableClick",false)}else{b.setAttribute("disableClick",true);b.className=a.replace("btAction","btActionDisabled")}}}},GetCurrentBookByEmailInfo:function(){var h=new ThomasCook.Ecom.Core.PageComponents.Data.CommonView.Booking.BookByEmail.EmailBookingUI();h.travelinfo=this.Mediator.GetBookByEmailTravelInfo();h.BookNow=$get("bbemBookNow").checked;h.CheckPriceAndAvailability=$get("bbemCheckPriceAndAvailability").checked;var b=new ThomasCook.Ecom.Core.PageComponents.Data.CommonView.Booking.BookByEmail.EmailBookingMainContactInfo();h.mainContactInfo=b;h.mainContactInfo.street=$get("bbemStreet").value;h.mainContactInfo.houseNr=$get("bbemHomenumber").value;h.mainContactInfo.zipCode=$get("bbemZipcode").value;h.mainContactInfo.city=$get("bbemCity").value;h.mainContactInfo.country=$get("bbemCountry").value;h.mainContactInfo.phoneNr=$get("bbemTelephone").value;h.mainContactInfo.mobilePhoneNr=$get("bbemMobile").value;h.mainContactInfo.eMail=$get("bbemEmail").value;h.mainContactInfo.optIntoPromos=$get("bbemReceivepromotions").checked;h.emergancyContact=$get("bbemEmergencyContact").value;h.emergencyPhoneNr=$get("bbemEmergencyPhone").value;h.remarks=$get("bbemRemarks").value;h.travellers=new Array();var k=0;var d=null;do{var m="TravellerDetails_"+(k+1);d=$get(m);if(d!=null){var o=new ThomasCook.Ecom.Core.PageComponents.Data.CommonView.Booking.BookByEmail.EmailBookingTraveller();o.firstName=$get(m+"_firstName").value;o.middleName=$get(m+"_middleName").value;o.lastName=$get(m+"_lastName").value;o.gender=$get(m+"_gender").value;o.year=$get(m+"_years").value;o.month=$get(m+"_months").value;o.day=$get(m+"_days").value;h.travellers[k++]=o}}while(d!=null);h.insurances=new Array();k=0;var a=null;do{var e="bbemInsuranceType_"+(k+1);a=$get(e);if(a!=null){var n=new ThomasCook.Ecom.Core.PageComponents.Data.CommonView.Booking.BookByEmail.EmailBookingInsurance();n.uiCategory=a.getAttribute("insuranceType");n.insurance=a.value;h.insurances[k++]=n}}while(a!=null);h.ExtraServices=new Array();k=0;var c=null;var g=0;do{var j="extraservice_"+(k+1);c=$get(j);if(c!=null&&c.checked){var f=new ThomasCook.Ecom.Core.PageComponents.Data.CommonView.Booking.BookByEmail.EmailBookingExtraService();f.UiName=c.getAttribute("description");f.UiCode=c.getAttribute("code");h.ExtraServices[g++]=f}k++}while(c!=null);h.emergancyContact=$get("bbemEmergencyContact").value;h.emergencyPhoneNr=$get("bbemEmergencyPhone").value;var l=null;k=1;do{l=$get("travelAgent_"+k);if(l!=null){if(l.checked){h.AgentGuid=l.value}}k++}while(l!=null);return h},BookingFinished:function(d,c,b){this.Wait(c,false);var a=$get("bookbyemailsubmitresult");if(a!=null){a.innerHTML=d}},BackToDetail:function(){this.Mediator.BackFromBookByEmail()},InitializeDateControls:function(){var b=1;var d=null;do{var c="TravellerDetails_"+b;d=$get(c);if(d!=null){var a=$find(c);if(a!=null){a.dispose()}$create(Ecom.DateControl,{hasBlankDefault:true},null,null,d);b++}}while(d!=null)}};Ecom.BookByEmail.registerClass("Ecom.BookByEmail",Ecom.Waiter);
