var VehiclesDetailSpecModel=function(){var n=this;n.isReady=ko.observable(!1);n.ShowVehicleAge=ko.observable(!1);n.VechicleAgeRange=ko.observable();n.SalesLine1=ko.observable();n.SalesLine2=ko.observable();n.hotDealSpec=new VehiclesDetailHotDealSpecModel},VehiclesDetailQuoteOptionsModel=function(n,t,i){var l=function(){var n=this;n.Id=0;n.Name=ko.observable();n.Cost=ko.observable(0);n.HireDays=ko.observable(0);n.MaxItems=ko.observable(0);n.IsDaily=ko.observable(!1);n.Qty=ko.observable(0);n.FreeQty=ko.observable(0);n.Charge=ko.computed(function(){var t=n.Cost()*(n.Qty()-n.FreeQty());return t=t>0?t:0,n.IsDaily()&&(t*=n.HireDays()),t})},r=this,u,f,e,o,s,h;r.isReady=ko.observable(!1);r.readOnly=ko.observable(!1);var a=function(n){var t=$.grep(n,function(n){return n.FlagIsCurrentSelected===!0});return t[0]},c=function(n){var u=t||__grServerVars.quoteInfo,i=u.DriverAgeGroupId,r;return i===0&&(r=a(n),r&&(i=r.InsuranceAgeGroup.InsuranceAgeGroupId)),i},v=function(){var n=0,i=t||__grServerVars.quoteInfo;return i.AdditionalDriversCost&&(n=parseFloat(i.AdditionalDriversCost)),n};r.AccessoryOptions=ko.observableArray([]);r.AccessoryOptionsWithQty=function(){var n=ko.toJS(r.AccessoryOptions);return $.grep(n,function(n){return n.Qty>0})};r.TotalAccessoryCost=ko.computed(function(){var n=0;return $.each(r.AccessoryOptions(),function(t,i){n+=i.Charge()}),n});r.TotalAccessoryCount=ko.computed(function(){var n=0;return $.each(r.AccessoryOptions(),function(t,i){n+=parseInt(i.Qty())}),n});r.MaxFreeAccessoryCount=ko.computed(function(){var n=0;return $.each(r.AccessoryOptions(),function(t,i){n+=i.FreeQty()}),n});r.VehicleDetailCurrentStep=ko.observable(__grServerVars.quoteInfo.VehicleDetailCurrentStep);r.updateAccessoryCost=function(n){var i=!1,u=[],f=t||__grServerVars.quoteInfo,e;$.each(n,function(n,t){var e=new l,s=t.DailyRate>0,o;r.AccessoryOptions().length>0&&(e=r.AccessoryOptions()[n]);e.Id=t.AccessoryId;e.Name(t.name);e.Cost(s?t.DailyRate:t.HireFeePerRental);e.HireDays(t.HireDays);e.MaxItems(t.TotalItems);e.IsDaily(s);e.FreeQty(t.FreeItemQty);f.AccessoryOptions&&(o=_.find(f.AccessoryOptions,function(n){return n.Name===t.name}),!o||((t.FreeItemQty>0&&o.FreeQty==0||t.FreeItemQty==0&&o.FreeQty>0)&&(o.FreeQty=o.Qty,i=!0),e.Qty(o.Qty)));u.push(e)});r.AccessoryOptions().length===0&&r.AccessoryOptions(u);i&&(e=r.buildQuoteInfo(),__grHelpers.services.saveQuoteInfo(e,function(){}))};r.buildAccessorySpinner=function(n){n.find("input.updown").each(function(){var n=$(this),t,i;n.hasClass("ui-spinner-input")||(t=parseInt(n.data("list-index"),10),i=r.AccessoryOptions()[t].MaxItems(),n.spinner({min:0,max:i,stop:function(){r.AccessoryOptions()[t].Qty($(this).spinner("value"))}}))})};o=v().toFixed(2);s=$("#drivers.replace.dynamic");r.ExtraDriver=ko.observable(o);s.selectBoxIt({dynamicPositioning:!0});h=s.data("selectBox-selectBoxIt");h&&h.selectOption(o);r.ExtraDriver.subscribe(function(){r.saveQuoteInfo()});r.ExtraDriverCount=ko.computed(function(){var n=1;return $("#drivers.replace option").length?$("#drivers.replace option").each(function(t,i){if($(i).val()===r.ExtraDriver()){n=t+1;return}}):n=__grServerVars.quoteInfo.DriversCount,n});r.MaxFreeExtraDriverCount=ko.observable(n.quoteBox().MaxFreeExtraDriver);r.ExtraDriverCostPerDriver=parseFloat($(':hidden[id$="hdnCostPerDrv"]').val());r.updateFreeDriverCost=function(n){var u=function(n,t){if(n.length>0)n.attr("data-text",n.data("text").replace(/\+\$[0-9]+/,t))},f=$("#drivers.replace.dynamic"),i=f.children("option"),t;if(i.length>0){for(n=n>i.length?i.length:n,r.MaxFreeExtraDriverCount(n),t=1;t<=n;t++)u($(i[t]),"FREE");for(t=n+1;t<i.length;t++){var e=$(i[t]),o=n*r.ExtraDriverCostPerDriver,s=parseFloat(e.val())-o;u(e,"+$"+s.toFixed(0))}f.data("selectBox-selectBoxIt").refresh()}else r.MaxFreeExtraDriverCount(n)};r.DriverAgeOptions=ko.observableArray([]);r.DriverAge=ko.observable();r.SelectedDriverAge=ko.computed(function(){if(r.DriverAge()){var n=$.grep(r.DriverAgeOptions(),function(n){return n.Id===parseInt(r.DriverAge(),10)});return n[0]}});r.SelectedDriverText=ko.computed(function(){var n=r.SelectedDriverAge();return n?n.Name:"??"});r.buildDriverAgeRadio=function(n){if(n===undefined)if(u)n=u.InsuranceInfoList;else return;var t=[];$.each(n,function(n,i){var u=i.InsuranceAgeGroup,f=$.grep(t,function(n){return n.Id===u.InsuranceAgeGroupId}),r;f.length===0&&(r={},r.Name=u.InsuranceAgeGroup1,r.Id=u.InsuranceAgeGroupId,t.push(r))});r.DriverAgeOptions(t)};r.InsuranceOptions=ko.observableArray([]);r.InsuranceOptionsReverse=ko.observableArray([]);r.AllInsuranceOptionsInfo=ko.observableArray([]);r.SelectedInsuranceId=ko.observable();r.SelectedInsurance=ko.computed(function(){if(r.SelectedInsuranceId()&&r.SelectedInsuranceId()!==0){var n=$.grep(r.InsuranceOptions(),function(n){return n.InsuranceType.InsuranceTypeId===parseInt(r.SelectedInsuranceId(),10)});return n[0]}});r.CheckInsurance=function(){(r.SelectedInsuranceId()===1||r.SelectedInsuranceId()==="1")&&$("#required-insurance").foundation("reveal","open")};r.SelectedInsuranceText=ko.computed(function(){var n=r.SelectedInsurance();return n?n.InsuranceType.Code==="STD"?"Basic":n.InsuranceType.InsuranceType1:"??"});r.TotalInsuranceCost=ko.computed(function(){if(r.SelectedInsuranceId()>0){var t=r.SelectedInsurance();if(t)return parseFloat(r.SelectedInsurance().WaiverFee*n.quoteBox().HirePeriodInDays)}return 0});r.IsValidInsurance=function(n,t){return!r.SelectedInsuranceId()||r.SelectedInsuranceId()===0?(__grHelpers.showMessage.selectInsurance(),t.stopPropagation(),!1):!0};r.HasSelectedInsurance=function(){return!r.SelectedInsuranceId()||r.SelectedInsuranceId()===0?!1:!0};r.SelectedInsuranceOptionFromUI=function(n){r.SelectedInsuranceId(n.InsuranceType.InsuranceTypeId)};r.GetRiskInfoOfInsurance=function(n){return n==="STD"?"MAXIMUM RISK":n==="CDW1"?"REDUCED RISK":n==="CDW2"?"ZERO RISK":void 0};r.IsAllInclusiveRate=function(){return!!n.quoteBox&&!!n.quoteBox()?n.quoteBox().AgentId>0&&n.quoteBox().PromotionHotDealID>0:!0};r.updateInsuranceCost=function(n){var i=t||__grServerVars.quoteInfo,e=c(n),o=$.grep(n,function(n){return n.InsuranceAgeGroup.InsuranceAgeGroupId===e}),u=$.grep(n,function(n){return n.InsuranceAgeGroup.InsuranceAgeGroupId===e}),f;u=u.reverse();r.InsuranceOptions(o);r.InsuranceOptionsReverse(u);f=0;i.InsuranceOption&&i.InsuranceOption.InsuranceTypeId>0&&(f=i.InsuranceOption.InsuranceTypeId);r.SelectedInsuranceId(f)};r.update=function(n){u=n;r.updateAccessoryCost(u.AccessoryInfoList);r.updateInsuranceCost(u.InsuranceInfoList);u.HotDealInfo?(r.updateFreeDriverCost(u.HotDealInfo.ExtraDriver),u.QuoteBox.AgentId>0&&r.SelectedInsuranceId(3)):r.updateFreeDriverCost(0);r.AllInsuranceOptionsInfo(u.InsuranceInfoPivotList)};r.hotDealQuoteOptions=new VehiclesDetailHotDealQuoteModel;r.initUI=function(n){f&&f.dispose();e&&e.dispose();r.buildDriverAgeRadio();r.buildAccessorySpinner(n);r.DriverAge(c(u.InsuranceInfoList));f=r.DriverAge.subscribe(function(){r.saveQuoteInfo(null,null,!1,function(){r.updateInsuranceCost(u.InsuranceInfoList)})});e=r.SelectedInsuranceId.subscribe(function(){r.saveQuoteInfo(null,null,!0,function(){r.updateInsuranceCost(u.InsuranceInfoList)})});r.detachDialog()};r.detachDialog=function(){$("div#quote-driver-age-content").length>0&&$("div#quote-driver-age-content").append($("div#driver-age").detach());$("div#quote-accessories-content").length>0&&$("div#quote-accessories-content").append($("div#quote-accessories").detach())};r.buildQuoteInfo=function(){var t={};return t.VehicleDetailCurrentStep=__grServerVars.quoteInfo.VehicleDetailCurrentStep,t.CarClass=n.carClass,t.DriverAgeGroupId=r.DriverAge(),t.AccessoryOptions=r.AccessoryOptionsWithQty(),t.InsuranceOption=r.SelectedInsurance()?ko.toJS(r.SelectedInsurance().InsuranceType):undefined,t.AdditionalDriversCost=r.ExtraDriver(),t.DriversCount=r.ExtraDriverCount(),u&&u.HireRateInfo&&(t.HireRate=u.HireRateInfo.RentalRate),u&&u.HotDealInfo&&u.HotDealInfo.DealType!="Promotion"&&(t.HotDealID=u.HotDealInfo.HotDealId),t};r.saveQuoteInfo=function(n,t,u,f){if(i)r.saveQuoteInfoCallback&&r.saveQuoteInfoCallback(t);else{var e=r.buildQuoteInfo();__grHelpers.services.saveQuoteInfo(e,function(n){var e=$.parseJSON(n.d),o,i;u||__grHelpers.showMessage.updateQuoteInfo(e.Success);e.Success&&(__grServerVars.quoteInfo=e.Result);t&&(o=$(t.target).closest(".reveal-modal").attr("id"),o&&$("#"+o).foundation("reveal","close"),i=$(t.target).closest(".popover"),i&&(i.slideUp(150),$("body").hasClass("mobile")&&!i.hasClass("form")&&(i.prev("fieldset").slideDown(150),setTimeout(function(){i.prev("fieldset").focus()},1))));r.saveQuoteInfoCallback&&r.saveQuoteInfoCallback(t);f&&f()})}}},VehiclesDetailQuoteModel=function(n){var t=this,i=$("#cal-replace"),f=i.not(".mobile #cal-replace"),e=$(".mobile #cal-replace");t.isReady=ko.observable(!1);t.hotDealQuote=new VehiclesDetailHotDealQuoteModel;t.soldOutPeriods=[];t.onRequestPeriods=[];var r=function(n){var u=$("#divVDQuote input.date-from").datepicker("getDate"),f=$("#divVDQuote input.date-to").datepicker("getDate"),r="",i;for(u&&n.getTime()===u.getTime()&&(r+=" selected-date-from"),f&&n.getTime()===f.getTime()&&(r+=" selected-date-to"),i=0;i<t.soldOutPeriods.length;i++)t.soldOutPeriods[i].getTime()===n.getTime()&&(r+=" sold-out");for(i=0;i<t.onRequestPeriods.length;i++)t.onRequestPeriods[i].getTime()===n.getTime()&&(r+=" on-request");return[!0,r]},o=function(){n.bookingStatus.unavailable()&&__grHelpers.services.getVehicleUnavailablePeriod(n.carClass,ko.toJSON(n.quoteBox()),function(n){i.each(function(){var n=$(this);n.datepicker()&&n.datepicker("destroy")});t.soldOutPeriods=[];t.onRequestPeriods=[];var u;$.each(n.SoldOut,function(n,i){for(u=moment.twix(moment(i.StartDate,__grConfig.app.dateFormat).toDate(),moment(i.EndDate,__grConfig.app.dateFormat).toDate()).iterate("days");u.hasNext();)t.soldOutPeriods.push(u.next().toDate())});$.each(n.OnRequest,function(n,i){for(u=moment.twix(moment(i.StartDate,__grConfig.app.dateFormat).toDate(),moment(i.EndDate,__grConfig.app.dateFormat).toDate()).iterate("days");u.hasNext();)t.onRequestPeriods.push(u.next().toDate())});f.datepicker({showOtherMonths:!0,dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],numberOfMonths:2,dateFormat:"dd-mm-yy",beforeShowDay:r});e.datepicker({showOtherMonths:!0,dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],dateFormat:"dd-mm-yy",numberOfMonths:1,beforeShowDay:r})})},u=function(n){return(parseFloat(t.BasePrice())+parseFloat(t.CostAirportConcession())+parseFloat(t.CostExtraDrv())+parseFloat(t.CostAccessory())+parseFloat(t.CostInsurance())+parseFloat(t.CostOneWay())+parseFloat(t.CostAirportPU())+parseFloat(t.CostAirportDO())+parseFloat(t.CostAllInclusive()))*n};t.DailyRate=ko.observable(0);t.BasePrice=ko.computed(function(){return t.DailyRate()*n.quoteBox().HirePeriodInDays});t.CostAirport=ko.observable(0..toFixed(__grConfig.app.decimalPlaces));t.CostExtraDrv=ko.computed(function(){var t=n.quoteOptions.ExtraDriver()-n.quoteOptions.MaxFreeExtraDriverCount()*n.quoteOptions.ExtraDriverCostPerDriver;return(t>0?t:0).toFixed(__grConfig.app.decimalPlaces)});t.FreeExtraDrvText=ko.computed(function(){return n.quoteOptions.MaxFreeExtraDriverCount()>0?"(FREE drivers incl.)":null});t.CostAccessory=ko.computed(function(){return n.quoteOptions.TotalAccessoryCost().toFixed(__grConfig.app.decimalPlaces)});t.FreeAccessoriesText=ko.computed(function(){return n.quoteOptions.MaxFreeAccessoryCount()>0?"(FREE accessories incl.)":null});t.CostInsurance=ko.computed(function(){return n.quoteOptions.TotalInsuranceCost().toFixed(__grConfig.app.decimalPlaces)});t.OneWayFee=ko.observable(0);t.AirportSurchargePU=ko.observable(0);t.AirportSurchargeDO=ko.observable(0);t.AirPortConcessionFee=ko.observable(0);t.AllInclusiveRate=ko.observable(0);t.ExchangeRate=ko.observable(1);t.CurrencySign=ko.observable("NZ$");t.CostOneWay=ko.computed(function(){return t.OneWayFee().toFixed(__grConfig.app.decimalPlaces)});t.CostAirportPU=ko.computed(function(){return t.AirportSurchargePU().toFixed(__grConfig.app.decimalPlaces)});t.CostAirportDO=ko.computed(function(){return t.AirportSurchargeDO().toFixed(__grConfig.app.decimalPlaces)});t.CostAirportConcession=ko.computed(function(){return t.AirPortConcessionFee().toFixed(__grConfig.app.decimalPlaces)});t.CostAllInclusive=ko.computed(function(){return(t.AllInclusiveRate()*n.quoteBox().HirePeriodInDays).toFixed(__grConfig.app.decimalPlaces)});t.TotalPrice=ko.computed(function(){return u(t.ExchangeRate())});t.TotalPriceNZD=ko.computed(function(){return u(1)});t.update=function(n){o(n)};t.updateCurrency=function(n,i){t.ExchangeRate(n);t.CurrencySign(i)}},VehiclesDetailHotDealSpecModel=function(){var n=this;n.HotDealNo=ko.observable();n.HotDealTitle=ko.observable();n.HotDealDesc=ko.observable();n.HotDealSummary=ko.observable()},VehiclesDetailHotDealQuoteModel=function(){var n=this;n.ConditionHeader=ko.observable();n.PUBranch=ko.observable();n.DOBranch=ko.observable();n.TravelStartDate=ko.observable();n.TravelEndDate=ko.observable();n.MinDays=ko.observable();n.MaxDays=ko.observable();n.DealsLeft=ko.observable();n.isValid=ko.observable(!1);n.hotDealErrorMessage=ko.observable();n.hotDealSecondaryErrorMessage=ko.observable();n.gotoVehiclePage=function(){__grHelpers.blockUI.block();__grHelpers.redirectTo.vehicles()};n.gotoHotDealPage=function(){__grHelpers.blockUI.block();__grHelpers.redirectTo.hotdeals()}},VehiclesDetailFooterButtonsModel=function(n){var t=this;t.hotDealFooter=new VehiclesDetailHotDealQuoteModel;t.shortlistCss=ko.observable("btn-white shortlist mobile-hide");t.shortlistSaved=ko.observable(!1);t.shortlistSaved.subscribe(function(n){t.shortlistCss(n?"btn-white shortlist tooltip mobile-hide saved":"btn-white shortlist tooltip mobile-hide");n&&$("footer.buttons a.shortlist").submitStart().submitEnd("Saved",!0)});t.toggleShortlist=function(i,r){var f=__grHelpers.cookie.getVisitor(),u=$(r.target);u.submitStart();__grHelpers.services.addShortlist(n.carClass,f,JSON.stringify(__grServerVars.quoteBox),JSON.stringify(__grServerVars.quoteInfo),function(n){if(__grHelpers.showMessage.addShortlistItem(n.Success),n.Success){var i=window.modelShortlist;i&&(i.availableShortlistIds.push(n.Result.ShortlistId),i.buildShortlist(function(){i.sortProvider.sortBy("saved")}));t.shortlistSaved(!0)}else u.submitEnd()})}},VehiclesDetailEmailEnquireModel=function(n,t,i){var r=this,u=function(t,i){var r=$(n+' select.form-list[data-list-type="'+i+'"]');return r.length?parseInt(t,10)===0?(r.each(function(){var n=$(this),i;n.next("span").children("span").addClass("error");n.closest("span").children("span").addClass("error");i=n.data("selectBox-selectBoxIt");i&&i.selectOption(t)}),!1):(r.each(function(){var n=$(this),i;n.next("span").children("span").removeClass("error");n.closest("span").children("span").removeClass("error");i=n.data("selectBox-selectBoxIt");i&&i.selectOption(t)}),!0):($('input[data-type="'+i+'"]').val(t).trigger("change"),!!t)},e=function(){var i,t,n;if(u(r.selectedCountry(),"country"),u(r.selectedPhoneCode(),"phone"),r.hasAdv()&&u(r.selectedAdv(),"adv"),ko.validation.group(r).showAllMessages(),i=ko.validation.group(r),t=i(),r.showPopUpErrorMessage()){for(n=t.length-1;n>=0;n--)r.showPopupErrorMsgForHirer(t[n]);koValid=!1}},f;r.showPopupErrorMsgForHirer=function(n){__grHelpers.showMessage.onlineCheckInErrorMsg(n)};r.ignoreCheckPhoneCode=function(){return $("#hidIgnorgeCheckPhoneCode")!=null&&$("#hidIgnorgeCheckPhoneCode").val()=="true"?!0:!1};f=function(n){n?$('select[name="job"]').next("span").children("span").removeClass("error"):$('select[name="job"]').next("span").children("span").removeClass("error").addClass("error")};r.firstName=ko.observable();r.lastName=ko.observable();r.email=ko.observable();r.repeatEmail=ko.observable();r.phone=ko.observable();r.mobile=ko.observable();r.selectedCountry=ko.observable();r.selectedPhoneCode=ko.observable();r.selectedAdv=ko.observable();r.message=ko.observable();r.street=ko.observable();r.state=ko.observable();r.city=ko.observable();r.postcode=ko.observable();r.workPhone=ko.observable();r.selectedJob=ko.observable();r.selectedJobTitle=ko.observable();r.selectedJob.subscribe(function(n){if(f(n),n){var t=$('select[name="job"] option[value="'+n.toString()+'"]').text();r.selectedJobTitle(t)}});t&&(r.firstName(t.BookingYourDetails_FirstName),r.lastName(t.BookingYourDetails_LastName),r.email(t.BookingYourDetails_Email),r.repeatEmail(t.BookingYourDetails_Email),r.selectedCountry(t.BookingYourDetails_CountryId),r.selectedAdv(t.BookingYourDetails_AdvId),r.message(t.BookingYourDetails_Messages),r.selectedPhoneCode(t.BookingYourDetails_PhoneCode),r.phone(t.BookingYourDetails_Phone),r.mobile(t.BookingYourDetails_Mobile),r.workPhone(t.BookingYourDetails_WorkPhone),r.street(t.BookingYourDetails_StreetNumber),r.city(t.BookingYourDetails_TownSuburb),r.state(t.BookingYourDetails_State),r.postcode(t.BookingYourDetails_PostCode));r.selectLicenseTransalateMsg=FormValidationMessages.IsEnglishLicence;r.countryValidationMsg=FormValidationMessages.country;r.phoneCodeValidationMsg=FormValidationMessages.phoneCode;r.advValidationMsg=FormValidationMessages.adv;r.subscribeFlag=ko.observable(!1);r.otherEmail=ko.observable();r.notes=ko.observable();r.useMobile=ko.observable(!1);r.useRepeatEmail=ko.observable(!1);r.hasBody=ko.observable(!0);r.hasAdv=ko.observable(!0);r.hasLicenseTransalate=ko.observable(!1);r.selectLicenseTransalate=ko.observable("");r.hasJobTitle=ko.observable(!1);r.hasUploadCV=ko.observable(!1);r.hasMessage=ko.observable(!1);r.showPopUpErrorMessage=ko.observable(!1);r.selectedCountryName=ko.computed(function(){var t=$(n+' select.form-list[data-list-type="country"]').find('option[value="'+r.selectedCountry()+'"]');return!t.length?$("input[data-type='countryName']").val():t.data("text")});r.hasLicenseTransalate=ko.computed(function(){var t=$(n+' select.form-list[data-list-type="country"]').find('option[value="'+r.selectedCountry()+'"]');return t.data("isenglishlicence")===undefined?!0:t.data("isenglishlicence")==="True"});r.selectedPhoneCodeText=ko.computed(function(){var t=$(n+' select.form-list[data-list-type="phone"]').find('option[value="'+r.selectedPhoneCode()+'"]');return t.data("selectedtext")?t.data("selectedtext"):(t=$(n+' select.form-list[data-list-type="phone"]').find('option[data-selectedtext="'+r.selectedPhoneCode()+'"]'),!!t.data("selectedtext"))?(r.selectedPhoneCode(t.val()),t.data("selectedtext")):$("input[data-type='phoneCode']").val()});r.selectedAdvName=ko.computed(function(){var t=$(n+' select.form-list[data-list-type="adv"]').find('option[value="'+r.selectedAdv()+'"]');return t.data("text")});r.isFormValid=function(){var n=parseInt(r.selectedCountry(),10)>0&&(r.ignoreCheckPhoneCode()||parseInt(r.selectedPhoneCode(),10)>0)&&(!r.hasAdv()||parseInt(r.selectedAdv(),10)>0)&&ko.validation.group(r)().length===0;if(r.onValidStatusChanged)r.onValidStatusChanged(n);return n};r.populatePhoneNumbers=function(){var t,n,i,u;r.ignoreCheckPhoneCode()||(t="",t=r.useMobile()?r.mobile():r.phone(),!t||typeof t=="undefined"||(n=t.split(" "),n.length==2&&n[0].indexOf("+")==0&&(i=r.getPhoneCodeIdByText(n[0]),r.useMobile()?r.mobile(n[1]):r.phone(n[1]),u=r.selectedCountry(),r.selectedPhoneCode(i),r.selectedCountry(u))))};r.getPhoneCodeIdByText=function(n){var t=$('select.form-list[data-list-type="phone"]').find('option[data-selectedtext="'+n+'"]');return t.val()};r.email.extend({required:{message:FormValidationMessages.email},email:{message:FormValidationMessages.emailValid}});r.repeatEmail.extend({required:{onlyIf:function(){return r.useRepeatEmail()},message:FormValidationMessages.repeatEmail},mustEqual:{onlyIf:function(){return r.useRepeatEmail()},params:{val:r.email},message:FormValidationMessages.repeatEmailMatch}});r.firstName.extend({required:{message:FormValidationMessages.firstName}});r.lastName.extend({required:{message:FormValidationMessages.lastName}});r.phone.extend({required:{onlyIf:function(){return!r.useMobile()},message:FormValidationMessages.phone},pattern:{onlyIf:function(){return!r.useMobile()},message:FormValidationMessages.phoneValid,params:r.ignoreCheckPhoneCode()?PatternsCustom.PhoneNumber:PatternsCustom.PhoneNumberWithoutCode},maxLength:25});r.mobile.extend({required:{onlyIf:function(){return r.useMobile()},message:FormValidationMessages.mobile},pattern:{onlyIf:function(){return r.useMobile()},message:FormValidationMessages.phoneValid,params:r.ignoreCheckPhoneCode()?PatternsCustom.PhoneNumber:PatternsCustom.PhoneNumberWithoutCode},maxLength:25});r.message($(n+' textarea[id$="txtMessage"]').val());r.message.extend({required:{onlyIf:function(){return r.hasBody()},message:"Message is required"}});r.selectedJob.extend({required:{onlyIf:function(){return r.hasJobTitle()},message:"Job Position is required"}});r.selectedCountry.subscribe(function(n){u(n,"country")});r.selectedPhoneCode.subscribe(function(n){u(n,"phone");u(n,"country")});r.selectedAdv.subscribe(function(n){u(n,"adv")});r.swapPhone=function(){r.useMobile(!r.useMobile());r.useMobile();r.populatePhoneNumbers()};$(n+" a[id$=btnSubmit]").on("click",function(n){var t=!1,i=!0;if($("input[name$='honeypot']").length>0&&(t=!0,t&&$("input[name$='honeypot']").val()>""&&(i=!1)),r.isFormValid()&&i)r.submit&&r.submit(n);else{if(e(),r.onValidationFailed)r.onValidationFailed(n);return n.preventDefault(),!1}});r.bind=function(){ko.applyBindings(r,$(n)[0]);$(n+" select.form-list").selectBoxIt({dynamicPositioning:!0})};r.mapToVB=function(){var t=ko.toJS(r);return{BookingYourDetails_FirstName:t.firstName,BookingYourDetails_LastName:t.lastName,BookingYourDetails_Email:t.email,BookingYourDetails_PhoneCode:t.selectedPhoneCode,BookingYourDetails_PhoneCodeText:t.selectedPhoneCodeText,BookingYourDetails_Phone:t.phone,BookingYourDetails_Mobile:t.mobile,BookingYourDetails_WorkPhone:t.workPhone,BookingYourDetails_StreetNumber:t.street,BookingYourDetails_TownSuburb:t.city,BookingYourDetails_State:t.state,BookingYourDetails_PostCode:t.postcode,BookingYourDetails_CountryName:t.selectedCountryName,BookingYourDetails_CountryId:t.selectedCountry,BookingYourDetails_FlightNumber:$(n+' input[id$="txtFlightNumber"]').val(),BookingYourDetails_AdvId:t.selectedAdv,BookingYourDetails_AdvName:t.selectedAdvName,BookingYourDetails_Messages:t.message,BookingYourDetails_Notes:$(n+' textarea[id$="txtNotes"]').val(),BookingYourDetails_SpecialEmailMe:t.subscribeFlag,BookingYourDetails_FriendEmails:$(n+' input[id$="txtOtherEmail"]').val()}};i||r.bind()},VehiclesDetailModel=function(n){var t=this,r,i;t.carClass=$(":hidden[id$=hdnClassCode]").val();t.hotDealID=$(":hidden[id$=hdnHotDealID]").val()||0;t.hotDealType=$(":hidden[id$=hdnDealType]").val();t.isHotDeal=t.hotDealType=="HotDeal"||t.hotDealType=="Relocation";t.quoteBox=ko.observable(n);t.vehicleStatus=ko.observable(VehicleInfoStatus.getQuote);t.showPromotionDiscountLine=ko.observable(!1);t.PromotionDiscountLine=ko.observable();t.ApplySoldOutTextForHotDeal=ko.observable(!1);t.showhideButtonsForPromotion=ko.observable(!0);t.SoldOutTitle=ko.observable("Sorry this vehicle is not available for your travel dates");t.VehicleDetailCurrentStep=ko.observable(__grServerVars.quoteInfo.VehicleDetailCurrentStep);var e=function(n){$("#vehicles-also .vehicles-alternative").each(function(){var i=$(this);i.empty().addClass("loading").showDefaultSpinner(!0).load(alternativeCarClassUrl+"?class="+n,function(){i.removeClass("loading");t.currencyUpdater.update()})})},o=function(n,i,r){var f=function(n){t.vehicleStatus(n.Status);t.PromotionDiscountLine(n.DiscountTextForPromotion);t.showhideButtonsForPromotion(!1);i.QuoteSaved?n.CarClassInfo.HotDealType==="Promotion"?t.showhideButtonsForPromotion(!1):t.showhideButtonsForPromotion(!0):t.showhideButtonsForPromotion(!1);t.vehicleSpecs.SalesLine1(n.CarClassInfo.SalesLine1);t.vehicleSpecs.SalesLine2(n.CarClassInfo.SalesLine2);t.vehicleSpecs.ShowVehicleAge(n.ShowVehicleAge);t.vehicleSpecs.VechicleAgeRange(n.VehicleAgeRange);t.hotDealID>0&&!!n.HotDealInfo&&(t.vehicleSpecs.hotDealSpec.HotDealNo(n.HotDealInfo.HotDealNo),t.vehicleSpecs.hotDealSpec.HotDealTitle(n.HotDealInfo.HotDealTitle),t.vehicleSpecs.hotDealSpec.HotDealDesc(n.HotDealInfo.TitleOnHomePage),t.vehicleSpecs.hotDealSpec.HotDealSummary(n.HotDealInfo.P1Text),t.quoteDetails.hotDealQuote.PUBranch(n.HotDealInfo.PUBranchName.replace(/,/g,", ")),n.HotDealInfo.DOSameAsPU?t.quoteDetails.hotDealQuote.DOBranch("Same as pickup location."):t.quoteDetails.hotDealQuote.DOBranch(n.HotDealInfo.DOBranchName.replace(/,/g,", ")),t.quoteDetails.hotDealQuote.MinDays(n.HotDealInfo.MinDays),t.quoteDetails.hotDealQuote.MaxDays(n.HotDealInfo.MaxDays),t.quoteDetails.hotDealQuote.TravelStartDate(moment(n.HotDealInfo.TravelPeriodStartDate).format("DD MMM YYYY")),t.quoteDetails.hotDealQuote.TravelEndDate(moment(n.HotDealInfo.TravelPeriodEndDate).format("DD MMM YYYY")),n.HotDealInfo.PromptUrgency==="ShowDayTimeLeft"?t.quoteDetails.hotDealQuote.DealsLeft(n.HotDealInfo.PromptUrgencyText):t.quoteDetails.hotDealQuote.DealsLeft(n.HotDealInfo.QtyAvailable-n.HotDealInfo.QtyBooked+" deals left"),n.HotDealInfo.isWebFleetForDays?n.WebFleet!=null&&n.WebFleet.SoldOutFlag&&t.ApplySoldOutTextForHotDeal(!0):t.ApplySoldOutTextForHotDeal(n.HotDealInfo.QtyAvailable-n.HotDealInfo.QtyBooked<=0),t.quoteOptions.hotDealQuoteOptions.isValid(n.CarClassInfo.isValidHotDeal),t.quoteDetails.hotDealQuote.isValid(n.CarClassInfo.isValidHotDeal),t.footerButtons.hotDealFooter.isValid(n.CarClassInfo.isValidHotDeal),n.HotDealInfo.DealType==="HotDeal"?($("#dealcorner").addClass("hot-deal-corner"),t.quoteDetails.hotDealQuote.ConditionHeader("Hot Deal Conditions"),t.SoldOutTitle("Sorry this Hot Deal is not available for your travel dates")):n.HotDealInfo.DealType==="ReloDeal"?($("#dealcorner").addClass("relo-deal-corner"),t.quoteDetails.hotDealQuote.ConditionHeader("Relo Deal Conditions"),t.SoldOutTitle("Sorry this Relo Deal is not available for your travel dates")):t.SoldOutTitle("Sorry this vehicle is not available for your travel dates"),t.quoteOptions.updateFreeDriverCost(n.HotDealInfo.ExtraDriver));t.quoteOptions.update(n);t.bookingStatus.sold()?$("article:first").addClass("sold-out"):$("article:first").removeClass("sold-out");t.quoteDetails.update(i);r&&r(n)},u;!i.QuoteSaved&&t.hotDealID>0?__grHelpers.services.getHotDealInfo(n,JSON.stringify(i),t.hotDealID,function(n){f(n)}):(u=t.hotDealID,i.PromotionCode!=""&&(u=i.PromotionHotDealID),__grHelpers.services.getVehicleInfo(n,JSON.stringify(i),u,__grHelpers.cookie.getVisitor(),function(n){n&&n.HireRateInfo&&(t.quoteDetails.DailyRate(__grHelpers.roundNumber(n.HireRateInfo.RentalRate)),t.quoteDetails.AirPortConcessionFee(__grHelpers.roundNumber(n.HireRateInfo.AirPortConcessionFee)),t.quoteDetails.OneWayFee(__grHelpers.roundNumber(n.OneWayFee)),t.quoteDetails.AirportSurchargePU(__grHelpers.roundNumber(n.WebFleet.AirportSurchargePU)),t.quoteDetails.AirportSurchargeDO(__grHelpers.roundNumber(n.WebFleet.AirportSurchargeDO)),t.quoteDetails.AllInclusiveRate(__grHelpers.roundNumber(n.HireRateInfo.AllInclusiveRate)));f(n)}))},s=function(n){if(!n)return!1;var t="#quote-"+n.toLowerCase();return $(".popover").hide(),$(t).slideDown(150,function(){$.scrollTo(this)}),!1},u=function(n,u){var f=i.mapToVB(),e,o;n==="quote"&&(f=r.mapToVB());e=function(n,t){u.submitEnd();n.Success?($(t+" div.form").load(__grConfig.app.webRoot+"Templates/PopupEmailSentConfirm.html"),__grHelpers.services.saveBookingYourDetails(f,function(n){var t=$.parseJSON(n.d);t.Success&&(__grServerVars.bookingYourDetails=f)})):__grHelpers.showMessage.sendEmail(!1)};u.submitStart();o={bookingDetails:f,quoteBox:__grServerVars.quoteBox,quoteInfo:t.quoteOptions.buildQuoteInfo(),OnlineAdvertisingSource:getOnlineAdvertisingSourceFromHiddenField(),SplitTestValue:GetSplitTestValueFromHiddenField()};n==="quote"?__grHelpers.services.vehicleDetailsEmailQuote(JSON.stringify(o),function(n){e(n,"#quote-email")}):n==="enquire"&&__grHelpers.services.vehicleDetailsEmailEnquire(JSON.stringify(o),function(n){e(n,"#quote-enquire")})},f=function(n){var u=function(n){t.quoteOptions.hotDealQuoteOptions.isValid(n);t.quoteDetails.hotDealQuote.isValid(n);t.footerButtons.hotDealFooter.isValid(n)},f=function(n,i){var u="";return n==="invalid"&&(u="Oops! Sorry your rental itinerary could not be accepted. Your itinerary does not meet the "+r(i.HotDealInfo.DealType)+" conditions below. "),n==="no itinerary"&&(u="Oops! Please enter your itinerary to book this Hot Deal"),n==="soldout"?(u="Oops!  The itinerary you entered does not match the terms of this "+r(i.HotDealInfo.DealType),$("article:first").addClass("sold-out"),t.ApplySoldOutTextForHotDeal(!0)):n==="removesoldout"&&(t.ApplySoldOutTextForHotDeal(!1),$("article:first").removeClass("sold-out")),n==="leaddays"&&(u="Oops!  Sorry your rental itinerary could not be accepted, because the leading days needs to be at least "+i.HotDealInfo.LeadDays+" days from today for this "+r(i.HotDealInfo.DealType)+". "),n==="mindays"&&(u="Oops! Sorry your rental itinerary could not be accepted. Your hire period does not meet the minimum day’s requirement to book this "+r(i.HotDealInfo.DealType)+". Please see the "+r(i.HotDealInfo.DealType)+" conditions below. "),n==="maxdays"&&(u="Oops! Sorry your rental itinerary could not be accepted. Your hire period exceeds the maximum day’s requirement to book this "+r(i.HotDealInfo.DealType)+". Please see the "+r(i.HotDealInfo.DealType)+" conditions below. "),n==="oneway"&&(u="Oops!   Sorry your rental itinerary could not be accepted. Drop off place needs to be in the same city of the pick up place."),n==="pu-location"&&(u="Oops! Sorry your rental itinerary could not be accepted. Your pick up location does not meet the terms of this "+r(i.HotDealInfo.DealType)+". Please see the "+r(i.HotDealInfo.DealType)+" conditions below. "),n==="do-location"&&(u="Oops! Sorry your rental itinerary could not be accepted. Your drop off location does not meet the terms of this "+r(i.HotDealInfo.DealType)+". Please see the "+r(i.HotDealInfo.DealType)+" conditions below. "),n==="pu-travelstartdate"&&(u="Oops!   Sorry your rental itinerary could not be accepted. Your pick up date does not meet the terms of this "+r(i.HotDealInfo.DealType)+". Please see the "+r(i.HotDealInfo.DealType)+" conditions below. "),n==="pu-travelenddate"&&(u="Oops!   Sorry your rental itinerary could not be accepted. Your pick up date does not meet the terms of this "+r(i.HotDealInfo.DealType)+". Please see the "+r(i.HotDealInfo.DealType)+" conditions below. "),n==="do-travelenddate"&&(u="Oops!   Sorry your rental itinerary could not be accepted. Your drop off date does not meet the terms of this "+r(i.HotDealInfo.DealType)+". Please see the "+r(i.HotDealInfo.DealType)+" conditions below. "),u},e=function(n,t){var i="";return n==="invalid"&&(i="Please change your itinerary to match this Deal conditions"),n==="no itinerary"&&(i="Please change your itinerary to match this Deal conditions"),n==="soldout"?i="Please change your itinerary to match this  "+r(t.HotDealInfo.DealType)+"’s available dates.":n==="removesoldout"&&(i=""),n==="leaddays"&&(i="Please change the dates in the search box and try again"),n==="mindays"&&(i="Please change the dates in the search box and try again"),n==="maxdays"&&(i="If you would like to hire more than the maximum days, please give us a call."),n==="oneway"&&(i=" Please change the pick up or drop off place and try again"),n==="pu-location"&&(i=" Please change the pick up place and try again"),n==="do-location"&&(i="Please change the drop off place and try again"),n==="pu-travelstartdate"&&(i=" Please change the dates and try again"),n==="pu-travelenddate"&&(i=" Please change the dates and try again"),n==="do-travelenddate"&&(i=" Please change the dates and try again"),i},i=function(n,i){t.quoteOptions.hotDealQuoteOptions.hotDealErrorMessage(f(n,i));t.quoteDetails.hotDealQuote.hotDealErrorMessage(f(n,i));t.footerButtons.hotDealFooter.hotDealErrorMessage(f(n,i));t.quoteOptions.hotDealQuoteOptions.hotDealSecondaryErrorMessage(e(n,i));t.quoteDetails.hotDealQuote.hotDealSecondaryErrorMessage(e(n,i));t.footerButtons.hotDealFooter.hotDealSecondaryErrorMessage(e(n,i))},o=function(n,t){var i=!1,u=n.split(" "),r;return(t==="Same as pickup location"||t==="")&&(t=n),r=t.split(" "),t!=="Same as pickup location"?u[0]===r[0]&&(i=!0):i=!0,i},s=function(n,t){for(var r=!1,u=t.split(","),i=0;i<u.length;i++)n==parseInt(u[i])&&(r=!0);return r},h=function(n,t,i){var f=!1,u=t.split(","),r;if(n>0)for(r=0;r<u.length;r++)n==parseInt(u[r])&&(f=!0);else for(r=0;r<u.length;r++)i==parseInt(u[r])&&(f=!0);return f},c=function(n,t){var r=!1,u=t.split(","),i;if(n>0)for(i=0;i<u.length;i++)n==parseInt(u[i])&&(r=!0);else r=!0;return r},l=function(n,t){return moment(t,__grConfig.app.dateFormat).diff(moment(n,__grConfig.app.dateFormat),"days")},a=function(n){var t=moment(n,__grConfig.app.dateFormat).diff(moment(moment(),__grConfig.app.dateFormat),"days");return t+1},v=function(n,t){var i=!0;return moment(n,__grConfig.app.dateFormat).isAfter(moment(t,__grConfig.app.dateFormat).toDate())||moment(n,__grConfig.app.dateFormat).isSame(moment(t,__grConfig.app.dateFormat).toDate())||(i=!1),i},y=function(n,t){var i=!0;return moment(n,__grConfig.app.dateFormat).isBefore(moment(t,__grConfig.app.dateFormat).toDate())||(i=!1),i},p=function(n,t){var i=!0;return moment(n,__grConfig.app.dateFormat).isBefore(moment(t,__grConfig.app.dateFormat).toDate())||moment(n,__grConfig.app.dateFormat).isSame(moment(t,__grConfig.app.dateFormat).toDate())||(i=!1),i},w=function(n){var t=!0;return n.PickupDate||n.DropoffDate||n.PickupDeliveryName||(t=!1),t},r=function(n){var t="";return n==="HotDeal"?t="Hot Deal":n==="Relocation"&&(t="Relo Deal"),t};__grHelpers.services.getHotDealInfo(t.carClass,modelHDDQuote.toCleanJSON(),t.hotDealID,function(r){var b=r.CarClassInfo.isValidHotDeal,e=ko.toJS(modelHDDQuote),f=!0,d;if(w(e)){var tt=a(e.PickupDate),g=l(e.PickupDate,e.DropoffDate),ot=moment(r.HotDealInfo.TravelPeriodStartDate).format("DD-MM-YYYY"),it=moment(r.HotDealInfo.TravelPeriodEndDate).format("DD-MM-YYYY"),rt=v(e.PickupDate,ot),ut=y(e.PickupDate,it),ft=p(e.DropoffDate,it),k=s(e.PickupBranchId,r.HotDealInfo.PUBranchId),et=h(e.DropoffBranchId,r.HotDealInfo.DOBranchId,e.PickupBranchId),nt=c(e.DropoffBranchId,r.HotDealInfo.DOBranchId);b?(d=r.HotDealInfo.QtyAvailable-r.HotDealInfo.QtyBooked,f&&(r.HotDealInfo.isWebFleetForDays==!1&&d<=0||r.HotDealInfo.isWebFleetForDays==!0&&r.WebFleet!=null&&r.WebFleet.SoldOutFlag)?i("soldout",r):i("removesoldout",r),f&&tt<r.HotDealInfo.LeadDays&&(f=!1,i("leaddays",r)),f&&g<r.HotDealInfo.MinDays&&(f=!1,i("mindays",r)),f&&g>r.HotDealInfo.MaxDays&&(f=!1,i("maxdays",r)),r.HotDealInfo.DOSameAsPU&&f&&(k||nt||(f=!1,i("invalid",r)),f&&!k&&(f=!1,i("pu-location",r)),f&&!nt?(f=!1,i("do-location",r)):f&&!o(e.PickupDeliveryName,e.DropOffDeliveryName)&&(f=!1,i("oneway",r))),r.HotDealInfo.DOSameAsPU||f&&!k&&(f=!1,i("pu-location",r)),r.HotDealInfo.DOSameAsPU||f&&!et&&(f=!1,i("do-location",r)),f&&!rt&&(i("pu-travelstartdate",r),f=!1),f&&!ut&&(i("pu-travelenddate",r),f=!1),f&&!ft&&(i("do-travelenddate",r),f=!1)):(t.quoteOptions.hotDealQuoteOptions.isValid(r.CarClassInfo.isValidHotDeal),t.quoteDetails.hotDealQuote.isValid(r.CarClassInfo.isValidHotDeal),t.footerButtons.hotDealFooter.isValid(r.CarClassInfo.isValidHotDeal),d=r.HotDealInfo.QtyAvailable-r.HotDealInfo.QtyBooked,f&&(r.HotDealInfo.isWebFleetForDays==!0&&r.WebFleet!=null&&r.WebFleet.SoldOutFlag||r.HotDealInfo.isWebFleetForDays==!1&&d<=0)?i("soldout",r):i("removesoldout",r),f&&tt<r.HotDealInfo.LeadDays&&(f=!1,i("leaddays",r)),f&&g<r.HotDealInfo.MinDays&&(i("mindays",r),f=!1),f&&g>r.HotDealInfo.MaxDays&&(i("maxdays",r),f=!1),r.HotDealInfo.DOSameAsPU&&f&&(k||nt||(f=!1,i("invalid",r)),f&&!k&&(f=!1,i("pu-location",r)),f&&!nt?(f=!1,i("do-location",r)):f&&!o(e.PickupDeliveryName,e.DropOffDeliveryName)&&(f=!1,i("oneway",r))),r.HotDealInfo.DOSameAsPU||f&&!k&&(f=!1,i("pu-location",r)),r.HotDealInfo.DOSameAsPU||f&&!et&&(f=!1,i("do-location",r)),f&&!rt&&(i("pu-travelstartdate",r),f=!1),f&&!ut&&(i("pu-travelenddate",r),f=!1),f&&!ft&&(i("do-travelenddate",r),f=!1))}else u(!1),b=!1,f=!1,i("no itinerary",r);!r.HotDealInfo||r.HotDealInfo.DealType!=="HotDeal"?!r.HotDealInfo||r.HotDealInfo.DealType!=="Relocation"||($("#dealcorner").addClass("relo-deal-corner"),t.quoteDetails.hotDealQuote.ConditionHeader("Relo Deal Conditions")):($("#dealcorner").addClass("hot-deal-corner"),t.quoteDetails.hotDealQuote.ConditionHeader("Hot Deal Conditions"));!b&&f&&(f=!1,u(!1),b=!1,i("invalid",r));u(f);b=f;n&&n(b)})};t.bookingStatus={none:ko.computed(function(){return t.vehicleStatus()===VehicleInfoStatus.none||t.vehicleStatus()===VehicleInfoStatus.getQuote}),quoted:ko.computed(function(){return t.vehicleStatus()===VehicleInfoStatus.quoted||t.vehicleStatus()===VehicleInfoStatus.hotDeal||t.vehicleStatus()===VehicleInfoStatus.relocation||t.vehicleStatus()===VehicleInfoStatus.promotion}),request:ko.computed(function(){return t.vehicleStatus()===VehicleInfoStatus.onRequest}),sold:ko.computed(function(){return t.vehicleStatus()===VehicleInfoStatus.soldOut||t.ApplySoldOutTextForHotDeal()})};t.bookingStatus.pending=ko.computed(function(){return t.bookingStatus.quoted()||t.bookingStatus.request()});t.bookingStatus.unavailable=ko.computed(function(){return t.bookingStatus.sold()||t.bookingStatus.request()});t.vehicleSpecs=new VehiclesDetailSpecModel;t.quoteOptions=new VehiclesDetailQuoteOptionsModel(t);t.footerButtons=new VehiclesDetailFooterButtonsModel(t);t.quoteDetails=new VehiclesDetailQuoteModel(t);r=new VehiclesDetailEmailEnquireModel("#quote-email",__grServerVars.bookingYourDetails);r.populatePhoneNumbers();r.submit=function(n){return u("quote",$(n.target)),n.preventDefault(),!1};i=new VehiclesDetailEmailEnquireModel("#quote-enquire",__grServerVars.bookingYourDetails);i.hasMessage(!0);i.populatePhoneNumbers();i.submit=function(n){return u("enquire",$(n.target)),n.preventDefault(),!1};t.update=function(n,i){t.quoteBox(n);e(t.carClass);o(t.carClass,n,i)};t.applyBindings=function(){var r=$(":hidden[id$=hdnShowMode]").val(),i;r.toLowerCase()!=="availability"&&s(r);i=new CurrencyBoxModel;t.currencyUpdater=new CurrencyUpdateModel(i);i.onCurrencyChanged=function(){t.currencyUpdater.update()};t.quoteDetails.currencyBox=i;t.update(n,function(i){if(ko.applyBindings(t.footerButtons,$("footer.buttons")[0]),ko.applyBindings(t.quoteOptions,$("div.quote-options")[0]),ko.applyBindings(t.quoteDetails,$("div#hotDealInfo")[0]),ko.applyBindings(t.quoteDetails,$("div#step1Header1OnNormalDeal")[0]),!$("aside.vehicle-specs")[0]||ko.applyBindings(t.vehicleSpecs,$("aside.vehicle-specs")[0]),ko.applyBindings(t.quoteDetails,$("div.quotes")[0]),n.QuoteSaved&&t.quoteOptions.initUI($("div.quote-options")),t.quoteOptions.isReady(!0),t.quoteDetails.isReady(!0),t.vehicleSpecs.isReady(!0),$(".loading-panel").showDefaultSpinner(!1),t.footerButtons.shortlistSaved(i.FlagIsShortlisted||!1),t.isHotDeal&&(f(),modelHDDQuote.onValidationPassed=function(n){var t=function(t){modelHDDQuote.serverValidationAndSave(t,n)};f(t)}),r.toLowerCase()==="availability"&&($("#cal-avail").show(),$("#check-avail").hide()),__grServerVars.quoteBox!=null&&__grServerVars.quoteBox.QuoteSaved&&i.CarClassInfo.isValidHotDeal){var u=$("#divHDDQuote div.itin-container");u.find("select#time-picker1").selectBoxIt_set(__grServerVars.quoteBox.PickupTime);u.find("select#time-picker2").selectBoxIt_set(__grServerVars.quoteBox.DropoffTime);t.bookingStatus.request()||t.bookingStatus.sold()?quoteSection("step2-error"):t.VehicleDetailCurrentStep()=="step5"?quoteSection("step5"):quoteSection("step2")}else quoteSection("step1");$(":hidden[id$=hdnShowMode]").val()=="enquire"?$("#quote-enquire").foundation("reveal","open"):$(":hidden[id$=hdnShowMode]").val()=="email"&&$("#quote-email").foundation("reveal","open")})};t.bookNow=function(n,i){t.quoteOptions.saveQuoteInfo(null,null,!0,function(){var n=$(i.target);n.submitStart();__grHelpers.redirectTo.yourDetails()})}},GetSplitTestValueFromHiddenField=function(){return $(':hidden[id$="hdSplitTestValue"]').val()}