var key=[];key.tab=9;key.enter=13;key.escape=27;key.space=32;key.up=38;key.down=40;var clickedbutton="",mousecount=0,tabcount=0;$(function(){function n(){widths=0;$.each($("#local-nav .section > ul > li > a"),function(){widths+=$(this).outerWidth()});widths+=$("#local-nav .section > a").innerWidth()-110-$("#local-nav ul").width()}function n(){widths=0;$.each($("#local-nav .section > ul > li > a"),function(){widths+=$(this).outerWidth()});widths+=$("#local-nav .section > a").innerWidth()-110-$("#local-nav ul").width()}function i(){$("#quote-overlay").removeClass("active");$("#quote-overlay .qs").removeClass("slide");$(".dropdown-list").removeClass("show");$("#overlay").removeClass("on");$(".cta-slide .iconlist li li a, .cta-slide .iconlist .icon.close a").attr("tabIndex","-1")}function r(n){$(n).text().toLowerCase()!="more choices"&&$(n).attr("aria-expanded","true");$(".cta-slide .iconlist li li a, .cta-slide .iconlist .icon.close a").removeAttr("tabIndex");$(n).closest("li").removeAttr("tabIndex")}function t(n){$(".iconlist li a[aria-expanded=true]").attr("aria-expanded","false");$(".sidecar li a[aria-pressed=true]").attr("aria-pressed","false");setTimeout(function(){$(n).closest("li").find("span:first a").focus()},5)}$("#header").trigger("click");$("body").on("keydown",function(n){var t=n.keyCode||n.which;t==key.tab&&(tabcount++,$("body").removeClass("disable-focus-state"))});$("body").on("mousedown",function(){mousecount++;$("body").hasClass("disable-focus-state")||$("body").addClass("disable-focus-state")});n();$(window).on("resize",function(){n()});$("body").on("keydown",function(){$("input, .owl-carousel .item, #sub-report").on("focus",function(){$(this).addClass("focus")}).on("blur",function(){$(this).removeClass("focus")});$("select").on("focus",function(){$(this).siblings(".display").addClass("focus")}).on("blur",function(){$(this).siblings(".display").removeClass("focus")})});n();$(window).on("resize",function(){n()});$("footer a:last, footer input:last, footer button:last").last().on("keydown",function(n){var t=n.keyCode||n.which;t==key.tab&&n.shiftKey?(n.preventDefault(),$(this).prev().focus()):t==key.tab&&(n.preventDefault(),$(".logo").focus(),$("html, body").animate({scrollTop:0},0))});$("#legal .social a:last").on("keydown",function(n){var t=n.keyCode||n.which;t==key.tab&&(n.preventDefault(),$("#searchTerm").focus())});if($("#footer .section").css("position")!="relative"&&$("#legal .social").css("float")=="right"){$("#footer .section > a").attr("tabIndex","-1").removeAttr("aria-expanded").on("click",function(n){n.preventDefault()});$("#footer .section a").on("keydown",function(n){var t,i;n.preventDefault();t=n.keyCode||n.which;t==key.tab&&(i=$(this).closest(".nav").next(".nav").find("a, input, button").filter(":visible:first").focus(),i.length==0&&$("#footer").nextAll().find("a, input, button").filter(":visible:first").focus());t==key.enter&&$(this).closest(".nav").find("ul li:first a").focus()});$("#footer .nav:last a:last").on("keydown",function(n){var t=n.keyCode||n.which;t==key.tab&&(n.preventDefault(),$("#legal .nav:first").find("a, input, button").filter(":visible:first").focus())});$("#legal .nav:first a:last").on("keydown",function(n){var t=n.keyCode||n.which;t==key.tab&&(n.preventDefault(),$("#legal .social").find("a, input, button").filter(":visible:first").focus())})}else if($("#footer .section").css("position")!="relative"&&$("#legal .social").css("float")=="left"){$("#footer .section > a").attr("tabIndex","-1").removeAttr("aria-expanded").on("click",function(n){n.preventDefault()});$("#footer .section a").on("keydown",function(n){var t=n.keyCode||n.which;t==key.enter&&(n.preventDefault(),$(this).parent().trigger("click"),$(this).attr("aria-expanded")=="false"?$(this).attr("aria-expanded","true"):$(this).attr("aria-expanded","false"))});$("#ssButton").on("keydown",function(n){var t=n.keyCode||n.which;t==key.tab&&(n.preventDefault(),$("#legal .nav:first").find("a, input, button").filter(":visible:first").focus())});$("#legal .nav:first a:last").on("keydown",function(n){var t=n.keyCode||n.which;t==key.tab&&(n.preventDefault(),$("#disclosures").find("a, input, button").filter(":visible:first").focus())})}else{$("#footer .section > a").removeAttr("tabindex").attr("aria-expanded","false");$("#footer .section a").on("keydown",function(n){var t=n.keyCode||n.which;t==key.enter&&(n.preventDefault(),$(this).parent().trigger("click"),$(this).attr("aria-expanded")=="false"?$(this).attr("aria-expanded","true"):$(this).attr("aria-expanded","false"))});$("#ssButton").on("keydown",function(n){var t=n.keyCode||n.which;t==key.tab&&(n.preventDefault(),$("#legal .nav:first").find("a, input, button").filter(":visible:first").focus())});$("#legal .nav:first a:last").on("keydown",function(n){var t=n.keyCode||n.which;t==key.tab&&(n.preventDefault(),$("#disclosures").find("a, input, button").filter(":visible:first").focus())})}if($("#menu button").css("opacity")!="1"){$(".flyout span > a").attr("tabIndex","-1");$("#menu button").attr("tabIndex","-1");$(".flyout, .flyout .section > li > a, .flyout .bold > span > a").removeAttr("aria-expanded");$("#navmenu > li > a").on("blur",function(){$(this).attr("aria-expanded","false")});$("#navmenu > li > a").on("keydown",function(n){var t=n.keyCode||n.which;t==key.enter&&setTimeout(function(){$(this).attr("aria-expanded")=="false"?$(this).attr("aria-expanded","true"):$(this).attr("aria-expanded","false");$(this).trigger("mouseenter");$(this).on("keydown",function(n){var t=n.keyCode||n.which;t==key.tab&&$(this).parent().hasClass("active")&&$("#"+$(this).parent().data("flyout")).find("a,input,button").filter(":visible:first").focus()})},10)});$("#navmenu > li > a").on("click",function(n){n.preventDefault();$(this).attr("aria-expanded")=="false"?$(this).attr("aria-expanded","true"):$(this).attr("aria-expanded","false");$(this).trigger("mouseenter");$(this).on("keydown",function(n){var t=n.keyCode||n.which;t==key.tab&&$(this).parent().hasClass("active")&&$("#"+$(this).parent().data("flyout")).find("a,input,button").filter(":visible:first").focus()})});$.each($(".flyout .section"),function(){$("a:last",$(this)).on("keydown",function(n){var i,t;n.preventDefault();i=n.keyCode||n.which;i==key.tab&&(t=$("li[data-flyout="+$(this).closest(".section").attr("id")+"]").removeClass("active"),t.find("a").attr("aria-expanded","false").trigger("mouseleave"),t.next().find("a:first").focus())})});$(".flyout .section a:last, .flyout .section:last .bold:last span a").on("keydown",function(n){n.preventDefault();var t=n.keyCode||n.which;t==key.tab&&$("#navmenu").nextAll().find("a, input, button").filter(":visible:first").focus()})}else{$(".flyout span > a").removeAttr("tabindex");$("#menu button").removeAttr("tabindex");$("#menu button").on("keydown",function(n){var t=n.keyCode||n.which;(t==key.enter||t==key.space)&&($(".flyout").attr("aria-expanded","true"),setTimeout(function(){$(".flyout a:visible:first").focus()},500))});$("#menu button").on("click",function(){$(".flyout").attr("aria-expanded","true");setTimeout(function(){$(".flyout a:visible:first").focus()},500)});$("body:not(.agent, .agent-map) .flyout .section > li > a").on("click",function(){return $(this).parent().hasClass("active-link")?!0:($(this).attr("aria-expanded")=="false"?($(".flyout .section > li > a, #sub-report").not(this).attr("aria-expanded","false"),$(this).attr("aria-expanded","true")):$(this).attr("aria-expanded","false"),!1)});$(".flyout .bold > span > a").on("click",function(){$(this).attr("aria-expanded")=="false"?($(this).attr("aria-expanded","true"),$(".flyout .bold > span > a, #sub-report").not(this).attr("aria-expanded","false")):$(this).attr("aria-expanded","false")});$("#sub-report").attr({tabIndex:0,"aria-expanded":"false"}).on("keydown",function(n){var t=n.keyCode||n.which;t==key.enter&&$(this).trigger("click")});$("#sub-report").on("click",function(){$(this).attr("aria-expanded")=="false"?($(this).attr("aria-expanded","true"),$(".flyout .bold > span > a").attr("aria-expanded","false")):$(this).attr("aria-expanded","false")})}$(".button > a, a[role='button']").on("keydown",function(n){var t=n.keyCode||n.which;(t==key.space||t==key.enter)&&$(this).attr("href")=="#"&&(n.preventDefault(),$(this).trigger("click"))});if($(".qs-trigger").attr("aria-haspopup","true"),$(".qs-trigger").each(function(){$(this).on("click",function(){clickedbutton=$(this)})}),$("input[id*='qsButton']").each(function(){$(this).on("keydown",function(n){var t=n.keyCode||n.which;(t==key.space||t==key.enter)&&$(this).trigger("click")})}),$("#skipcontent a").click(function(){if($("#mma .quoteStartForm").length)return $(".cta-slide").length>0?$("#mma .bucket .iconlist li a:visible:first").focus():$("#mma .quoteStartForm .zipCode input").focus(),!1;if($("#mma").find("a, input, button").length)return $("#mma").find("a, input, button").filter(":visible:first").focus(),!1;$($(this).attr("href")).attr("tabIndex",0).focus()}),$("#overlay").hasClass("on")){$("#overlay .modal").attr("tabIndex","0").focus();$("#overlay, #overlay a").on("keydown",function(n){var t=n.keyCode||n.which;t==key.escape&&(n.preventDefault(),$(this).find(".close a").trigger("click"))});$("#overlay .close a").on("keydown",function(n){var t=n.keyCode||n.which;(t==key.tab||t==key.space||t==key.enter)&&(n.preventDefault(),$(this).trigger("click"))})}if($("#ssButton").attr("aria-label","Submit Search"),$("#breadCrumb").attr({"aria-label":"Breadcrumbs",role:"navigation"}),$("#breadCrumb .icon").attr("aria-label","Home"),$("#local-nav").attr("role","navigation"),$("#local-nav > ul").attr({role:"menubar"}),$("#local-nav a").not(".button a, .icon.close").attr("role","menuitem"),$("#local-nav li ul").attr("role","menu"),$("#local-nav li ul").prev("a.children").attr({"aria-haspopup":"true","aria-expanded":"false"}),$("#local-nav").length>0&&$("#local-nav").css("overflow")=="hidden"){$("#local-nav .close").attr("tabIndex","-1");$("#local-nav .section > a:first-child").attr("aria-haspopup","true");$("#local-nav .section > a:first-child").on("keydown",function(n){var i=$(this),t=n.keyCode||n.which;t==key.tab?(n.preventDefault(),$(this).closest("#local-nav").addClass("show-qs"),$(this).closest("ul").nextAll().find("a,input,button").filter(":visible:first").focus()):t==key.enter&&setTimeout(function(){i.next().focus()},500)});$("#local-nav ul").find("a").filter(":last").on("keydown",function(n){var t=n.keyCode||n.which;t==key.tab&&(n.preventDefault(),$("#local-nav .close").focus())});$("#local-nav .close").on("keydown",function(n){var t=n.keyCode||n.which;if((t==key.tab||t==key.space||t==key.enter)&&(t==key.tab&&n.preventDefault(),$(this).trigger("click"),$("#local-nav").addClass("show-qs"),setTimeout(function(){$("#local-nav .button a").focus()},100),t==key.enter))return!1})}if($("#local-nav").length>0&&$("#local-nav").css("overflow")=="visible"){$("#local-nav a.children").on("focus",function(){if($("#local-nav > ul").css("position")!="static"){var t=$(this).attr("aria-expanded","true"),n=$(this).closest("li").trigger("mouseenter");n.find("ul li:last a").on("blur",function(){t.attr("aria-expanded","false");n.trigger("mouseleave")})}});$("#local-nav li:last a:last").on("keydown",function(n){var t=n.keyCode||n.which;if(t==key.tab&&$("#local-nav .button").length&&$("#local-nav .button").css("opacity")=="0"){$("#local-nav").addClass("show-qs");try{$("#local-nav > ul").css("left",widths/2+"px")}catch(i){}}})}$(".badges .owl-item .item a:first, .tiles .owl-item .item a:first, .cards-v2 .owl-item .item a:first").on("focus",function(){var n=$(".owl-carousel");n.trigger("owl.goTo",0);n.trigger("owl.stop")});$(".badges .owl-item .item a:first, .tiles .owl-item .item a, .cards-v2 .owl-item .item a").on("focus",function(){var n=$(".owl-carousel");n.trigger("owl.jumpTo",$(this).closest(".owl-item").index());$(this).closest(".item").addClass("fake-hover")});$(".badges .owl-item .item a:first, .tiles .owl-item .item a, .cards-v2 .owl-item .item a").on("blur",function(){$(this).closest(".item").removeClass("fake-hover")});if($(".owl-controls").css("display")=="block"){$(".badges .owl-item .item, .tiles .owl-item .item, .cards-v2 .owl-item .item").attr("tabIndex",0);$(".badges .owl-item .item:first, .tiles .owl-item .item:first, .cards-v2 .owl-item .item:first").on("focus",function(){var n=$(".owl-carousel");n.trigger("owl.goTo",0);n.trigger("owl.stop")});$(".badges .owl-item .item, .tiles .owl-item .item, .cards-v2 .owl-item .item").on("focus",function(){var n=$(".owl-carousel");$(this).addClass("focus fake-hover");n.trigger("owl.jumpTo",$(this).closest(".owl-item").index())});$(".badges .owl-item .item, .tiles .owl-item .item, .cards-v2 .owl-item .item").on("blur",function(){$(this).removeClass("focus fake-hover")})}$(".train li a").on("focus",function(){$(this).closest("li:not(.button)").addClass("hover")});$(".train li a").on("blur",function(){$(this).closest("li").removeClass("hover")});$(".transcript .trigger").on("click",function(){var n=$(this).next("[role='region']");$(this).attr("aria-expanded")=="false"?($(this).attr("aria-expanded","true").html("Hide video transcript"),$(n).attr("tabIndex","0"),setTimeout(function(){$(n).focus()},10)):($(this).attr("aria-expanded","false").html("Show video transcript"),$(n).attr("tabIndex","-1"))});$(".quoteStartForm .zipCode input[id*=zipCode]").attr("aria-label","Get a quote. Enter your zip code.");$("select[id*=product]").attr("aria-label","Select a product");$(".quoteStartForm .dropdown-list").attr({role:"listbox","aria-label":"Select a product"});$(".quoteStartForm .dropdown-list li").attr("role","option");$(".quoteStartForm .zipCode input").on("keydown",function(n){var t=n.keyCode||n.which;t==key.tab&&(mousecount>0&&$("#QuoteStartForm .dropdown-list").length>0&&$("#menu button").css("opacity")!="1"&&$(".cta-slide").length==0?($(this).closest(".quoteStartForm").find(".dropdown .display").trigger("click"),$(this).closest(".quoteStartForm").find(".dropdown-list li.selected a").focus(),$(this).closest(".quoteStartForm").find("select").css("display","none")):$(this).closest(".quoteStartForm").find("select").css("display","block"))});$(".dropdown-list a").on("keydown",function(n){var t=n.keyCode||n.which,i;if(t==key.tab&&n.shiftKey)return $(this).trigger("click"),$(this).closest(".quoteStartForm").find("a,input,button").filter(":visible:first").focus(),!1;if(t==key.escape||t==key.tab||t==key.enter&&mousecount>0)return $(this).trigger("click"),$(this).closest(".dropdown").nextAll().find("a,input,button").filter(":visible:first").focus(),!1;(t==key.down||t==key.up)&&(i=$(this),setTimeout(function(){$(i).closest(".dropdown-list").find("li.hover a").focus()},10))});$("#product").on("mousedown",function(){$("#QuoteStartForm .dropdown-list").length>0&&$("#menu button").css("opacity")!="1"?($(this).closest(".quoteStartForm").find(".dropdown .display").trigger("click"),$(this).closest(".quoteStartForm").find(".dropdown-list li.selected a").focus(),$(this).closest(".quoteStartForm").find(".dropdown .display").removeClass("focus"),$(this).css("display","none")):($(this).css("display","block"),$(this).closest(".quoteStartForm").find(".dropdown .display").removeClass("focus"))});$("#product_modal, #product_ueno").on("mousedown",function(){$("#QuoteStartForm_modal .dropdown-list, #QuoteStartForm_ueno .dropdown-list").length>0&&$("#menu button").css("opacity")!="1"?($(this).closest(".quoteStartForm").find(".dropdown .display").trigger("click"),$(this).closest(".quoteStartForm").find(".dropdown-list li.selected a").focus(),$(this).closest(".quoteStartForm").find(".dropdown .display").removeClass("focus"),$(this).css("display","none")):($(this).css("display","block"),$(this).closest(".quoteStartForm").find(".dropdown .display").removeClass("focus"))});$("#QuoteStartForm_modal .display .placeholder").replaceWith(function(){return $("<label for='product_modal' class='placeholder'/>").append($(this).contents())});$(".qs-trigger").on("click",function(){setTimeout(function(){$("#zipCode_modal").focus()},10)});$("#zipCode_modal").on("keydown",function(n){var t=n.keyCode||n.which;t==key.tab&&n.shiftKey&&console.log("halp")});$("#quote-overlay .close a").on("keydown",function(n){var t=n.keyCode||n.which;t!=key.enter&&(t!=key.tab||n.shiftKey)&&t!=key.space&&t!=key.escape||(n.preventDefault(),i(),setTimeout(function(){clickedbutton.focus()},10),$(".bucket").length>0&&setTimeout(function(){$(".bucket .iconlist > li:last a").focus()},10))});$("body:not(.agent, .agent-map, .agent-spanish) #quote-overlay .close a").on("click",function(){return clickedbutton.focus(),!1});$("#quote-overlay").on("keydown",function(n){var t=n.keyCode||n.which;if(t==key.escape)return i(),setTimeout(function(){clickedbutton.focus();$(".cta-slide").length>0&&$(".qs-trigger[data-prod] a").attr("aria-expanded","false").focus()},10),!1});$(".cta-slide .iconlist li li a, .cta-slide .iconlist .icon.close a").attr("tabIndex","-1");$(".cta-slide a, .cta-slide input").on("keydown",function(n){if($(".bucket.dimmed").length>0){var t=n.keyCode||n.which;t==key.escape&&(n.preventDefault(),$(".cta-slide li.active").find(".close a").trigger("click"))}});$(".cta-slide .iconlist > li > span:not(.close) a, .cta-slide .iconlist .sidecar a").on("focus",function(){$(this).closest("li").addClass("fake-hover")}).on("blur click",function(){$(this).closest("li").removeClass("fake-hover")});$(".cta-slide .iconlist > li > span:not(.close) a").on("click",function(){r($(this))}).on("keydown",function(n){var i=n.keyCode||n.which;if(i==key.enter||i==key.space)r($(this)),$(this).trigger("click"),$(this).closest(".qs-trigger").length>0&&($("#quote-overlay .qs").removeClass("slide"),setTimeout(function(){$("#quote-overlay .dropdown-list").hide().removeClass("show")},100));else if(i==key.tab&&n.shiftKey&&$(".bucket").hasClass("dimmed"))t($(this)),$(this).closest("li").find(".close a").trigger("click");else if(i==key.tab){if($(this).closest("li").text()!=$(".cta-slide .iconlist li:last").text()||n.shiftKey)return!0;$(".quoteLinks a:first").focus();n.preventDefault()}});$(".cta-slide .iconlist > li span.close a").on("click",function(){t($(this))}).on("keydown",function(n){n.preventDefault();var i=n.keyCode||n.which;i==key.enter||i==key.space?(t($(this)),$(this).trigger("click")):i==key.tab&&n.shiftKey?$("#qsButton_ueno").focus():i==key.tab&&(t($(this)),$(this).trigger("click"))});$(".cta-slide .quoteLinks li:first a").on("keydown",function(n){var t=n.keyCode||n.which;t==key.tab&&n.shiftKey&&(n.preventDefault(),$(".cta-slide .iconlist a:visible:last").focus())});$(".cta-slide .iconlist .sidecar a").on("keydown",function(n){var t=n.keyCode||n.which;(t==key.enter||t==key.space)&&($(this).attr("aria-pressed")=="true"?$(this).attr({"aria-pressed":"false"}):($(this).closest(".sidecar").find("a").attr({"aria-pressed":"false"}),$(this).attr({"aria-pressed":"true"})),setTimeout(function(){n.preventDefault();$(this).trigger("click")},10))});$(".cta-slide .iconlist > li a").on("keydown",function(n){var i=n.keyCode||n.which,r,t;return i==key.tab&&n.shiftKey?!0:i==key.tab&&$(".bucket").hasClass("dimmed")&&(r=$(this).closest(".iconlist > li"),t=$("a",r),$(t[t.length-2]).text().toLowerCase()==$(this).text().toLowerCase())?($("#zipCode_ueno").focus(),!1):void 0});$("#zipCode_ueno").on("keydown",function(n){var i=n.keyCode||n.which,t;if(i==key.tab&&n.shiftKey)return t=$(".cta-slide .iconlist li.active a"),$(t[t.length-2]).focus(),!1});$("#qsButton_ueno").on("keydown",function(n){var t=n.keyCode||n.which;if(t==key.tab&&!n.shiftKey)return $(".cta-slide .iconlist li.active .close a").focus(),!1});$(".bundle a[role='button']").attr("aria-pressed","false");$(".bundle li a").on("click",function(){$(this).parent().hasClass("on")||$(this).parent().hasClass("active")?$(this).attr("aria-pressed","false"):($(".bundle li a").attr("aria-pressed","false"),$(this).attr("aria-pressed","true"));$("#product").focus().siblings(".display").removeClass("focus");$(this).focus()});$("#searchTerm").on("keydown",function(n){var t=n.keyCode||n.which;t==key.tab&&n.shiftKey&&(n.preventDefault(),$(this).parents("#SiteSearch").prevAll(".nav").css("float")=="left"&&$(".social").find("a, input, button").filter(":visible:last").focus())});$("#footer .nav:last a:last").on("keydown",function(n){var t=n.keyCode||n.which;t==key.tab&&n.shiftKey&&(n.preventDefault(),$(this).parent().prev().find("a, input, button").filter(":visible:first").focus())});$("#legal .nav li:last-child a").on("keydown",function(n){var t=n.keyCode||n.which;t==key.tab&&n.shiftKey&&(n.preventDefault(),$(this).parent().prev().find("a,input,button").filter(":visible:first").focus())});$("#legal .nav li:first-child a").on("keydown",function(n){var t=n.keyCode||n.which;t==key.tab&&n.shiftKey&&(n.preventDefault(),$("#footer").find("a,input,button").filter(":visible:last").focus())});$(".social li:last-child a").on("keydown",function(n){var t=n.keyCode||n.which;t==key.tab&&n.shiftKey&&(n.preventDefault(),$(this).parent().prev().find("a,input,button").filter(":visible:first").focus())});$(".social li:first-child a").on("keydown",function(n){var t=n.keyCode||n.which;t==key.tab&&n.shiftKey&&(n.preventDefault(),$("#legal .nav").find("a,input,button").filter(":visible:last").focus())});$("#menu button").css("opacity")!="1"&&$(".flyout .section").each(function(){$(".bold:first a[tabindex !='-1']:first",this).on("keydown",function(n){var i=n.keyCode||n.which,t;if(i==key.tab&&n.shiftKey){n.preventDefault();t=$("li[data-flyout="+$(this).closest(".section").attr("id")+"]").removeClass("active");t.find("a").attr("aria-expanded","false").trigger("mouseleave").focus().on("keydown",function(n){var t=n.keyCode||n.which;t==key.tab&&n.shiftKey&&$(this).closest("a, input, button").filter(":visible:last").focus()})}});$(".flyout .section").each(function(){$("a:last",$(this)).on("keydown",function(n){var i=n.keyCode||n.which,t;i==key.tab&&n.shiftKey&&(n.preventDefault(),t=$("li[data-flyout="+$(this).closest(".section").attr("id")+"]"),t.find("a").attr("aria-expanded","true").trigger("mouseenter"),$(this).parent().prev().find("a, input, button").filter(":visible:last").focus())})})})})