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 n(n){try{var t={},i=$(n).data("page-position");return i&&(t.pagePosition=i),t.channelType="DI",t}catch(r){return{}}}$("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")},submitHandler:function(t){var e=this,r={},u,i,f,o;$($(t).serializeArray()).each(function(){r[this.name]=this.value});/^MC~/.test(r.Product)&&(r.Product="MC");u=r.Product.replace(/\s*\+*/g,"").toUpperCase();i=n(t);try{f=loadingOptions.defaultOption(t)}catch(s){}return typeof _gaObj!="undefined"&&_gaObj instanceof Object&&_gaObj.GATrackEvent("progCom","QuoteStart-Attempt",u,0,!1,i),o=(new Date).getTime(),$.ajax({url:$(t).attr("action"),type:"POST",data:JSON.stringify(r),dataType:"json",contentType:"application/json; charset=utf-8",retryCount:1,tryCount:0,error:function(n,t,r){if(typeof f=="function")try{f.call()}catch(h){}try{var e="",s=(new Date).getTime()-o;e+="status="+n.status;e+=";jqError="+t;e+=";serverError="+r;e+=";Time Taken(ms)="+s;HandleException({errorCode:15043,errorMessage:e,errorCategory:"Ajax",errorType:"qtestart",sevlvl:"Error"})}catch(c){}try{typeof _gaObj!="undefined"&&_gaObj instanceof Object&&_gaObj.GATrackEvent("progCom","QuoteStart-Failed",u,(new Date).getTime(),!1,i)}catch(c){}},success:function(n){if(typeof f=="function")try{f.call()}catch(o){}if(n.ResponseType=="Success")typeof _gaObj!="undefined"&&_gaObj instanceof Object&&typeof dataLayer!="undefined"?(_gaObj.GATrackEvent("progCom","QuoteStart",u,0,!1,i),setTimeout(function(){n.RedirectUrl.indexOf(".quoteasi.")!==-1?_gaObj.GARedirect(n.RedirectUrl):window.location=n.RedirectUrl},200)):window.location=n.RedirectUrl;else if(n.RedirectUrl)window.location=n.RedirectUrl;else{var t={},r="";n.ResponseType=="ZipNotFound"&&$.extend(t,{ZipCode:"Please enter the ZIP code where you live."});n.ResponseType=="MobileHomeNotOfferedError"&&$.extend(t,{ZipCode:"Mobile home insurance isn't available through Progressive in your area yet."});n.ResponseType=="HomeOwnersNotOfferedError"&&$.extend(t,{ZipCode:"Homeowners insurance isn't available through Progressive in your area yet."});n.ResponseType=="CommercialAutoNotOfferedError"&&$.extend(t,{ZipCode:"Commercial Auto insurance isn't available through Progressive in your area yet."});typeof n.Field.ZipCode!="undefined"&&n.Field.ZipCode.Status!="valid"&&$.extend(t,{ZipCode:"Please enter the ZIP code where you live."});typeof n.Field.Product!="undefined"&&n.Field.Product.Status!="valid"&&$.extend(t,{Product:"Please enter a valid product."});n.ResponseType=="BrowserOrDeviceUnsupported"&&(typeof n.Field.Phone!="undefined"&&(r=" Please call us at <span class='nowrap'>"+n.Field.Phone.Status+".<\/span>"),$.extend(t,{hiddenErrorElement:"Oops! Your browser/device isn't supported."+r}),i.pagePosition="quotestart",i.dataValue="browser",typeof _gaObj!="undefined"&&_gaObj instanceof Object&&_gaObj.GATrackEvent("progCom","QuoteStart-Failed",u,0,!1,i));n.ResponseType=="TechDiffError"&&typeof n.Field.Partner!="undefined"&&n.Field.Partner.Status=="BOLT"&&(typeof n.Field.Phone!="undefined"&&(r=" Please call <span class='nowrap'>"+n.Field.Phone.Status+".<\/span>"),$.extend(t,{hiddenErrorElement:"We are experiencing technical difficulties. We're sorry for the inconvenience."+r}));$.isEmptyObject(t)&&$.extend(t,{ZipCode:"We're having technical issues. We're sorry for the inconvenience."});e.showErrors(t);$(e.errorList[0].element).focus()}}}),!1}})})}),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")){r.preventDefault();switch(r.keyCode){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?(i.UpdateList(n("li.hover a")),n("li.hover").removeClass("hover")):n(".dropdown-list").hide()}return!1}},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(){$("form.OLSUserLoginForm").each(function(){function t(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 n(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 i(){var t=GetCookie("OLSSaveUserID"),n,i;t!=null&&t=="Y"&&($("#saveUserID").prop("checked",!0),n=GetCookie("OLSUserID"),i=/^[A-Za-z0-9_@.-]{1,15}$/,(n==null||i.test(n)===!1)&&(n=""),$("#OLSUserID").val(n));$("#OLSUserPassword").val("")}function r(n,t,i,r,u){var f={grant_type:"password",username:n,password:t},e=$("#TokenUrl").val();o(f,e,i,r,u)}function u(i){var r=new Date,u=$("#saveUserID"),f;u!=null&&u.attr("checked")!=null?(r=new Date,r.setMonth(r.getMonth()+6),n("OLSUserID",$("#OLSUserID").val(),r),n("OLSSaveUserID","Y",r)):(r.setMinutes(r.getMonth()-1),n("OLSUserID","",r),n("OLSSaveUserID","N",r));r=new Date;r.setMinutes(r.getMonth()-1);n("LoginAttempts",0,r);$("#authform #token").val(i.access_token);t("LoginSuccess","Y");f=$("#AuthUrl").val()+"&redirect_uri="+encodeURIComponent($("#RedirectUrl").val());$("#authform").attr("action",f);$("#authform").submit()}function f(i,r,u){var s={},f,h,o;if(t("LoginFailure",""),f=GetCookie("LoginAttempts"),u=="error"){if(f!=null&&Number(f)>=3){setTimeout(function(){window.location=$("#ResetPasswordUrl").val()},200);return}$.extend(s,{OLSUserID:"The login information you entered does not match our records. Please try again."})}else $.extend(s,{OLSUserID:"We're having technical issues. We're sorry for the inconvenience."}),h="",h=u=="timeout"?"Timeout on PING API call.":e(r),HandleException({errorCode:15145,errorMessage:"userid="+$("#OLSUserID").val()+" "+h,errorCategory:"LGN",errorType:"PING",sevlvl:"Error"}),o=new Date,o.setMinutes(o.getMinutes()+60),f!=null&&n("LoginAttempts",Number(f)-1,o);i.showErrors(s);$(i.errorList[0].element).focus()}function e(n){var i=JSON.parse(n.responseText),t=i.error_description;return t==undefined&&(t=i.error),n.status+" "+n.statusText+": "+t}function o(n,t,i,r,u){$.ajax({type:"POST",url:t,data:n,contentType:"application/x-www-form-urlencoded; charset=utf-8",headers:{api_key:$("#GatewayApiKey").val()},crossDomain:!0,dataType:"json",beforeSend:function(n){n.setRequestHeader("Authorization","Basic "+btoa("ClientProgAccess:"))},success:function(n){i(n)},error:function(n,t){r(u,n,t)},timeout:$("#timeout").val()})}$(this).UX().validate({rules:{OLSUserID:{minlength:1,maxlength:15},OLSUserPassword:{minlength:1,maxlength:15},messages:{OLSUserID:{required:"Please enter a valid user ID."},OLSUserPassword:{required:"Please enter a valid password."}}},submitHandler:function(){var o=GetCookie("LoginAttempts"),e;if(o!=null&&Number(o)>=3)return window.location=$("#ResetPasswordUrl").val(),!1;var s=this,h=$("#OLSUserID").val(),c=$("#OLSUserPassword").val(),i=new Date;return i.setMinutes(i.getMinutes()+60),o!=null?n("LoginAttempts",Number(GetCookie("LoginAttempts"))+1,i):n("LoginAttempts",1,i),e="Login",$("#Contentgroup").val()=="R"?e+="-Agt":$("#FinalDestination").val()=="AuthKeyClaimService"&&(e+="-Claims"),PersonalizationTracking(e),t("LoginAttempt",""),r(h,c,u,f,s),$("#OLSUserPassword").val(""),!1}});i();$(".show").on("click",function(){return $("#OLSUserPassword").attr("type")=="password"?($("#OLSUserPassword").prop("type","text"),$(this).text("Hide")):($("#OLSUserPassword").prop("type","password"),$(this).text("Show")),!0});$("#authform").on("submit",function(){setTimeout(function(){HandleException({errorCode:15146,errorMessage:"Timeout on post back to PING - userid="+$("#OLSUserID").val(),errorCategory:"ERR",errorType:"PING",sevlvl:"Error"})},$("#timeout").val())})})})