var _sailingSchedules,_mobSrvcUrl,_apiUrl;if(typeof Pom=="undefined"&&(window.Pom={}),typeof window.Pom.Booking=="undefined"&&(Pom.Booking=function(){var n=function(n,t,i){var r=JSON.stringify({monthYear:t,route:n});AjaxLib.Async(_mobSrvcUrl,"GetActiveBookings",r,function(n){return i(n)})},t=function(t,i,r){n(t,i,function(n){var t,i,u;return n.Ok==!0&&n.Res!=null&&(t=n.Res,t.webFR8Search!=null&&t.webFR8Search.searchResponse!=null&&(i=t.webFR8Search.searchResponse,i.response!=null&&i.response[0].result=="SUCCESS"&&(u=i.response[0].booking,u!=null)))?r(u[0]):r(null)})},i=function(){$("#BookHistoryDate").datepicker({maxDate:new Date,dateFormat:"dd-MM-yy"}).datepicker("setDate",new Date);$("#BookHistoryDateIcon").on("click",function(n){n.preventDefault();$("#BookHistoryDate").datepicker("show")});$("#BookHistoryApplyBtn").on("click",function(n){var r,i,t,u;if(n.preventDefault(),r=$("#BookHistoryRoute").val(),t=$("#BookHistoryDate").datepicker("getDate"),t!==null){t instanceof Date;var f=t.getDate(),e=t.getMonth(),o=t.getFullYear();i=moment({year:o,month:e,day:f});i=moment.utc(i).local().format("YYYY-MM-DD")}u="/PastBookings?date="+i+"&route="+r+"";window.location.href=u});var n=$("#SelVal").data("sel-route"),t=$("#SelVal").data("sel-date");n!=null&&n!=""&&$("#BookHistoryRoute").val(n);t!=null&&t!=""&&$("#BookHistoryDate").datepicker("setDate",new Date(t))},r=function(){$("#ActiveBookingDate").datepicker({maxDate:new Date,dateFormat:"dd-MM-yy"}).datepicker("setDate",new Date);$("#ActiveBookingDateIcon").on("click",function(n){n.preventDefault();$("#ActiveBookingDate").datepicker("show")});$("#ActiveBookingApplyBtn").on("click",function(n){var r,i,t,u;if(n.preventDefault(),r=$("#ActiveBookingRoute").val(),t=$("#ActiveBookingDate").datepicker("getDate"),t!==null){t instanceof Date;var f=t.getDate(),e=t.getMonth(),o=t.getFullYear();i=moment({year:o,month:e,day:f});i=moment.utc(i).local().format("YYYY-MM-DD")}u="/ActiveBookings?date="+i+"&route="+r+"";window.location.href=u});var n=$("#SelVal").data("sel-route"),t=$("#SelVal").data("sel-date");n!=null&&n!=""&&$("#ActiveBookingRoute").val(n);t!=null&&t!=""&&$("#ActiveBookingDate").datepicker("setDate",new Date(t))},u=function(n){var u=JSON.stringify({}),i=_mobSrvcUrl,t="GetPreviousTransaction",r;typeof t!==undefined&&t!=""&&t!=null&&(i=i+"/"+t);r=$.ajax({"async":!0,type:"POST",url:i,data:u,headers:null,contentType:"application/json; charset=utf-8",dataType:"json",success:function(t){var i=t.d,r;if(i.Ok==!0&&i.Res!=null)return r=i.Res,n(r)},error:function(n){n.responseText!="undefined"&&n.responseText!=null&&n.responseText!=""},failure:function(n){n.responseText!="undefined"&&n.responseText!=null&&n.responseText!=""}});$(window).on("beforeunload",function(){r.abort()})};return{GetUpcomingBooking:function(n,i,r){t(n,i,r)},InitPastBooking:function(){i()},InitActiveBooking:function(){r()},GetPreviousTransaction:function(n){u(n)}}}()),typeof Pom=="undefined"&&(window.Pom={}),typeof window.Pom.BookNowNew=="undefined"){var _mobSrvcUrl="/Srvcs/FreightWeb/FreightMobileSrvc.asmx",_apiUrl="/api/WebApiV2",numberPattern=/^\d+$/,numberWithTwoDecimalPattern=/^\s*(?=.*[1-9])\d*(?:\.\d{1,2})?\s*$/,vehicleLengthPattern=new RegExp("^[0-9]+([.,][0-9]{1})?$"),initialAdultPassengers=3,initialChildrenPassengers=0,totalAllowedPassengers=3,depPortCode="",arrivalPortCode="",currencyCode="",vehRegNo="",vehLength="",vehHeight="",vehWidth="",noOfAdults="",noOfChildren=0,vehicleMinLength=1,vehicleMaxLength=22,vehicleMaxHeight=4.5,vehicleMaxWidth=2.5,distinctAddressData=[],isEditFlow=!1,dropDownValues=[],schesdulesArray=[];Pom.BookNowNew=function(){function c(n,t){for(let u=0;u=i?!0:!1},"Invalid length");$("#BookNowFormThree").validate({rules:{passengerAdults:{required:!0}},errorElement:"em",errorPlacement:function(n,t){n.addClass("invalid-feedback");t.prop("type")==="checkbox"?n.insertAfter(t.next("label")):n.insertAfter(t)},highlight:function(n){$(n).addClass("is-invalid").removeClass("is-valid")},unhighlight:function(n){$(n).addClass("is-valid").removeClass("is-invalid")}});jQuery.validator.addMethod("isOpenForBooking",function(){var n=$("#route").val();return n=="DVR-CQF"||n=="CQF-DVR"?!0:(n=="LAR-CYN"?$("#ScheduleErrorMessageText_0").html(t.lacaBookingInventoryErrorMessage).text():n=="CYN-LAR"&&$("#ScheduleErrorMessageText_0").html(t.calaBookingInventoryErrorMessage).text(),rt("0")?($("#ScheduleErrorMessage_0").hasClass("hideme")||$("#ScheduleErrorMessage_0").addClass("hideme"),!0):($("#ScheduleErrorMessage_0").removeClass("hideme"),!1))})},k=function(n,t){var u,f,i,e;r(n);Pom.Home.GetPreviousTransaction(function(n){n==!0&&($("#PrevTransDiv").removeClass("hideme"),$("#booking").removeClass("col-lg-6"),$("#booking").removeClass("offset-lg-3"),$("#booking").addClass("col-lg-5"))});$("#route").on("change",function(n){n.preventDefault();var i=$("#route").val(),r=i.split("-"),u=r[0];d(t);i=="DVR-CQF"||i=="CQF-DVR"?($("#TravelDateTimeDiv").hide(),$("#JourneyTypeDiv").show(),$(".ccPageWarningMessage").show()):($("#TravelDateTimeDiv").show(),$("#JourneyTypeDiv").hide(),$(".ccPageWarningMessage").hide(),g())});u=Cookies.get("POBookRoute");typeof u!="undefined"&&u!=null&&u!=""&&($("#route").val(u),$("#route").trigger("change"));f=Cookies.get("POBookPassenger");typeof f!="undefined"&&f!=null&&f!=""&&$("#passengerAdults").val(f);i=Cookies.get("POIsReturnTrip");typeof i!="undefined"&&i!=null&&i!=""&&(i=="true"||i==!0?$("input:radio[name=journeytype]")[1].checked=!0:$("input:radio[name=journeytype]")[0].checked=!0);var o=$("#route").val(),s=o.split("-"),h=s[0];$("#StepOneContinue").on("click",function(n){n.preventDefault();dt()});$("#noPetsBackBtn").on("click",function(n){n.preventDefault();$("#booking").show();$("#nopets-det").hide()});$("#noDangerousGoodsBackBtn").on("click",function(n){n.preventDefault();$("#booking").show();$("#nodangerousgoods-det").hide()});$("#passengerAdults").change(function(){var n=$(this).val();$("#totalPassenger").html(n)});$("#BookNowHelp").on("click",function(n){n.preventDefault();$("#booknowHelpModal").modal("show")});$("#goods").on("change",function(n){n.preventDefault();var t=$(this).is(":checked");t==!0?$("#goodsCheckBoxTxt").html("yes"):$("#goodsCheckBoxTxt").html("No")});$("#pets").on("change",function(n){n.preventDefault();var t=$(this).is(":checked");t==!0?$("#petsCheckBoxTxt").html("yes"):$("#petsCheckBoxTxt").html("No")});ut();e=Cookies.get("PODefCurrecny");e!=null&&e!=""&&$("#UserDefCurrency").val(e)},d=function(n){$("#scSelectDate").val("");$("#SelectSailing_0").empty();$("#SelectSailing_0").append($("