jQuery.extend(jQuery.validator.messages,{digits:"Please use only digits."});jQuery.validator.setDefaults({highlight:function(n,t,i){n.type==="radio"||n.type==="checkbox"?this.findByName(n.name).addClass(t).removeClass(i):n.type==="select-one"?($(n).addClass(t).removeClass(i),$(n).prev(".display").addClass(t).removeClass(i)):$(n).addClass(t).removeClass(i)},unhighlight:function(n,t,i){n.type==="radio"||n.type==="checkbox"?this.findByName(n.name).removeClass(t).addClass(i):n.type==="select-one"?($(n).removeClass(t).addClass(i),$(n).prev(".display").removeClass(t).addClass(i)):$(n).removeClass(t).addClass(i)}}),function(n){var i={autoTabGroups:!0},r,t={init:function(n){return this.each(function(){t.ExtendProperties(n);t.setDefaultSelects.apply(this);t.PrepopulateForm.apply(this);t.BindEvents.apply(this)})},ExtendProperties:function(t){n.extend(!0,i,t)},PrepopulateForm:function(){n(document).ready(function(){n.each(n(this).find(":input[type='text'], :input[type='tel']"),function(n,i){t.KeyUp.apply(i)})})},BindEvents:function(){var i=n(this).find(":input[type!='submit']");i.closest("div").addClass("inactive");i.closest(".group").addClass("inactive");i.bind("focus",t.Focus).bind("blur",t.Blur).bind("change keyup",t.KeyUp);n(".group :input[type!='submit']:not(:last)",this).bind("keyup",t.AutoTab);n(this).find("select").bind("change",t.SelectChange)},AutoTab:function(t){n(this).val().length==n(this).attr("size")&&t.keyCode!=9&&t.keyCode!=16&&n(this).closest("div").next().find(":input")[0].focus()},Focus:function(){n("div",n(this).closest("form")).removeClass("active");n(this).closest("div").addClass("active").removeClass("inactive").closest(".group").addClass("active").removeClass("inactive");n(this).closest(".multiErrors").length!=0&&(element=n(this).closest(".group"),element.length==0&&(element=n(this).closest("div")),n(element).find(".errorMessage").show());r=this},Blur:function(r){triggerObj=this;n(this).closest("div").removeClass("active").addClass("inactive").closest(".group").removeClass("active").addClass("inactive");n(this).closest(".multiErrors").length!=0&&(element=n(this).closest(".group"),element.length==0&&(element=n(this).closest("div")),n(element).find(".errorMessage").hide(),i.blurValidation&&setTimeout(function(){t.Validate.apply(triggerObj,[r])},1))},KeyUp:function(){n(this).val()!=null&&n(this).val().length>0?n(this).parent().addClass("hideLabel"):n(this).parent().removeClass("hideLabel")},SelectChange:function(){var t=n(this),r=t.val(),u=t.find("option[value='"+r+"']").text(),i=t.closest(".dropdown");i.find(".placeholder").text()!=n(":selected",n(this)).text()&&i.find(".placeholder").text(n(":selected",n(this)).text())},setDefaultSelects:function(){n(this).find("select").each(function(){t.SelectChange.apply(this)})}};n.fn.UX=function(i){if(t[i])return t[i].apply(this,Array.prototype.slice.call(arguments,1));if(typeof i!="object"&&i)n.error("Method "+i+" does not exist on jQuery.Validate");else return t.init.apply(this,arguments)}}(jQuery);$(document).ready(function(){function t(n,t){try{var i=new CustomEvent("quote-start-error",{errorDetail:t});n.dispatchEvent(i)}catch(r){}}function i(t){$(t).addClass("form-disabled");$(t).find(":submit").data("pause-qs","Y");setTimeout(function(){n(t)},1e4)}function n(n){setTimeout(function(){$(n).removeClass("form-disabled");$(n).find(":submit").data("pause-qs","")},1e3)}function r(n,t){try{var i={},r=$(n).data("page-position");return r&&(i.pgPosition=r),i.channelType="DI",u(t,i),i}catch(f){return{}}}function u(n,t){try{if("AU,BT,C,MC,H,MH,RV,R,SW,SM,AU+HO,AU+RT,AU+CO".indexOf(n)===-1)return;t.handshakeGUID=getUuidv4Guid()}catch(i){}}function f(n,t){if(!t.handshakeGUID||n.toLowerCase().indexOf("quotestartid")!==-1)return n;var i=n.indexOf("?")===-1?"?":"&";return n+i+"quoteStartID="+t.handshakeGUID}function e(n){try{window.monetateQ=window.monetateQ||[];window.monetateQ.push(["trackEvent",["QuoteStart","QuoteStart"+n]]);window.monetateQ.push(["trackData"])}catch(t){}}$("form.quoteStartForm").each(function(){$(this).UX().validate({rules:{ZipCode:{minlength:5,maxlength:5,digits:!0}},errorPlacement:function(n,t){var i=t.closest(".group");i.length>0?n.appendTo(i):n.insertAfter(t);t.hasClass("hiddenError")&&n.addClass("noPointer")},errorElement:"span",submitHandler:function(u){var l=this,s={},h,o,c,a;if($($(u).serializeArray()).each(function(){s[this.name]=this.value}),s.Product=s.Product.toUpperCase(),/^MC~/.test(s.Product)&&(s.Product="MC"),/^BT~/.test(s.Product)&&(s.Product="BT"),h=s.Product.replace(/\s*\+*/g,""),o=r(u,s.Product),_gaObj.GATrackEvent("progCom","QuoteStart-Attempt",h,0,!1,o),$(u).find(":submit").data("pause-qs")==="Y")return!1;try{c=loadingOptions.defaultOption(u)}catch(v){}return o.milestoneName="Quote Handshake",o.milestoneStatus="StartAttempt",typeof _gaObj!="undefined"&&_gaObj instanceof Object&&_gaObj.GATrackEvent("progCom","QuoteStart-ApiCall",h,0,!1,o),i(u),a=(new Date).getTime(),$.ajax({url:$(u).attr("action"),type:"POST",data:JSON.stringify(s),dataType:"json",contentType:"application/json; charset=utf-8",retryCount:1,tryCount:0,error:function(i,r,f){if(n(u),typeof c=="function")try{c.call()}catch(l){}try{t(u,{});var e="",s=(new Date).getTime()-a;e+="status="+i.status;e+=";jqError="+r;e+=";serverError="+f;e+=";Time Taken(ms)="+s;HandleException({errorCode:15043,errorMessage:e,errorCategory:"Ajax",errorType:"qtestart",sevlvl:"Error"})}catch(v){}try{o.milestoneName="Quote Handshake";o.milestoneStatus="StartFailure";typeof _gaObj!="undefined"&&_gaObj instanceof Object&&_gaObj.GATrackEvent("progCom","QuoteStart-Failed",h,(new Date).getTime(),!1,o)}catch(v){}},success:function(i){if(typeof c=="function")try{c.call()}catch(a){}if(i.ResponseType=="Success")e(h),typeof _gaObj!="undefined"&&_gaObj instanceof Object&&typeof dataLayer!="undefined"?(i.RedirectUrl=f(i.RedirectUrl,o),o.milestoneName="Quote Handshake",o.milestoneStatus="Start",_gaObj.GATrackEvent("progCom","QuoteStart",h,0,!1,o),setTimeout(function(){i.RedirectUrl.indexOf(".quoteasi.")!==-1?_gaObj.GARedirect(i.RedirectUrl):window.location=i.RedirectUrl},200)):window.location=i.RedirectUrl;else if(i.RedirectUrl)window.location=i.RedirectUrl;else{var r={},s="";i.ResponseType=="ZipNotFound"&&$.extend(r,{ZipCode:"Please enter the ZIP code where you live."});i.ResponseType=="MobileHomeNotOfferedError"&&$.extend(r,{ZipCode:"Mobile home insurance isn't available through Progressive in your area yet."});i.ResponseType=="HomeOwnersNotOfferedError"&&$.extend(r,{ZipCode:"Homeowners insurance isn't available through Progressive in your area yet."});i.ResponseType=="CommercialAutoNotOfferedError"&&$.extend(r,{ZipCode:"Commercial Auto insurance isn't available through Progressive in your area yet."});i.ResponseType=="DuckCreekAppDisabled"&&$.extend(r,{ZipCode:"We can't complete this quote online.  Please give us a call at 1-888-892-5420."});i.ResponseType=="BoldPenguinApiError"&&$.extend(r,{ZipCode:"We're sorry.  Something went wrong. Please call Progressive at <a href=tel://+18556409310>1-855-640-9310<\/a>."});typeof i.Field.ZipCode!="undefined"&&i.Field.ZipCode.Status!="valid"&&$.extend(r,{ZipCode:"Please enter the ZIP code where you live."});typeof i.Field.Product!="undefined"&&i.Field.Product.Status!="valid"&&$.extend(r,{Product:"Please enter a valid product."});i.ResponseType=="BoldPenguinBrowserOrDeviceUnsupported"&&$.extend(r,{ZipCode:"Oops!  Your browser/device isn't supported.  Please call us at 1-855-640-9310."});i.ResponseType=="BrowserOrDeviceUnsupported"&&(typeof i.Field.Phone!="undefined"&&(s=" Please call us at <span class='nowrap'>"+i.Field.Phone.Status+".<\/span>"),$.extend(r,{hiddenErrorElement:"Oops! Your browser/device isn't supported."+s}),o.pgPosition="quotestart",o.dataValue="browser",typeof _gaObj!="undefined"&&_gaObj instanceof Object&&_gaObj.GATrackEvent("progCom","QuoteStart-Failed",h,0,!1,o));i.ResponseType=="TechDiffError"&&typeof i.Field.Partner!="undefined"&&i.Field.Partner.Status=="BOLT"&&(typeof i.Field.Phone!="undefined"&&(s=" Please call <span class='nowrap'>"+i.Field.Phone.Status+".<\/span>"),$.extend(r,{hiddenErrorElement:"We are experiencing technical difficulties. We're sorry for the inconvenience."+s}));$.isEmptyObject(r)&&$.extend(r,{ZipCode:"We're having technical issues. We're sorry for the inconvenience."});l.showErrors(r);$(l.errorList[0].element).focus();t(u,r)}n(u)}}),!1}})})}),function(){function n(n,t){t=t||{bubbles:!1,cancelable:!1,detail:undefined};var i=document.createEvent("CustomEvent");return i.initCustomEvent(n,t.bubbles,t.cancelable,t.detail),i}if(typeof window.CustomEvent=="function")return!1;n.prototype=window.Event.prototype;window.CustomEvent=n}(),function(n){var r={trigger:""},t={productValue:"",productDisplay:"",min:0,max:"",list:null,current:"",found:!1},i;t.current=t.min;n(document).click(function(n){i.DocumentClick(n)}).keydown(function(n){i.DropdownKeydown(n)});i={init:function(t){return n.extend(!0,r,t),this.each(function(){i.BindEvents.apply(this)})},BindEvents:function(){var r=n(".display",n(this)).on("click",i.DropdownClick),t=r.siblings(".dropdown-list");n("li:not(.disabled)",t).on("mouseover",i.DropdownActive);n("li:not(.disabled)",t).on("mouseout",i.DropdownInactive);n("li:not(.disabled) a",t).on("click",i.DropdownSelect);n("li.disabled a",t).on("click",function(){return!1})},DocumentClick:function(t){n(".product").has(t.target).length==0&&n(".dropdown-list").hide()},DropdownClick:function(){var i=n(this).siblings(".dropdown-list");t.list=n("li.selected",i).closest("div");i.toggle()},DropdownActive:function(){t.list=n(this).closest("div");t.current=n(this).index();n("li.hover").removeClass("hover");n(this).addClass("hover")},DropdownInactive:function(){n(this).removeClass("hover")},DropdownKeydown:function(r){if(t.max=n("li",t.list).length,n(".dropdown-list").is(":visible")){var u=r.keycode||r.which;u!=9&&r.preventDefault();switch(u){case 38:t.current--;i.DisableCheck("minus");t.current<t.min&&(t.list.prev("div").length!=0?(t.list=t.list.prev("div"),t.max=n("li",t.list).length,t.current=n("li:not(.disabled)",t.list).last().index(),i.DisableCheck("minus")):t.current=t.min);n("li").removeClass("hover");n("li:eq("+t.current+")",t.list).addClass("hover");break;case 40:t.current++;i.DisableCheck("plus");t.current>=t.max&&(t.list.next("div").length!=0?(t.list=t.list.next("div"),t.current=n("li:not(.disabled)",t.list).first().index(),t.max=n("li",t.list).length,i.DisableCheck("plus")):t.current=t.max-1);n("li").removeClass("hover");n("li:eq("+t.current+")",t.list).addClass("hover");break;case 13:n("li.hover a").length>0&&(n("#quote-overlay .dropdown-list:visible").length>0?(n(".qs.slide").removeClass("slide"),n("#quote-overlay a[href='#productmodal']").focus()):n("#primary a[href='#productmodal']").focus(),i.UpdateList(n("li.hover a")),n("li.hover").removeClass("hover"))}return!1}t.current=n("li.selected").index()},DropdownSelect:function(){return t.list=n(this).closest("div"),t.current=n(this).parent().index(),i.UpdateList(this),!1},DisableCheck:function(i){var r=n("li:eq("+t.current+")",t.list),u,f;r.hasClass("disabled")&&(i=="plus"?(u=r.nextAll("li:not(.disabled)").first().index(),t.current=u==-1?t.max+1:u):(f=r.prevAll("li:not(.disabled)").first().index(),t.current=f==-1?t.min-1:f))},UpdateList:function(i){t.productDisplay=n(i).text();t.productValue=n(i).data("value");n("li.selected").removeClass("selected");n("li.hover").removeClass("hover");n(i).closest("li").addClass("selected");n(i).closest(".dropdown-list").siblings(".display").find(".placeholder").html(t.productDisplay);var r=n(i).closest(".dropdown-list").siblings("select");n(r).children("option").each(function(){this.text==t.productDisplay&&this.value==t.productValue&&(n('option[selected="selected"]',r).removeAttr("selected"),n(this).prop("selected",!0))});n(i).closest(".dropdown-list").hide()}};n.fn.DropdownList=function(t){if(i[t])return i[t].apply(this,Array.prototype.slice.call(arguments,1));if(typeof t!="object"&&t)n.error("Method "+t+" does not exist on jQuery.DropdownList");else return i.init.apply(this,arguments)}}(jQuery);$(function(){$(".quoteStartForm .dropdownlist").DropdownList()});$(document).ready(function(){var t=function(){},i,n;$("form.OLSUserLoginForm").each(function(){function e(n){try{if(!window.loadingOptions)return;t=window.loadingOptions.loginLoad.start(n,3e4)}catch(i){}}function f(){try{t.call()}catch(n){}}function r(n,t){var i=window.location.pathname,r;i=i!=null?i:"";i=="/"&&(i="/home/index");r={loginMethod:"UserID",loginInd:t,pageTechName:i,type:"servicing"};typeof _gaObj!="undefined"&&_gaObj instanceof Object&&_gaObj.GATrackEvent("progCom","SysEvent",n,0,!0,r)}function o(){var n=new Date,t=$("#saveUserID");t!=null&&t.attr("checked")!=null?(n=new Date,n.setMonth(n.getMonth()+6),u("OLSUserID",$("#OLSUserID").val(),n),u("OLSSaveUserID","Y",n)):(n.setMinutes(n.getMonth()-1),u("OLSUserID","",n),u("OLSSaveUserID","N",n))}function u(n,t,i){var r={},u;r.expires=i;u=window.location.hostname;u.substring(0,9)=="localhost"&&u.substring(0,2)!="ND"||(r.secure=!0);SetCookie(n,t,r)}function s(){var t=GetCookie("OLSSaveUserID"),n,i;t!=null&&t=="Y"&&($("#saveUserID").prop("checked",!0),n=GetCookie("OLSUserID"),i=/^[A-Za-z0-9_@.!$&'*+,-./=?@\-`]{1,255}$/,(n==null||i.test(n)===!1)&&(n=""),$("#OLSUserID").val(n));$("#OLSUserPassword").val("")}function h(n,t){p(n._links.target.href,n.accessToken,l,a,t)}function c(n,t,i){var u={},e;if(r("LoginFailure",""),f(),$("#OLSUserPassword").val(""),i==="error"&&(t.status===400||t.status===401||t.status===403)){if(t.status==403){setTimeout(function(){window.location=$("#OlsLockoutPasswordUrl").val()},200);return}$.extend(u,{OLSUserID:"The login information you entered does not match our records. Please try again."})}else $.extend(u,{OLSUserID:"We're having technical issues. We're sorry for the inconvenience."}),e="",e=i=="timeout"?"Timeout on Online Account API call.":v(t),HandleException({errorCode:15145,errorMessage:"userid="+$("#OLSUserID").val()+" "+e,errorCategory:"ERR",errorType:"Login",sevlvl:"Error"});n.showErrors(u);$(n.errorList[0].element).focus()}function l(t){var u=new Date,f=u-i;$("#OLSUserPassword").val("");r("LoginSuccess","Y");trackUtils.logActivity("olsonlineaccess",f,0,n,"","","");b();setTimeout(function(){window.location=t._links.target.href},200)}function a(n,t,i){var e={},u;r("LoginFailure","");f();$("#OLSUserPassword").val("");$.extend(e,{OLSUserID:"We're having technical issues. We're sorry for the inconvenience."});u="";u=i=="timeout"?"Timeout on Online Account API call.":"unhandled exception calling Routes API. Status: "+t.status+", Status Text: "+t.statusText;HandleException({errorCode:15147,errorMessage:"userid="+$("#OLSUserID").val()+" "+u,errorCategory:"ERR",errorType:"Login",sevlvl:"Error"});n.showErrors(e);$(n.errorList[0].element).focus()}function v(n){if(!n.responseText)return"HTTP Status: "+n.status+" No response found.";var i=JSON.parse(n.responseText),t=i.error_description;return t==undefined&&(t=i),"HTTP Status: "+n.status+" "+n.statusText+", errorCode: "+t.errorCode+", displayMessage: "+t.developerMessage}function y(n,t,i,r,u){var f=GetCookie("SITESERVER")?GetCookie("SITESERVER").replace(/^ID=/,""):"";$.ajax({type:"POST",url:t,data:n,contentType:"application/json; charset=utf-8",headers:{api_key:$("#OlsGatewayApiKey").val(),"X-PGRSITESERVERID":f,"X-PGRCLIENT":"prog.com"},crossDomain:!0,dataType:"json",success:function(n){i(n,u)},error:function(n,t){r(u,n,t)},timeout:$("#OlsOnlineAccountApiTimeout").val()})}function p(n,t,i,r,u){n=w(n);var f=GetCookie("SITESERVER")?GetCookie("SITESERVER").replace(/^ID=/,""):"";$.ajax({type:"GET",url:n,contentType:"application/json; charset=utf-8",headers:{api_key:$("#OlsGatewayApiKey").val(),Authorization:"Bearer "+t,"X-PGRSITESERVERID":f,"X-PGRCLIENT":"prog.com"},crossDomain:!0,dataType:"json",success:function(n){i(n,u)},error:function(n,t){r(u,n,t)},timeout:$("#OlsRoutesApiTimeout").val()})}function w(n){var i=$("#OlsContentgroup").val(),r=$("#OlsFinalDestination").val(),u=$("#OlsAffiliateCode").val(),t,f;return!i&&!r&&!u?"":(t="",i&&(t+="cntgrp%3D"+i),r&&(t&&(t+="%26"),t+="fd%3D"+r),u&&(t&&(t+="%26"),t+="ac%3D"+u),f=n.indexOf("?")===-1?"?":"&",n+f+"additionalparams="+t)}function b(){try{window.monetateQ=window.monetateQ||[];window.monetateQ.push(["trackEvent",["LoginLink"]]);window.monetateQ.push(["trackData"])}catch(n){}}$(this).UX().validate({rules:{OLSUserID:{minlength:1,maxlength:255},OLSUserPassword:{minlength:1,maxlength:255},messages:{OLSUserID:{required:"Please enter a valid user ID."},OLSUserPassword:{required:"Please enter a valid password."}}},errorElement:"span",submitHandler:function(t){var f,s,u,l;return i=new Date,f=this,n=$("#OLSUserID").val(),s=$("#OLSUserPassword").val(),u="Login",$("#OlsContentgroup").val()=="R"?u+="-Agt":$("#OlsFinalDestination").val()=="AuthKeyClaimService"&&(u+="-Claims"),o(),PersonalizationTracking(u),r("LoginAttempt",""),l={username:n,password:s},e(t),y(JSON.stringify(l),$("#OnlineAccountUrl").val(),h,c,f),!1}});s();$(".show").on("click",function(){return $("#OLSUserPassword").attr("type")=="password"?($("#OLSUserPassword").prop("type","text"),$(this).text("Hide")):($("#OLSUserPassword").prop("type","password"),$(this).text("Show")),!0})})})