jQuery.extend(jQuery.validator.messages,{digits:"Please use only digits."}),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']"),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().length>0?n(this).parent().addClass("hideLabel"):n(this).parent().removeClass("hideLabel")},SelectChange:function(){var t=n(this),i=t.val(),u=t.find("option[value='"+i+"']").text(),r=t.closest(".dropdown");r.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}catch(r){return{}}}$("form.quoteStartForm").each(function(){$(this).UX().validate({rules:{ZipCode:{minlength:5,maxlength:5,digits:!0}},submitHandler:function(t){var e=this,f={},r,u,i,o;$($(t).serializeArray()).each(function(){f[this.name]=this.value});r=f.Product.replace(/\s*\+*/g,"").toUpperCase();u=n(t);try{i=loadingOptions.defaultOption(t)}catch(s){}return typeof _gaObj!="undefined"&&_gaObj instanceof Object&&_gaObj.GATrackEvent("progCom","QuoteStart-Attempt",r,0,!1,u),o=(new Date).getTime(),$.ajax({url:$(t).attr("action"),type:"POST",data:JSON.stringify(f),dataType:"json",contentType:"application/json; charset=utf-8",retryCount:1,tryCount:0,error:function(n,t,f){if(typeof i=="function")try{i.call()}catch(h){}try{var e="",s=(new Date).getTime()-o;e+="status="+n.status;e+=";jqError="+t;e+=";serverError="+f;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",r,(new Date).getTime(),!1,u)}catch(c){}},success:function(n){if(typeof i=="function")try{i.call()}catch(f){}if(n.ResponseType=="Success")typeof _gaObj!="undefined"&&_gaObj instanceof Object&&typeof dataLayer!="undefined"?(_gaObj.GATrackEvent("progCom","QuoteStart",r,0,!1,u),setTimeout(function(){window.location=n.RedirectUrl},200)):window.location=n.RedirectUrl;else if(n.RedirectUrl)window.location=n.RedirectUrl;else{var t={};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."});$.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).attr("selected","selected"))});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()})