Type.registerNamespace("Ecom.SalesForce");Ecom.SalesForce.SalesForceForm=function(a){Ecom.SalesForce.SalesForceForm.initializeBase(this,[a])};Ecom.SalesForce.SalesForceForm.prototype={initialize:function(){Ecom.SalesForce.SalesForceForm.callBaseMethod(this,"initialize")},ValidateFields:function(c){var d=true;var b=true;var e=true;var a=true;jQuery(c+" .invalid").each(function(){jQuery(this).removeClass("invalid")});jQuery(c+" .jq-ErrorContainer").children().hide();jQuery(c+" .jq-email").each(function(){var g="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?";var f=jQuery(this).val().toLowerCase();if(f&&!f.match(g)){b=false;jQuery(this).addClass("invalid")}});jQuery(c+" .jq-decimal").each(function(){var f="^([1-9]{1}[0-9]{0,}(.[0-9]{0,2})?|0(.[0-9]{0,2})?|.[0-9]{1,2})$";var g=jQuery(this).val();if(g&&!g.match(f)){a=false;jQuery(this).addClass("invalid")}});jQuery(c+" .jq-number").each(function(){var f=jQuery(this).val();if(f.match(/\D+/)){e=false;jQuery(this).addClass("invalid")}});jQuery(c+" .jq-required").each(function(){if(!jQuery(this).val()){d=false;jQuery(this).addClass("invalid")}});if(!e){jQuery(c+" div[id^=ErrorNumber]").show("fast")}if(!a){jQuery(c+" div[id^=ErrorDecimal]").show("fast")}if(!b){jQuery(c+" div[id^=ErrorEmail]").show("fast")}if(!d){jQuery(c+" div[id^=ErrorMandatory]").show("fast")}return b&&d&&e&&a},ValidateGroup:function(b,a,c){var e=jQuery(b+" "+a);var d=0;e.each(function(){if(jQuery(this).val()){++d}});if(!c){if(d==0){e.each(function(){jQuery(this).addClass("invalid")});return false}return true}else{if(e.size()!=d&&d!=0){e.each(function(){jQuery(this).addClass("invalid")});return false}}return true},GetFormattedCalendarDate:function(a){var b=jQuery(a).datepicker("getDate");if(b!=null){return b.format("yyyyMMdd")}return null},ValidateDateField:function(e,a,b,d){var c=jQuery(a).datepicker("getDate");if(c!=null){var f=c.getFullYear()+b;c.setFullYear(f);if(c>new Date()){jQuery(a).addClass("invalid");jQuery(e+" div[id^="+d+"]").show("fast");return false}return true}return false}};Ecom.SalesForce.SalesForceForm.registerClass("Ecom.SalesForce.SalesForceForm",Sys.UI.Control);Ecom.SalesForce.Contact=function(a){Ecom.SalesForce.Contact.initializeBase(this,[a]);this.OnSubmitDelegate=Function.createDelegate(this,this.OnSubmit);this.OnSubmitFinishedDelegate=Function.createDelegate(this,this.OnSubmitFinished);this.OnSubmitFailedDelegate=Function.createDelegate(this,this.OnSubmitFinished);this.InitAfterLoadDelegate=Function.createDelegate(this,this.InitAfterLoad);jQuery("#cf_salesforcecontactformsubmit").click(this.OnSubmitDelegate);Sys.Application.add_load(this.InitAfterLoadDelegate)};Ecom.SalesForce.Contact.prototype={initialize:function(){Ecom.SalesForce.Contact.callBaseMethod(this,"initialize")},InitAfterLoad:function(){jQuery("#cf_birthDate").each(function(){jQuery(this).datepicker({maxDate:new Date(),changeYear:true,yearRange:"-100:+100"});jQuery(this).siblings().click(function(){jQuery(this).datepicker("show")})})},HandleResult:function(a){jQuery("#SalesForceContactFormPanel").hide();if(a){jQuery("#cf_submitsucceeded").show()}else{jQuery("#cf_submitfailed").show()}},OnSubmitFinished:function(c,b,a){this.HandleResult(c)},OnSubmitFailed:function(){this.HandleResult(false)},OnSubmit:function(){if(!this.ValidateFields("#SalesForceContactFormPanel")|!this.ValidateDateField("#SalesForceContactFormPanel","#cf_birthDate",16,"ErrorAge")){return}var a=new ThomasCook.Ecom.Core.PageComponents.Data.SalesForce.SalesForceContact();a.ReasonCode=jQuery("#cf_reason").val();a.ProductCode=jQuery("#cf_product").val();a.Salutation=jQuery("#cf_salutation").val();a.FirstName=jQuery("#cf_firstName").val();a.LastName=jQuery("#cf_lastName").val();a.Email=jQuery("#cf_email").val().toLowerCase();a.Phone=jQuery("#cf_phone").val();a.Subject=jQuery("#cf_subject").val();a.Description=jQuery("#cf_description").val();a.BirthDate=this.GetFormattedCalendarDate("#cf_birthDate");ThomasCook.Ecom.Web.SalesForce.SubmitContactRequest(a,this.OnSubmitFinishedDelegate,this.OnSubmitFailed,null)}};Ecom.SalesForce.Contact.registerClass("Ecom.SalesForce.Contact",Ecom.SalesForce.SalesForceForm);Ecom.SalesForce.PostBooking=function(a){Ecom.SalesForce.PostBooking.initializeBase(this,[a]);this.OnSubmitDelegate=Function.createDelegate(this,this.OnSubmit);this.OnSubmitFinishedDelegate=Function.createDelegate(this,this.OnSubmitFinished);this.OnSubmitFailedDelegate=Function.createDelegate(this,this.OnSubmitFinished);this.OnReasonChangeDelegate=Function.createDelegate(this,this.OnReasonChanged);this.OnSpecialServiceRequestChangeDelegate=Function.createDelegate(this,this.OnSpecialServiceRequestChanged);jQuery("#pb_salesforcepostbookingformsubmit").click(this.OnSubmitDelegate);jQuery("#pb_reason").change(this.OnReasonChangeDelegate);jQuery("#pb_specialServiceRequest").change(this.OnSpecialServiceRequestChangeDelegate)};Ecom.SalesForce.PostBooking.prototype={initialize:function(){Ecom.SalesForce.PostBooking.callBaseMethod(this,"initialize")},HandleResult:function(a){if(a==0){jQuery("#SalesForcePostBookingFormPanel").hide();jQuery("#pb_submitsucceeded").show()}else{if(a==1){jQuery("#pb_reservationNumber").addClass("invalid");jQuery("#pb_email").addClass("invalid");jQuery("div[id^=ErrorPoNumber]").show()}else{jQuery("#SalesForcePostBookingFormPanel").hide();jQuery("#pb_submitfailed").show()}}},OnSubmitFinished:function(c,b,a){this.HandleResult(c)},OnSubmitFailed:function(){this.HandleResult(false)},OnSubmit:function(){if(!this.ValidateFields("#SalesForcePostBookingFormPanel")|!this.ValidateGroups()){return}var a=new ThomasCook.Ecom.Core.PageComponents.Data.SalesForce.SalesForcePostBooking();a.ReservationNumber=jQuery("#pb_reservationNumber").val();a.Street=jQuery("#pb_street").val();a.Number=jQuery("#pb_number").val();a.Box=jQuery("#pb_box").val();a.ZipCode=jQuery("#pb_zipCode").val();a.City=jQuery("#pb_city").val();a.Country=jQuery("#pb_country").val();a.MobilePhone=jQuery("#pb_mobilePhone").val();a.BankAccountNumber=jQuery("#pb_bankAccountNumber").val();a.IbanNumber=jQuery("#pb_ibanNumber").val();a.BicNumber=jQuery("#pb_bicNumber").val();a.Reason=jQuery("#pb_reason").val();a.Comment=jQuery("#pb_description").val();if(a.Reason=="SpecialServiceRequest"){a.SpecialServiceRequest=jQuery("#pb_specialServiceRequest").val();if(a.SpecialServiceRequest=="Animal"){a.AnimalType=jQuery("#pb_animalType").val();a.AnimalWeight=jQuery("#pb_animalWeight").val();a.AnimalTypeInCabin=jQuery("#pb_animalTypeInCabin").val();a.AnimalWeightInCabin=jQuery("#pb_animalWeightInCabin").val()}if(a.SpecialServiceRequest=="ExcessLuggageOrEquipment"){a.NumberOfBikes=jQuery("#pb_numberOfBikes").val();a.NumberOfGolfBags=jQuery("#pb_numberOfGolfBags").val();a.WeightPerGolfBag=jQuery("#pb_weightPerGolfBag").val();a.NumberOfScubaDivingBags=jQuery("#pb_numberOfScubaDivingBags").val();a.WeightPerScubaDivingBag=jQuery("#pb_weightPerScubaDivingBag").val();a.WindSurfBoardLength=jQuery("#pb_windSurfBoardLength").val();a.WindSurfBoardWidth=jQuery("#pb_windSurfBoardWidth").val();a.WindSurfBoardWeight=jQuery("#pb_windSurfBoardWeight").val();a.OtherExtraBagDescription=jQuery("#pb_otherExtraBagDescription").val();a.OtherExtraBagWeight=jQuery("#pb_otherExtraBagWeight").val()}if(a.SpecialServiceRequest=="SpecialMeals"){a.SpecialMeals=jQuery("#pb_specialMeals").val()}if(a.SpecialServiceRequest=="UnaccompaniedMinor"){a.ResponsibleInBelgiumName=jQuery("#pb_responsibleInBelgiumName").val();a.ResponsibleInBelgiumAddress=jQuery("#pb_responsibleInBelgiumAddress").val();a.ResponsibleInBelgiumPhone=jQuery("#pb_responsibleInBelgiumPhone").val();a.ResponsibleAtDestinationName=jQuery("#pb_responsibleAtDestinationName").val();a.ResponsibleAtDestinationAddress=jQuery("#pb_responsibleAtDestinationAddress").val();a.ResponsibleAtDestinationPhone=jQuery("#pb_responsibleAtDestinationPhone").val()}}a.Salutation=jQuery("#pb_salutation").val();a.FirstName=jQuery("#pb_firstName").val();a.LastName=jQuery("#pb_name").val();a.Email=jQuery("#pb_email").val().toLowerCase();a.Phone=jQuery("#pb_phone").val();ThomasCook.Ecom.Web.SalesForce.SubmitPostBookingRequest(a,this.OnSubmitFinishedDelegate,this.OnSubmitFailed,null)},OnReasonChanged:function(){var a=jQuery("#pb_reason").val();if(a=="SpecialServiceRequest"){jQuery("#pb_specialServiceRequestBlock").show("slow");this.OnSpecialServiceRequestChanged()}else{jQuery("#pb_specialServiceRequestBlock").hide("slow")}},OnSpecialServiceRequestChanged:function(){var a=jQuery("#pb_specialServiceRequest").val();if(a==""){jQuery("#pb_specialServiceRequestTypesBlock").children().hide("slow")}else{jQuery("#pb_"+a+"Block").show("slow").siblings().hide("slow")}},ValidateGroups:function(){var b=jQuery("#pb_reason").val();if(b=="SpecialServiceRequest"){var a=jQuery("#pb_specialServiceRequest").val();if(a=="Animal"){if(!this.ValidateGroup("#SalesForcePostBookingFormPanel",".jq-group-animal",true)){jQuery("div[id^=ErrorAnimalGroup]").show();return false}if(!this.ValidateGroup("#SalesForcePostBookingFormPanel",".jq-group-animalCabin",true)){jQuery("div[id^=ErrorAnimalCabinGroup]").show();return false}if(!this.ValidateGroup("#SalesForcePostBookingFormPanel",".jq-group-animalType",false)){jQuery("div[id^=ErrorAnimalTypeGroup]").show();return false}}}if(a=="ExcessLuggageOrEquipment"){if(!this.ValidateGroup("#SalesForcePostBookingFormPanel",".jq-group-golfBag",true)){jQuery("div[id^=ErrorGolfBagGroup]").show();return false}if(!this.ValidateGroup("#SalesForcePostBookingFormPanel",".jq-group-divingBag",true)){jQuery("div[id^=ErrorDivingBagGroup]").show();return false}if(!this.ValidateGroup("#SalesForcePostBookingFormPanel",".jq-group-surfBoard",true)){jQuery("div[id^=ErrorSurfBoardGroup]").show();return false}if(!this.ValidateGroup("#SalesForcePostBookingFormPanel",".jq-group-extraBag",true)){jQuery("div[id^=ErrorExtraBagGroup]").show();return false}if(!this.ValidateGroup("#SalesForcePostBookingFormPanel",".jq-group-luggageEquipment",false)){jQuery("div[id^=ErrorLuggageEquipmentGroup]").show();return false}}if(a=="UnaccompaniedMinor"){if(!this.ValidateGroup("#SalesForcePostBookingFormPanel",".jq-group-unaccompaniedMinor",true)){jQuery("div[id^=ErrorUnaccompaniedMinorGroup]").show();return false}if(!this.ValidateGroup("#SalesForcePostBookingFormPanel",".jq-group-unaccompaniedMinor",false)){jQuery("div[id^=ErrorUnaccompaniedMinorGroup]").show();return false}}return true}};Ecom.SalesForce.PostBooking.registerClass("Ecom.SalesForce.PostBooking",Ecom.SalesForce.SalesForceForm);Ecom.SalesForce.Booking=function(a){Ecom.SalesForce.Booking.initializeBase(this,[a]);this.OnSubmitDelegate=Function.createDelegate(this,this.OnSubmit);this.OnChooseProductDelegate=Function.createDelegate(this,this.OnChooseProduct);this.OnChooseNumberOfRoomsDelegate=Function.createDelegate(this,this.OnChooseNumberOfRooms);this.BackToDetailDelegate=Function.createDelegate(this,this.BackToDetail);this.OnSubmitFinishedDelegate=Function.createDelegate(this,this.OnSubmitFinished);this.OnSubmitFailedDelegate=Function.createDelegate(this,this.OnSubmitFailed);this.InitAfterLoadDelegate=Function.createDelegate(this,this.InitAfterLoad);this.OnAgreeDelegate=Function.createDelegate(this,this.OnAgree);this.ShowDirectSalesTravelAgentsDelegate=Function.createDelegate(this,this.ShowDirectSalesTravelAgents);this.IsMovedToFinalPosition=false;Sys.Application.add_load(this.InitAfterLoadDelegate)};Ecom.SalesForce.Booking.prototype={initialize:function(){Ecom.SalesForce.Booking.callBaseMethod(this,"initialize")},ShowDirectSalesTravelAgents:function(b){Ecom.Application.showWaiterBox();var a=new ThomasCook.Ecom.Core.PageComponents.Data.CommonView.Booking.BookingStepZero.TravelAgentsFilter();a.CityFilter=jQuery("#dsTravelAgentCitySelect_salesforce").val();a.ZipCodeFilter=jQuery("#dsTravelAgentZipCodeSelect_salesforce").val();a.Selected=jQuery(b.target).attr("filter");a.PaymentMethod="salesforce";ThomasCook.Ecom.Web.BookingAvailability.ShowDirectSalesTravelAgents("","",a,this.OnShowDirectSalesTravelAgentsResult)},OnShowDirectSalesTravelAgentsResult:function(a){var d=a.divUpdates[0];jQuery("#"+d.DivId).empty().append(d.DivHtml);var b=jQuery("#cityFilter").val();var c=jQuery("#zipCodeFilter").val();jQuery("#dsTravelAgentCitySelect_salesforce").val(b);jQuery("#dsTravelAgentZipCodeSelect_salesforce").val(c);Ecom.Application.hideWaiterBox()},InitAfterLoad:function(){if(jQuery("#soldoutbookbyemail").length<=0){var b=jQuery("#sfb_product");if(b.val()==""){b.val("Flight")}var c=jQuery("#sfb_departureDate").val();var a=Date.parseInvariant(c,"yyyyMMdd");this.ShowInitially(a)}this.OnChooseProduct()},OnAgree:function(){var a=jQuery("#sfb_optAgree").is(":checked");jQuery("#sfb_salesforcebookingformsubmit").toggleClass("btAction",a).toggleClass("btActionDisabled",!a)},ShowInitially:function(a){jQuery("#sfb_salesforcebookingformsubmit").click(this.OnSubmitDelegate);jQuery("#sfb_optAgree").click(this.OnAgreeDelegate);jQuery("#sfb_numberOfRooms").change(this.OnChooseNumberOfRoomsDelegate);jQuery("#sfb_product").change(this.OnChooseProductDelegate);jQuery("#dsTravelAgentCitySelect_salesforce").change(this.ShowDirectSalesTravelAgentsDelegate);jQuery("#dsTravelAgentZipCodeSelect_salesforce").change(this.ShowDirectSalesTravelAgentsDelegate);this.InitializeCalendarControls(a);jQuery("SalesForceBookingFormComponent").show();jQuery("#sfb_soldoutbookbyemail").show()},Show:function(h){if(!this.IsMovedToFinalPosition){jQuery("#sfb_SalesForceBookingFormPanel").appendTo("#soldoutbookbyemail");jQuery("#sfb_submitpanel").appendTo("#soldoutbookbyemail");this.IsMovedToFinalPosition=true}jQuery("#sfb_BackToDetail").click(this.BackToDetailDelegate);jQuery("#sfb_product_title").text(h.Title);jQuery("#sfb_product").val(h.SalesForceProductCode);jQuery("#sfb_hotelCode").val(h.brandCode+"/"+h.catalogCode+"/"+h.packageCode);jQuery("#sfb_numberOfNights").val(h.selectedCellDuration);jQuery("#sfb_nights").text(h.selectedCellDuration);jQuery("#sfb_departureAirport").val(h.selectedAirportDescription);jQuery("#sfb_depAirport").text(h.selectedAirportDescription);if(h.selectedAirportDescription){jQuery("#sfb_depAirport_placeholder").show()}else{jQuery("#sfb_depAirport_placeholder").hide()}jQuery("#sfb_numberOfRooms").val(h.numberOfRooms);jQuery("#sfb_theNumberOfRooms").text(h.numberOfRooms);jQuery("#sfb_holidayCountry").val(h.Country);jQuery("#sfb_holidayPlace").val(h.Place);jQuery("#sfb_location").text(h.Country+", "+h.Place);var b=0;for(var c=0;c<h.numberOfRooms;c++){var f=h.roomOccupations[c];var d=c+1;jQuery("#sfb_accoType"+d).val(f.boardType+", "+f.boardTypeDescription);jQuery("#sfb_housingType"+d).val(f.selectedRoomDescription);jQuery("#sfb_housingTypeDescription"+d).text(f.selectedRoomDescription);jQuery("#sfb_boardType"+d).val(f.boardType);jQuery("#sfb_acco"+d).text(f.boardTypeDescription);var e=f.selectedPrice.trimStart();if(e.startsWith("€")){jQuery("#sfb_price"+d).text(f.selectedPrice)}else{jQuery("#sfb_price"+d).text("€ "+f.selectedPrice)}jQuery("#sfb_housingPrice"+d).val(f.selectedPrice);jQuery("#sfb_occupationAdults"+d).val(f.numberOfAdults);b=b+Number(f.numberOfAdults);jQuery("#sfb_adults"+d).text("");jQuery("#sfb_adultLabel"+d).hide();jQuery("#sfb_adultsLabel"+d).hide();if(f.numberOfAdults>0){jQuery("#sfb_adults"+d).text(f.numberOfAdults)}if(f.numberOfAdults==1){jQuery("#sfb_adultLabel"+d).show()}else{if(f.numberOfAdults>1){jQuery("#sfb_adultsLabel"+d).show()}}var g=0;if(f.childAges!=null){g=f.childAges.length;b=b+f.childAges.length}jQuery("#sfb_addLabel"+d).hide();jQuery("#sfb_childLabel"+d).hide();jQuery("#sfb_childrenLabel"+d).hide();jQuery("#sfb_children"+d).text("");if(g>0){if(f.numberOfAdults>0){jQuery("#sfb_addLabel"+d).show()}jQuery("#sfb_children"+d).text(g)}if(g==1){jQuery("#sfb_childLabel"+d).show()}else{if(g>1){jQuery("#sfb_childrenLabel"+d).show()}}jQuery("#sfb_occupationChildren"+d).val(g)}if(h.numberOfRooms<2){jQuery(".jq-SecondRoom").hide()}else{jQuery(".jq-SecondRoom").show()}for(var c=1;c<8;c++){if(c<=b){jQuery("#sfb_TravelerRow"+c).show()}else{jQuery("#sfb_TravelerRow"+c).hide()}}if(jQuery("#sfb_dynamic").hasClass("hidden")){jQuery("#sfb_product").removeClass("jq-required");jQuery("#sfb_holidayPlace").removeClass("jq-required")}var a=Date.parseInvariant(h.selectedCellDate,"yyyyMMdd");jQuery("#sfb_departure").text(a.getDate()+"/"+(a.getMonth()+1)+"/"+a.getFullYear());this.ShowInitially(a)},ValidateHandlingSection:function(){if(jQuery("#sfHandlingMethod input[name='sfTravelAgentOption']").length<=0){return true}if(jQuery("#sfHandlingMethod input[name='sfTravelAgentOption']:checked").length>0){return true}jQuery("div[id^=ErrorTravelAgentHandling]").show();return false},InitializeCalendarControls:function(a){var b=Ecom.Application.language;if(b==null){b="nl"}jQuery.datepicker.setDefaults(jQuery.datepicker.regional[b]);jQuery("#sfb_SalesForceBookingFormPanel input[id^='sfb_TravelerBirthDate']").each(function(){jQuery(this).datepicker({maxDate:new Date(),changeYear:true,yearRange:"-100:+100"});jQuery(this).siblings().click(function(){jQuery(this).datepicker("show")})});jQuery("#sfb_SalesForceBookingFormPanel .jq_Date").each(function(){jQuery(this).datepicker({minDate:new Date(),defaultDate:a});jQuery(this).siblings().click(function(){jQuery(this).datepicker("show")})});if(a!=null){jQuery("#sfb_departureDate").datepicker("setDate",a)}},HandleResult:function(a){jQuery("#sfb_SalesForceBookingFormPanel").hide();jQuery("#sfb_submitpanel").show();if(a){jQuery("#sfb_submitsucceeded").show()}else{jQuery("#sfb_submitfailed").show()}jQuery("html, body").animate({scrollTop:0},"slow")},OnSubmitFinished:function(c,b,a){this.HandleResult(c)},OnSubmitFailed:function(){this.HandleResult(false)},OnSubmit:function(){var l=jQuery("#sfb_optAgree").is(":checked");if(!l){return}if(!this.ValidateFields("#sfb_SalesForceBookingFormPanel")|!this.ValidateGroups()|!this.ValidateDateField("#sfb_SalesForceBookingFormPanel","#sfb_TravelerBirthDate0",18,"ErrorAge")|!this.ValidateHandlingSection()){return}var h=new ThomasCook.Ecom.Core.PageComponents.Data.SalesForce.SalesForceBooking();var a=jQuery("#sfb_product").val();h.Reason=jQuery("#sfb_reason").val();h.Product=jQuery("#sfb_product").val();h.HotelCode=jQuery("#sfb_hotelCode").val();h.HolidayCountry=jQuery("#sfb_holidayCountry").val();h.NumberOfNights=jQuery("#sfb_numberOfNights").val();h.DepartureDate=this.GetFormattedCalendarDate("#sfb_departureDate");h.TravelAgentGuid=jQuery("#sfHandlingMethod input[name='sfTravelAgentOption']:checked").val();if(a!="DiscoveryAndWorldTour"&&a!="TicketOnly"){h.HolidayPlace=jQuery("#sfb_holidayPlace").val()}if(a=="Bus"||a=="TicketOnly"){h.ArrivalAirport=jQuery("#sfb_arrivalAirport").val()}if(a!="Car"&&a!="Bus"&&a!="Wintersport"&&a!="Bus"){h.DepartureAirport=jQuery("#sfb_departureAirport").val()}h.RoomOccupations=new Array();if(a!="TicketOnly"){var f=jQuery("#sfb_numberOfRooms").val();for(var d=0;d<f;d++){var c=new ThomasCook.Ecom.Core.PageComponents.Data.SalesForce.RoomOccupation();h.RoomOccupations[d]=c;var g=d+1;if(jQuery("#sfb_accoType"+g).length>0){c.AccoType=jQuery("#sfb_accoType"+g).val()}else{c.AccoType=jQuery("#sfb_accoType_select"+g).val()}c.HousingPrice=jQuery("#sfb_price"+g).text();c.HousingType=jQuery("#sfb_housingType"+g).val();c.NumberOfAdults=jQuery("#sfb_occupationAdults"+g).val()||0;c.NumberOfChildren=jQuery("#sfb_occupationChildren"+g).val()||0}}if(a=="DiscoveryAndWorldTour"){h.Excursions=jQuery("#sfb_excursions").val()}var k="";jQuery("#sfb_insurancechoices input[name='sfb_insurance']:checked").each(function(){if(k.length>0){k+=","}k+=jQuery(this).val()});h.Insurance=k;h.Passengers=new Array();for(var b=0;b<8;b++){var e=new ThomasCook.Ecom.Core.PageComponents.Data.SalesForce.Passenger();h.Passengers[b]=e;e.BirthDate=this.GetFormattedCalendarDate("#sfb_TravelerBirthDate"+b);e.Country=jQuery("#sfb_TravelerCountry"+b).val();e.FirstName=jQuery("#sfb_TravelerFirstName"+b).val();e.Gender=jQuery("#sfb_TravelerGender"+b).val();e.LastName=jQuery("#sfb_TravelerLastName"+b).val();e.Salutation=jQuery("#sfb_TravelerSalutation"+b).val()}h.Street=jQuery("#sfb_street").val();h.Number=jQuery("#sfb_number").val();h.Box=jQuery("#sfb_box").val();h.PostalCode=jQuery("#sfb_postalCode").val();h.City=jQuery("#sfb_city").val();h.Phone=jQuery("#sfb_phone").val();h.MobilePhone=jQuery("#sfb_mobilePhone").val();h.Email=jQuery("#sfb_email").val().toLowerCase();h.OptIn=jQuery("#sfb_optIn").is(":checked");h.AdditionalInformation=jQuery("#sfb_additionalComment").val();ThomasCook.Ecom.Web.SalesForce.SubmitBookingRequest(h,this.OnSubmitFinishedDelegate,this.OnSubmitFailedDelegate,null)},ValidateGroups:function(){if(!this.ValidateGroup("#sfb_SalesForceBookingFormPanel",".jq-group-phone",false)){jQuery("div[id^=ErrorPhoneGroup]").show();return false}return true},OnChooseNumberOfRooms:function(){var a=jQuery("#sfb_numberOfRooms").val();if(a=="1"){jQuery("#ch_sfb_acco2").hide()}else{jQuery("#ch_sfb_acco2").show()}},OnChooseProduct:function(){jQuery("#ch_sfb_holidayPlace").show();jQuery("#sfb_holidayPlace").addClass("jq-required");jQuery("#ch_sfb_departureAirport").show();jQuery("#ch_sfb_arrivalAirport").hide();jQuery("#ch_sfb_hotelCode").show();jQuery("#ch_sfb_numberOfRooms").show();jQuery("#ch_sfb_acco1").show();jQuery("#ch_sfb_insuranceGold").show();this.OnChooseNumberOfRooms();jQuery("#ch_sfb_label_arrivalDate").show();jQuery("#ch_sfb_label_departureDate").show();jQuery("#ch_sfb_label_departureAirport").show();jQuery("#ch_sfb_label_departurePlace").hide();jQuery("#ch_sfb_label_arrivalAirport").hide();jQuery("#ch_sfb_label_arrivalPlace").hide();jQuery("#ch_sfb_excursions").hide();jQuery("#ch_sfb_insuranceTransport").hide();var a=jQuery("#sfb_product").val();switch(a){case"Car":jQuery("#ch_sfb_departureAirport").hide();jQuery("#ch_sfb_label_departureDate").hide();jQuery("#ch_sfb_insuranceTransport").show();break;case"Bus":jQuery("#ch_sfb_label_departurePlace").show();jQuery("#ch_sfb_label_departureAirport").hide();jQuery("#ch_sfb_label_departureDate").hide();break;case"Wintersport":jQuery("#ch_sfb_departureAirport").hide();jQuery("#ch_sfb_label_departureDate").hide();jQuery("#ch_sfb_insuranceTransport").show();break;case"Flight":jQuery("#ch_sfb_label_arrivalDate").hide();jQuery("#ch_sfb_excursions").show();break;case"TicketOnly":jQuery("#ch_sfb_arrivalAirport").show();jQuery("#ch_sfb_label_arrivalAirport").show();jQuery("#ch_sfb_numberOfRooms").hide();jQuery("#ch_sfb_acco1").hide();jQuery("#ch_sfb_acco2").hide();jQuery("#ch_sfb_hotelCode").hide();jQuery("#ch_sfb_label_arrivalDate").hide();jQuery("#ch_sfb_holidayPlace").hide();jQuery("#sfb_holidayPlace").removeClass("jq-required");break;case"CityTrip":jQuery("#ch_sfb_label_departureDate").hide();jQuery("#ch_sfb_insuranceTransport").show();break;case"Exotics":jQuery("#ch_sfb_label_arrivalDate").hide();jQuery("#ch_sfb_excursions").show();break;case"Tour":jQuery("#ch_sfb_label_arrivalDate").hide();jQuery("#ch_sfb_excursions").show();break;case"DiscoveryAndWorldTour":jQuery("#ch_sfb_excursions").show();jQuery("#ch_sfb_excursions").show();jQuery("#ch_sfb_label_arrivalDate").hide();jQuery("#ch_sfb_hotelCode").hide();jQuery("#ch_sfb_holidayPlace").hide();jQuery("#sfb_holidayPlace").removeClass("jq-required");break;case"":jQuery("#ch_sfb_holidayPlace").hide();jQuery("#ch_sfb_departureAirport").hide();jQuery("#ch_sfb_hotelCode").hide();jQuery("#ch_sfb_acco1").hide();jQuery("#ch_sfb_acco2").hide();jQuery("#ch_sfb_numberOfRooms").hide();jQuery("#ch_sfb_label_arrivalDate").hide();break}},BackToDetail:function(){var a=$find("BookingDialog");if(a!=null){a.BackFromBookByEmail()}}};Ecom.SalesForce.Booking.registerClass("Ecom.SalesForce.Booking",Ecom.SalesForce.SalesForceForm);
