(function(n,t){"use strict";function i(t,i){var u,r;t!=null&&(u=t.fileName!=null?t.fileName:document.location,i==null&&t.stack!=null&&(i=t.stack),r=t.message!=null?t.name+": "+t.message:t,r+=": at document path '"+u+"'.",i!=null&&(r+="\n  at "+i),n.ajax({type:"POST",global:!1,url:n.ALZ.GetApplicationRoot()+"/Access/Account/LogJSError",data:{message:encodeURI(r)}}))}n(function(){var i=n("form")[0],r=i&&n.data(i,"validator"),t=r&&r.settings;t&&(t.ignore=t.ignore+", .ignore")});n.fn.extend({limit:function(i,r){function e(){var f=n(u).val(),t=f.length;t>i&&(n(u).val(n(u).val().substring(0,i)),n(r).show());t==i?n(r).show():n(r).hide()}var f,u=n(this);n(this).focus(function(){f=t.setInterval(e,100)});n(this).blur(function(){clearInterval(f);e()})}});t.onerror=function(r,u,f){i(r,arguments[4].stack);try{n.ALZ.ShowDialog("overlay-UnknownError")}catch(e){t.console&&t.console.log&&t.console.log("Error raised: "+r+" on line "+f+" for "+u);t.alert(":( We are very sorry. An error has occurred or your session has timed out. Please try again later.")}};n(document).ajaxError(function(t,r,u){!r||r.status===0||r.readyState===0||(i("Ajax call error. Server message: "+r.responseText+"\nAjax details: "+JSON.stringify({url:u.url,type:u.type,data:u.data})),n.ALZ.ShowDialog())});n.ALZ===undefined&&(n.ALZ={ALZ_MIN_DATE:"01/01/0001",DROPDOWN_PLEASE_SELECT:"-- Please select --",PAGE_ONE_ID:"#page1",DISABLE_OPACITY_VALUE:.1,RESET_OPACITY:1,DISPLAY_DELAY_TIME:300,MakeJQueryId:function(n){if(!n)throw new Error("id cannot resolve to false");if(n instanceof jQuery)return n;var t=n.charAt(0)!=="#"?"#"+n:n;return t.replace(".","_")},IsViewedInMobile:function(){return navigator?/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent):!1},IsNorthernIreland:function(){return n("#IsNorthernIreland[type=hidden]").val()==="True"},GetCurrencySymbol:function(t){return(t=t||n.ALZ.IsNorthernIreland()||!1,t)?"£":"€"},IsEmptyField:function(t){return n.trim(n(t).val()).length===0},IsMinDate:function(t){return n.trim(n(t).val())===n.ALZ.ALZ_MIN_DATE},ClearMinDate:function(t){n.ALZ.IsMinDate(t)&&n(t).val("")},FormatDateOnly:function(n){return n.replace(" 00:00:00","")},RestrictMaxCharacters:function(t,i){n(t).attr("maxlength",i)},AlphaNumericOnly:function(t){n(t).keydown(function(n){var t=n.which||n.keyCode;return!n.shiftKey&&!n.altKey&&!n.ctrlKey&&t>=48&&t<=57||t>=96&&t<=105||t===8||t===9||t===13||t===35||t===36||t===37||t===39||t===46||t===45||t===32||t===107||t>=65&&t<=90||t>=97&&t<=105?!0:!1})},NumericOnly:function(t){n(t).keydown(function(n){var t=n.which||n.keyCode;return t===9||t===8||t>=35&&t<=40?!0:!n.shiftKey&&!n.altKey&&!n.ctrlKey&&(t>=48&&t<=57||t>=96&&t<=105||t===13||t===46||t===45)?!0:t===33||t===34||n.ctrlKey&&(t===35||t===36)?!0:!1})},NoSpaces:function(t){n(t).keydown(function(n){var t=n.which||n.keyCode;return t===32?!1:!0})},PhoneOnly:function(t){n(t).keydown(function(n){var t=n.which||n.keyCode;return t===9||t===8||t>=35&&t<=40?!0:!n.shiftKey&&!n.altKey&&!n.ctrlKey&&(t>=48&&t<=57||t>=96&&t<=105||t===13||t===46||t===45||t===32||t===107)?!0:n.shiftKey&&t===61||t===33||t===34||n.ctrlKey&&(t===35||t===36)?!0:!1})},DisableNotAllowedKeysInSpecialInputs:function(t){var i=t||n("input[type='numeric'], input[type='tel'], input[type='email']","#page0, #page1, #page2, #page4");n.ALZ.NumericOnly("input[type='number']",i);n.ALZ.NoSpaces("input[type='email']",i);n.ALZ.PhoneOnly("input[type='tel']",i)},ConvertToCurrency:function(n,t){var i=n.toString(),r=i.length;return r>3?this.GetCurrencySymbol(t)+i.substring(0,r-3)+","+i.substring(r-3,r):this.GetCurrencySymbol(t)+i},GetApplicationRoot:function(){return n.ALZ.AddressConfiguration.ApplicationRoot||""},GetSessionTimeOut:function(){return n.ALZ.SessionTimeOut},GetLoginUrl:function(){return n.ALZ.LoginUrl},DisableButton:function(t,i,r,u){var f,o,e,s,h=n.ALZ;if(f=r?n(t,r):n(t),o=f.prop("tagName"),o==="DIV")e=f,s=n("button, input[type=button]",e);else if(o==="BUTTON"||o==="INPUT")e=f.closest("div"),s=f;else throw new Error("This selector is not of the correct type.");i?(u||s.prop("disabled",!1),e.animate({opacity:h.RESET_OPACITY},h.DISPLAY_DELAY_TIME)):(u||s.prop("disabled",!0),e.stop().animate({opacity:h.DISABLE_OPACITY_VALUE},h.DISPLAY_DELAY_TIME))},DisableButtonsWhenSubmit:function(){n(function(){var r=n("form"),t=n("button[type=submit].primary, input[type=submit].primary"),i=function(r){var u=this.form;r.preventDefault();n.ALZ.DisableButton(this);n(u).valid()?(setTimeout(function(){t.each(function(){t.one("click",i);n(this).is(":disabled")&&n.ALZ.DisableButton(this,!0)})},3e4),u.submit()):(n.ALZ.DisableButton(this,!0),n.ALZ.FocusFirstError())};r.on("invalid-form.validate",function(){t.each(function(){n.ALZ.DisableButton(this,!0)})});t.click(i)})},AddOptionsToDropdown:function(t,i,r,u,f,e,o){function h(t,i,r){if(i===undefined)return"<option value=''>"+t+"<\/option>";if(r===undefined||r===null)return"<option value='"+i+"'>"+t+"<\/option>";var u="";return n.each(r,function(n,t){u+=" data-"+n+" = '"+t+"' "}),"<option value='"+i+"'"+u+">"+t+"<\/option>"}var s="";f=f||"Value";e=e||"Text";u&&(s=h(u));i&&i!=null?n.each(i,function(){s+=h(this[e],this[f],this.DataAttributes)}):o&&(s+=h(o));r&&(s+=h(r));t.html(s)},GetSelectedValueFromDropdown:function(t){return t=n.ALZ.MakeJQueryId(t),n("option:selected",t).val()},GetSelectedValueFromDropdownWithComposedValue:function(t){var i=n.ALZ.GetSelectedValueFromDropdown(t);return i.substring(i.indexOf("|")+1)},SelectOptionInDropdownWithComposedValue:function(t,i){t=n.ALZ.MakeJQueryId(t);n("option[value $= '|"+i+"']",t).prop("selected",!0)},ToggleCheckboxes:function(t){var i;t=t||".toggleCheckbox";i=n(t);i.click(function(t){var r=n(this),i=n("input[type=checkbox]",r),u=n(t.target).is(":checkbox");u||(i.is(":checked")?i.prop("checked",!1):i.prop("checked",!0));i.is(":checked")?r.prev("div.alertmsg").hide():r.prev("div.alertmsg").show()})},ValidateMandatoryCheckboxes:function(t){var i,r,u=!0;return t=t||".mandatoryCheckbox",i=n(t),r=n("input[type=checkbox]",i).filter(":visible").not(".ignore"),r.each(function(){this.checked?n(this).closest("DIV").prev("div.alertmsg").hide():(u=!1,n(this).closest("DIV").prev("div.alertmsg").show())}),u},ShowDialog:function(t){var i;if(t=t||"#overlay-domainError",i=n(n.ALZ.MakeJQueryId(t)),i.length<1)throw new Error("The generic error message div doesn't exist in the page.");return i.overlay({top:"center",mask:{color:"#003781",loadSpeed:400,opacity:.6},closeOnClick:!0}),i.data("overlay").load(),!0},DisplayDomainError:function(t,i){var r=n(n.ALZ.MakeJQueryId(t)),u=n(n.ALZ.MakeJQueryId(i));if(r.length>0&&u.length>0)r.val().toLowerCase()==="true"&&n.ALZ.ShowDialog();else throw new Error("Make sure that there is a hidden field tag for each domain error; e.g.: #IsDomainError");},GetSelectedValueFromRadioButton:function(t,i){return i=i?n.ALZ.MakeJQueryId(i):n("form")[0],n("input[name='"+t+"']",i).filter(":radio:checked").val()},DropdownsCallbackSuccess:function(t){return function(i){var r=n(t);r.empty();parseInt(r[0].Value,10)>-1&&r.append("<option value = ''>"+n.ALZ.DROPDOWN_PLEASE_SELECT+"<\/option>");n.each(i,function(t,i){r.append(n("<option><\/option>").val(i.Value).html(i.Text))})}},GetDropdownSubscribe:function(i,r,u){var f=n.ALZ.GetApplicationRoot(),e=n.ALZ.DropdownsCallbackSuccess(i);n.getJSON(f+r,u(),e).error(function(){t.location.href=f+"/Error/IndexAjax"})},MakeUserFriendlyRadioButtons:function(){n("label > input[type='radio']","span.radiobtn").closest("span.radiobtn").click(function(){var t=n("label > input[type='radio']",this).filter(":first");t.prop("checked")||(t.prop("checked",!0),t.trigger("click",null),t.trigger("change",null),t.is(":visible")&&t.valid());t.trigger("focus",null)})},ShowIfRadioYes:function(t,i){var r=n("input[type='radio'][name='"+t+"']");n.each(r,function(){this.selectorToShow=i});r.on("ALZ.RedisplayDependants",null,null,function(t){var i=t.target;n.ALZ.RedisplayByRadio(i)});r.click(function(){n(this).trigger("ALZ.RedisplayDependants")})},Focus:function(t){var i=n(t),r=i.is(":checkbox")?90:20;i.length&&(n("html, body").animate({scrollTop:i.offset().top-r},750),i.focus())},FocusNextInput:function(t){n(t).closest("div.formitem").nextAll().filter(":visible").filter(":first").find(".forminput:visible").filter(":first").children().filter(":first").focus()},FocusNextWhenTab:function(t){var i=t.keyCode||t.which;i!==9||t.shiftKey||n.ALZ.FocusNextInput(this)},FocusFirstError:function(){n.ALZ.FocusFirstInputWithAnError()},RedisplayByRadio:function(t){if(t.selectorToShow){var i=n(t);i.val().toLowerCase()==="true"?n(t.selectorToShow).show():n(t.selectorToShow).hide()}},RedisplayByDropdown:function(t){var i=t.selectorToShow,r=t.conditionFunction,u;i&&r&&(u=n("option",t).filter(":selected").val(),r(u)?n(i).removeClass("initialstatehidden").show():n(i).hide())},ShowIfDropdownWith:function(t,i,r){var f,u;if(typeof r!="function"&&(f=r,r=function(n){return n===f}),t=n.ALZ.MakeJQueryId(t),u=n(t),u.length>0){u[0].conditionFunction=r;u[0].selectorToShow=i;this.MarkAsHavingDependants(u);u.on("ALZ.RedisplayDependants",null,null,function(t){var i=t.target;n.ALZ.RedisplayByDropdown(i)});u.on("change",null,u[0],function(t){var i=t.target;n(i).trigger("ALZ.RedisplayDependants")})}},MarkAsHavingDependants:function(t){n(t).addClass("hasDependants")},RedisplayDependants:function(){n("input[type='radio']").filter(":checked").each(function(){n(this).trigger("ALZ.RedisplayDependants")});n("select.hasDependants").each(function(){n(this).trigger("ALZ.RedisplayDependants")})},FocusFirstInputWithAnError:function(){var t=n(".invalid, .input-validation-error, #page0, #page1, #page2, #page3, #page4").filter(":visible:first");t.length&&n.ALZ.Focus(t)},GetQueryStringValueByName:function(n){var r="[\\?&]"+n+"=([^&#]*)",u=new RegExp(r),i=u.exec(t.location.href);return i===null?"":decodeURIComponent(i[1].replace(/\+/g," "))},ConfigureValidators:function(){var i=n("form"),t,r;i.length>0&&(t=n.data(i[0],"validator").settings,r=t.errorPlacement,t.errorPlacement=function(t,i){r(t,i);t.text()?n(i).is("select")?n(i).parent().addClass("invaliddropdown"):n(i).is("input[type='radio']")&&n(i).closest("div.forminput").addClass("invalidradiobutton"):n(i).is("select")?n(i).parent().removeClass("invaliddropdown"):n(i).is("input[type='radio']")&&n(i).closest("div.forminput").removeClass("invalidradiobutton")})},DisableCallablePhoneNumbersIfNotInMobile:function(){var i;!n.ALZ.IsViewedInMobile()&&n(t).width()>=800&&(i=n("a.callable"),i.css("cursor","default"),i.click(function(n){n.preventDefault()}))}});n.validator.unobtrusive.adapters.add("mandatory",function(n){n.rules.required=!0;n.message&&(n.messages.required=n.message)});n.validator.unobtrusive.adapters.addBool("mandatory","required");n.validator.addMethod("date",function(n,t){var r,i=n.match(/([0-9]+)/gi);return i?(r=i[1]+"/"+i[0]+"/"+i[2],this.optional(t)||!/Invalid|NaN/.test(new Date(r))):this.optional(t)||!1},"Please enter a date in the format dd/mm/yyyy");n.cachedScript=function(t,i){return i=n.extend(i||{},{dataType:"script",cache:!0,url:t}),jQuery.ajax(i)};Function.prototype.trace=function(){for(var t=[],n=this;n;)t.push(n.signature()),n=n.caller;return t};Function.prototype.signature=function(){var t={name:this.getName(),params:[],toString:function(){var n=this.params.length>0?"'"+this.params.join("', '")+"'":"";return this.name+"("+n+")"}},n;if(this.arguments)for(n=0;n<this.arguments.length;n++)t.params.push(this.arguments[n]);return t};Function.prototype.getName=function(){if(this.name)return this.name;var n=this.toString().split("\n")[0],t=/^function ([^\s(]+).+/;return t.test(n)?n.split("\n")[0].replace(t,"$1")||"anonymous":"anonymous"}})(jQuery,window);$(function(){"use strict";function u(n){$(n).click(function(n){$(this).hasClass("hrefRequired")||n.preventDefault()})}function e(t){return t.closest(n)}function t(n,t){return e(n).children(t)}function a(n){e(n).removeClass("active");i()}function o(n){t(n,"p.title").removeClass("rc-saved")}function v(n){t(n,"p.title").addClass("rc-saved")}function y(n){t(n,"div").find(".rc-request").show()}function s(n){t(n,"div").find(".rc-request").hide()}function h(n){t(n,"div").find(".rc-form").show()}function p(n){t(n,"div").find(".rc-form").hide()}function w(){$(".rc-submit-general").show()}function b(){$(".rc-submit-general").hide();$("#rc-submit-box-01").hide()}function k(){$(n).on("click"," .rc-save-btn",function(){var n=$(this);n.hasClass("invalid")||(v(n),p(n),y(n),i())})}function d(){$(n).on("click"," .rc-edit-btn",function(){var n=$(this);o(n);s(n);h(n);i()})}function g(){$(n).on("click"," .rc-cancel-btn",function(){var n=$(this);s(n);h(n);o(n);a(n);i()})}function i(n){b();!n&&tt()>0&&nt()+(n?1:-1)<=0&&w()}function nt(){return $(".rc-save-btn").length-$(".rc-save-btn:hidden").length}function tt(){return $(".rc-saved").length}function r(n,t){$("input[name="+n+"]").change(function(){var n=$(this).val();n=="Yes"?$("#"+t).show():$("#"+t).hide()})}function it(n,t){$.get(n,function(n){$("#"+t).html(n);$("form").removeData("validator");$.validator.unobtrusive.parse("form")})}var n,c,l,f;$.ALZ.DisableCallablePhoneNumbersIfNotInMobile();$.validator.addMethod("caseinsensitiveequalto",function(n,t,i){return n.toLowerCase()===$("#"+i.field).val().toLowerCase()},"Both field must match.");$.validator.unobtrusive.adapters.add("caseinsensitiveequalto",["field"],function(n){n.rules.caseinsensitiveequalto=n.params;n.message&&(n.messages.caseinsensitiveequalto=n.message)});$(".sessionlogout").click(function(n){$("#logoutForm").length>0&&(n.preventDefault(),n.stopImmediatePropagation(),$("#browesaway").prop("href",$(this).attr("href")),$("#confirm-browse").foundation("reveal","open"))});$("#browesaway").click(function(){var n=$(this);return window.open(n.attr("href"),n.attr("target")),$("#logoutForm").submit(),!1});$(window).on("hashchange",function(){var n=window.location.hash.substring(1);n!==""&&n.match("^message-")&&window.location.reload()});n=".rc-accordion-sections";k(n);d(n);g(n);u("#rc-forms a");c=$("#IsClaimExists").val();c=="False"&&$("#claimsdoesntexist").foundation("reveal","open");l=$("#IsDocumentExists").val();l=="False"&&$("#documentdoesntexist").foundation("reveal","open");$("#DirectDebitOk").val()!==undefined&&$("#DirectDebitOk").val().toLowerCase()==="true"&&$("#payment-success-directDebit").foundation("reveal","open");$("#CreditCardOk").val()!==undefined&&$("#CreditCardOk").val().toLowerCase()==="true"&&$("#payment-success-creditCard").foundation("reveal","open");$("#isDirectDebitFailure").val()!==undefined&&$("#isDirectDebitFailure").val().toLowerCase()==="true"&&$("#payment-failure-directDebit").foundation("reveal","open");$("#isMobileChangeNotAllowed").val()!==undefined&&$("#isMobileChangeNotAllowed").val().toLowerCase()==="true"&&$("#mobile-change-cancelled").foundation("reveal","open");$(".rc-common-link").on("click",function(n){i($(n.currentTarget.parentElement).next().is(":hidden"))});$(document).on("click",".close-btn",function(){$(this).hide();$(this).parent().hide()});$("#nav-inbox").click(function(){$(this).removeClass("notification")});f=".tabs-buttons";u(f+" a");$(f+" dd").click(function(){var t=$(this),i=t.children().attr("event-data"),n=$("#"+i);n.show();n.siblings(".tabs-content").hide()});$("#pay-alert-trigger").click(function(){$("#pay-alert").toggle()});u(".star-rater a");$(".star-rater a").click(function(){for(var t=$(this),i=t.attr("event-data"),n=1;n<=5;n++)i>=n?$(".star-"+n).addClass("star-icn-blue"):$(".star-"+n).removeClass("star-icn-blue")});$(".inboxmessageunread").click(function(){$(this).closest(".rc-accordion-sections").attr("style","color: black")});$(n).on("click",".rc-ppc-y",function(){var n=$(this);n.closest(".rc-form").find(".rc-pcc-content-02").hide();n.closest(".rc-form").find(".rc-pcc-content-01").show()});$(n).on("click",".rc-ppc-n",function(){var n=$(this);n.closest(".rc-form").find(".rc-pcc-content-01").hide();n.closest(".rc-form").find(".rc-pcc-content-02").show()});$("#rcAddPet").click(function(n){n.preventDefault();$("#terms-conditions").foundation("reveal","open")});$("#next").click(function(n){n.preventDefault();$("#AcceptTermsandConditions").is(":checked")?($("#checkboxNotSelectedErrorMessage").hide(),$("#terms-conditions").foundation("reveal","close"),$("#validaddpetlink")[0].click()):$("#checkboxNotSelectedErrorMessage").show()});$(".date-picker-01").pickadate();$(".time-picker-01").pickatime();$("#claimsoption").change(function(){var n=$("#claimsoption option:selected").val();n=="01"?($("#userActions").show(),$("#accident").show(),$("#theft").hide(),$("#windscreen").hide(),$("#topButtons").show(),$("#bottomButtons").show()):n=="02"?($("#accident").hide(),$("#theft").show(),$("#windscreen").hide(),$("#userActions").show(),$("#topButtons").show(),$("#bottomButtons").show()):n=="03"?($("#accident").hide(),$("#theft").hide(),$("#windscreen").show(),$("#userActions").show()):($("#accident").hide(),$("#theft").hide(),$("#windscreen").hide(),$("#userActions").hide(),$("#topButtons").hide(),$("#bottomButtons").hide())});r("ThirdParty","ThirdPartyDetails");r("Passengers","PassengerDetails");r("Garda","GradaDetails");r("Witness","WitnessDetails");$(document).on("click",".uploadDialogLink",function(){var t=$(this).attr("data-upload-link"),n=$(this).attr("data-reveal-id");$("#"+n).html("");setTimeout(it(t,n),500)});$("body").on("submit","form",function(){var n=$(this);if(n.valid&&n.valid())return $(":submit",n).attr("disabled",!0),!0});$("#ConfirmSubmit, #confirmSubmit").on("click",function(){$(this).attr("disabled",!0)});$("#OTHER_Request_Details").length!=0&&$("#OTHER_Request_Details").rules("add",{required:!0,messages:{required:$("#OTHER_Request_Details").attr("data-val-required")}});$(".attestation").on("click",function(){$(".ispolicyattested").val($(this).val()==="Yes")})}),function(n,t,i){function f(){return r?r:[]}function e(n){r=n}function u(){var r=i.getElementsByTagName("form")[0],n;r&&(n=f(),n&&n.length>0&&t.sitracker.trackFormData(r,n))}function o(n,r){function f(){var n;if(t.IJentoProductRoot===undefined)throw new Error("iJento product root is not setup. Add: 'window.IJentoProductRoot' to the page.");return n=t.IJentoProductRoot,n=n.charAt(0)==="/"?n:"/"+n,console.log(n),n}var u;r!=undefined&&(u=i.getElementById(r));u===undefined&&(u=i.getElementsByTagName("form")[0]);n=n.charAt(0)==="/"?n:"/"+n;t.sitracker=new SITEINTEL.SiteTracker(!1);t.sitracker.trackPage(f()+n);u&&t.sitracker.activeTrackForm(u)}var r;n||(t.ALZ={},n=t.ALZ);n.Tracking={SetTrackingFormFieldsToCapture:e,GetTrackingFormFieldsToCapture:f,ResetTracking:o,Track:function(n,t,i){t&&e(t);o(n,i);console.log(n)},TrackFormData:u,TrackLink:function(n){return u(),t.sitracker&&t.sitracker.trackLink(n),!0},TrackExternalLink:function(n){return u(),t.sitracker&&t.sitracker.trackExternalLink(n),!0}}}(window.jQuery&&window.jQuery.ALZ||window.ALZ,window,document)