var Slate=Slate||{},Doc;Slate.Publisher=Slate.Publisher||{};Slate.Publisher.Version="1.0.0.0".split(".");String.prototype.startsWith=function(n){return this.substr(0,n.length)===n};Doc=Doc||{selectedParagraph:null,hoveredParagraph:null,hoverTimer:null,menuTimer:null,alwaysShowReferences:!1,warnWhenLeavingSite:!0,openExternalLinksInNewWindows:!0,preferPdf:!1,isLoading:!0,loadedOnce:!1,inFrame:function(){try{var n=top.document.title;return window.self!=window.top}catch(t){return!1}},divForCite:function(n){var t=$("div").filter(function(){var t=$(this).attr("data-cites"),i;return!t||t=="[]"?!1:(i=$.parseJSON(t),$.inArray(n,i)>=0)});return t.first()},divForPath:function(n){return $("div").filter(function(){return $(this).attr("data-path")==n})},pathForElement:function(n){return $(n).closest("div").attr("data-path")},markHistoryElement:function(n){!Doc.isLoading&&n&&Doc.markHistoryPath(n)},markHistoryPath:function(n){if(!Doc.isLoading&&Doc.isIE()){var t=Doc.pathForElement(n);t!=""&&t!=Doc.getHash()&&(location.hash=escape(t))}},attemptScrollCite:function(n){var t=Doc.divForCite(n);return t&&t.position()?(Doc.scrollToSection(t),Doc.highlightSection(t),Doc.updateCurrentCite(n),!0):!1},openCite:function(n,t){var r,i,u,f;return(Doc.markHistoryElement(t),Doc.attemptScrollCite(n))?!1:(r=Doc.getLoadingCite(),n==r&&r==Doc.getCite()?!1:(i="/document/"+n,t&&(u=t.attr("href"),u.indexOf("view=section")>0&&(i=i+"?view=section")),f=n.startsWith("usc")||n.startsWith("cfr")||n.startsWith("courts"),Doc.openUrl(i,f&&Doc.openExternalLinksInNewWindows,t)))},openPath:function(n){var t=Doc.divForPath(n);t&&t.position()?(Doc.scrollToSection(t),Doc.highlightSection(t),Doc.changeCurrentParagraph(t)):Doc.isLoading||(document.location=n)},openUrl:function(n,t,i){return Doc.markHistoryElement(i),t?window.open(n,"_blank"):document.location=n,!1},sectionLinkClick:function(n){if(n.which==2)return!0;var t=$(this),i=t.attr("rel"),r=t.attr("href");return t.hasClass("reference")?Doc.clickReference(t,n):t.hasClass("external")?Doc.openUrl(r,Doc.openExternalLinksInNewWindows,t):typeof i!="undefined"&&i!=""?Doc.openCite(i,t):Doc.openUrl(r,!1,t)},linkClick:function(){if($(this).data("toggle"))return!0;var n=$(this).attr("href");return n&&n.indexOf("#")!=-1&&n.indexOf("#")!=n.length-1?Doc.scrollToHash(n.substring(n.indexOf("#")),!0):!0},scrollToHash:function(n,t){var i=$(n),r;return i.length>0?(t&&(location.hash=n),r=i.offset().top-160,window.scrollTo(0,r),i.hasClass("scrollable")&&Doc.highlightSection(i.first()),!1):!0},scrollToSection:function(n){n&&(Doc.isLoading||!Doc.isEntirelyVisible(n))&&window.scrollTo(0,n.position().top-160)},highlightSection:function(n){n&&(Doc.clearSectionHighlighting(),n.addClass("highlighted").css("backgroundColor","#ffa").animate({backgroundColor:"#ffd"},3e3))},isEntirelyVisible:function(n){var t=$(window).scrollTop(),r=t+$(window).height(),i=$(n).offset().top,u=i+$(n).height();return t<i&&r>u},firstVisibleCite:function(){return Doc.visibleContent().attr("data-cite").first().text()||"top"},visibleContent:function(){return $("#document div:visible").filter(function(){return this.offsetTop>$(document).scrollTop()})},doctypeForCite:function(n){var t=n.split(/\//);return t.slice(0,t.length-1).join("/")},destForCite:function(n){var t=n.split(/\//);return t.pop()},getPath:function(){return $("#nodePath").text()},getOwnerPath:function(){return $("#nodeOwnerPath").text()},getHasPDF:function(){return $("#nodeHasPDF").text()=="true"},getDoctype:function(){return $("#nodeDoctype").text()},getAgency:function(){return $("#nodeAgency").text()},getChapterGroup:function(){return $("#nodeChapterGroup").text()},getCite:function(){return $("#nodeCite").text()},getLoadingCite:function(){return $("#loadingCite").text()},getPageKind:function(){return $("#pageKind").text()},getScrolling:function(){return $("#scrolling").text()},getHash:function(){return unescape(location.hash.substring(1))},getShowReferences:function(){var n=Doc.getDoctype();return n=="statutes"||n=="administrativecode"},getShowCrossReferences:function(){var n=Doc.getDoctype();return n=="statutes"||n=="administrativecode"},getShowSectionsAffected:function(){var n=Doc.getDoctype();return n=="statutes"},getTitle:function(n){return"Wisconsin Legislature: "+n},setTitle:function(n){try{top.document.title=Doc.getTitle(n)}catch(t){}},updateCurrentCite:function(n){Doc.setTitle(n)},searchInside:function(){Doc.inFrame()?parent.search.Search.searchInside(Doc.getPath()):Search.searchInside(Doc.getPath())},clickedTreeNode:function(n){var t=n.data.path,i="/"+t;parent.doc.location=i;Doc.setTitle(n.data.path)},changeCurrentParagraph:function(n){n!=Doc.selectedParagraph&&(Doc.selectedParagraph&&$(Doc.selectedParagraph).removeClass("current"),Doc.hidePulltab(),$(n).addClass("current"),Doc.selectedParagraph=n,Doc.showTools(n),Doc.getShowReferences()&&!Doc.alwaysShowReferences&&($("div#document .reference").hide(),$(Doc.selectedParagraph).find(".reference").show()))},clickParagraph:function(n){var i,t;return(Doc.inFrame()&&(i=$(this).attr("data-path"),i&&i!=""&&parent.tree.expandPath(i)),t=$(this),Doc.citeForElement(n.target)==""&&(t=Doc.getPreviousParagraphWithCite(t),!t))?!0:(Doc.changeCurrentParagraph(t),!0)},citeForElement:function(n){var t=$(n).attr("data-cites"),r,i;return!t||t==""||t=="[]"?"":(r=$.parseJSON(t),i=r[0],!i||i=="")?"":i},clickReference:function(n,t){if(t.which<=1){var i=n.parent();return Doc.togglePulltab(i),!1}return!0},clickTools:function(){Doc.togglePulltab(Doc.hoveredParagraph)},togglePulltab:function(n){var t=$("#pulltab");t.is(":visible")?Doc.hidePulltab():(Doc.changeCurrentParagraph(n),Doc.showPulltab(n))},showPulltab:function(n){clearTimeout(Doc.hoverTimer);Doc.changeCurrentParagraph(n);var t=Doc.configurePulltab(n),i=$(n).offset();t.hide();t.css("top",i.top+4);t.css("left","35px");t.show()},getPreviousParagraphWithCite:function(n){var t=function(n){var r=n.attr("data-cites"),i;return r&&r!=""&&r!="[]"?n:(i=n.prev(),i.text()==n.text())?undefined:i?t(i):undefined};return t(n)},enterParagraph:function(n){if(!$("#pulltab").is(":visible")){var t=$(this);if(Doc.hoveredParagraph!=t){if(Doc.citeForElement(n.target)==""&&(t=Doc.getPreviousParagraphWithCite(t),!t))return!0;Doc.hoverTimer&&clearTimeout(Doc.hoverTimer);Doc.hidePulltab();Doc.hoveredParagraph=t;Doc.showTools(t)}}},leaveParagraph:function(){Doc.hoverTimer&&clearTimeout(Doc.hoverTimer)},viewSection:function(){var n=Doc.selectedParagraph,t=Doc.pathForElement(n);Doc.markHistoryElement(n);window.location=window.location.search.indexOf("view=section")>0?t:t+"?view=section"},bookmarkSection:function(){var n=Doc.selectedParagraph,t=Doc.pathForElement(n),i=Doc.citeForElement(n),r="Wisconsin Legislature - "+i,u=t;$.browser.firefox?alert("In Firefox, you can just drag the permanent link above to your bookmarks toolbar."):$.browser.opera?alert("In Opera, you can just drag the permanent link above to your bookmarks toolbar, or open the bookmarks sidebar and drag it there."):$.browser.ie?(alert("In Internet Explorer, you can drag the permanent link above to your bookmarks toolbar if it's visible. (Right click on your toolbar and make sure 'Favorites bar' is checked.) Or, depending on the version, you can open the bookmarks window (with the star), pin it with the button in the upper left, and drag the permanent link there."),window.external.AddFavorite(u,r)):alert("In your browser, you can just drag the permanent link above to your bookmarks toolbar.")},showTools:function(n){if(!Doc.isLoading){var t=n.offset(),i=$("div#tools"),r=i.offset();if(t.top==r.top)return!0;i.show().clearQueue().animate({top:t.top,queue:!1},300)}},hidePulltab:function(){$("div#pulltab").hide()},hideTools:function(){$("div#tools").hide()},configurePulltab:function(n){var t=$("div#pulltab"),i=Doc.citeForElement(n),g=i.replace(/[^/]+\//i,""),r=Doc.getDoctype(),nt=t.find("#pulltab_cite"),v,y,p,w,o,f,b,s,k,d,l,a,tt,u;if(nt.text(g),Doc.getHasPDF()?(v=t.find("#pulltab_pdf_view"),v.attr("href","/document/"+i+".pdf"),y=n.attr("data-page"),p=t.find("#pulltab_page"),p.text(y)):t.find("#pulltab_pdf").hide(),r!=="statutes"&&t.find(".statutes").hide(),r!=="administrativecode"&&t.find(".administrativecode").hide(),r==="administrativecode"&&(w=Doc.getAgency(),o=Doc.getChapterGroup(),t.find(".pulltab_chapter").attr("href","/search/AdministrativeCodeByChapter?chapter="+i),t.find(".pulltab_section").attr("href","/search/AdministrativeCodeBySection?section="+i),t.find(".pulltab_agency").attr("href","/search/AdministrativeCodeByAgency?agency="+w),f=t.find(".pulltab_chaptergroup"),o?(f.show(),f.attr("href","/search/AdministrativeCodeByChapterGroup?chapterGroup="+o)):f.hide()),r==="statutes"&&(t.find(".pulltab_chapter").attr("href","/search/StatutesByChapter?chapter="+i),t.find(".pulltab_section").attr("href","/search/StatutesBySection?section="+i)),b=t.find("#pulltab_top"),b.attr("href",Doc.getOwnerPath()),s=t.find("#pulltab_references"),k=t.find("#pulltab_toggle_references"),Doc.getShowReferences()?(s.attr("href","/search/refs?q="+escape(i)),Doc.updateReferenceToggleLink()):(s.hide(),k.hide()),n){var e=t.find("#pulltab_xref"),h=t.find("#pulltab_secaff"),c=n.attr("data-section");c?(d=Doc.getPath(),l=d.match(/^\/(\d{4})/),a=l?r+"/"+l[1]+"/"+c:r+"/"+c,Doc.getShowCrossReferences()?e.attr("href","/search/xref?q="+escape(a)):e.hide(),Doc.getShowSectionsAffected()?h.attr("href","/search/secaff?q="+escape(a)):(e.hide(),h.hide())):(e.hide(),h.hide())}return t.find("#pulltab_permalink").attr("href","/document/"+i),t.find("#pulltab_permalink_text").text(i),t.find("#pulltab_bookmark_text").text("Bookmark "+i),tt=t.find("#pulltab_view"),u=t.find("#pulltab_view_text"),window.location.search.indexOf("view=section")>0?u.html("View full document"):r=="statutes"||r=="administrativecode"?u.html("View just this citation"):r=="townlawforms"?u.html("View just this form"):u.html("View just this section"),t},configContent:function(){Doc.getShowReferences()&&Doc.alwaysShowReferences?$("div#document .reference").show():$("div#document .reference").hide()},resize:function(){var n,i,t;Doc.hidePulltab();n=document.getElementById("top");n!=null&&(i=n.offsetHeight,t=document.getElementById("contentFrame"),t!=null&&(t.style.marginTop=i+"px"))},toggleReferences:function(){if(Doc.alwaysShowReferences=!Doc.alwaysShowReferences,Doc.updateReferenceToggleLink(),Doc.getShowReferences()){var n=$("div#document .reference");Doc.alwaysShowReferences?n.show():(n.hide(),$(Doc.selectedParagraph).find(".reference").show())}},updateReferenceToggleLink:function(){var n=$("#pulltab_toggle_references_text");Doc.alwaysShowReferences?n.html("Hide reference lines"):n.html("Show reference lines")},getQueryString:function(){var t=[],u=unescape(location.search.substring(1)),i=u.split("&"),r,n;for(r in i)n=i[r].split("="),t[n[0]]=n[1];return t},doSearchHighlighting:function(){var u=Doc.getQueryString(),n=u.q,t,i,r;if(!n&&(n==undefined&&document.referrer&&(t=document.referrer.match(/[?&]q=([^&]+)/),t&&(n=t[1])),n!=undefined&&n!="")){n=unescape(n).replace(/\+/g," ");i=Doc.parseSearchTerms(n);for(r in i)$("body").highlight(i[r])}},parseSearchTerms:function(n){for(var e=n.match(/(\u0022[^\u0022]*\u0022)|([^\u0022\s]+(\s|$))/g),o=["about","are","from","how","that","the","this","was","what","when","where","who","will","with","the","and"],u=[],i,f,r,t=0;t<e.length;t++)if(i=e[t].replace(/^[\s\u0022\u0027+-][\s\u0022\u0027+-]*/,"").replace(/[\s*~\u0022\u0027][\s*~\u0022\u0027]*$/,"").toLowerCase(),!(i.length<=2)){for(f=!1,r=0;r<o.length;r++)if(i==o[r]){f=!0;break}f!==!0&&(u[u.length]=i)}return u},clearSearchHighlighting:function(){$(".searchHit").removeClass("searchHit")},clearSectionHighlighting:function(){$(".highlighted").removeClass("highlighted").animate({backgroundColor:"#fff"},1e3)},clearHighlighting:function(){Doc.clearSearchHighlighting();Doc.clearSectionHighlighting()},loadPreferences:function(){var u=$.cookie("Preferences"),n,i,t,r;if(u){for(n={},i=u.split("&"),t=0;t<i.length;t++)r=i[t].split("="),n[r[0]]=r[1];n.alwaysShowReferences=="True"&&(Doc.alwaysShowReferences=!0);n.warnWhenLeavingSite=="False"&&(Doc.warnWhenLeavingSite=!1);n.openExternalLinksInNewWindows=="False"&&(Doc.openExternalLinksInNewWindows=!1);n.preferPdf=="True"&&(Doc.preferPdf=!0)}},isIE6:function(){return $.browser.msie&&parseInt($.browser.version)<=6},isIE:function(){return $.browser.msie},initMenu:function(){var n=$(".dropMenu");n.on("click","a",Doc.menuLinkClick)},toggleMenu:function(n){console.log("Main menu was clicked",n);var i={duration:300,easing:"linear"},t=$(".d1"),r=$("#top").height(),u=t.height();return t.is(":visible")?$(".dropMenu").slideUp(i):(t.slideDown(i),Doc.timedHide(t)),!1},menuLinkClick:function(){var n=$(this).attr("href"),t={duration:300,easing:"linear"},r,i;if(n&&n.indexOf("#")!=-1&&n.indexOf("#")!=n.length-1)return(r=$(this).closest("div.dropMenu"),i=$(n),i.is(":visible"))?!1:(r.hasClass("d1")?($(".d3").slideUp(t),$(".d2").slideUp(t)):r.hasClass("d2")&&$(".d3").slideUp(t),$(i).slideDown(t),Doc.timedHide(i),!1)},timedHide:function(n){var t={duration:300,easing:"linear"},i=n.closest(".dropMenu");Doc.menuTimer&&window.clearTimeout(Doc.menuTimer);Doc.menuTimer=window.setTimeout(function(){i.slideUp(t)},5e3)},startup:function(){var i,u,t,e,n,f,r;if(Doc.isIE6())return!1;if(i=200,$(".more-container").each(function(){var t=$(this),n=t.children(".more-wrap"),u=n.height(),r;u>=i?(r=t.find(".more-link"),t.find(".more-gradient").show(),n.css("height",i+"px"),r.append("<a href='#'>View more...<\/a>"),r.children("a").bind("click",function(){var t=n.height();return t==i?(n.animate({height:u},"normal"),$(this).text("View less"),n.children(".more-gradient").fadeOut()):(n.animate({height:i},"normal"),$(this).text("View more..."),n.children(".more-gradient").fadeIn()),!1})):t.find(".more-gradient").hide()}),u=Doc.getHash(),u.charAt(0)=="/"&&Doc.isIE()&&!Doc.loadedOnce&&(window.location=u),Doc.loadPreferences(),t=Doc.getPath(),Doc.inFrame()?(Doc.setTitle(t),$(".inframe").show(),$("#frame_tree",parent).ready(function(){var n=function(){parent.tree.expandPath?parent.tree.expandPath(t):setTimeout(n,500)};setTimeout(n,50)})):$(".outframe").show(),(t=="/"||t=="")&&$(".searchInside").hide(),Doc.resize(),$(window).resize(function(){Doc.resize()}),$("#pulltab").hide(),$("#tools").hide(),Doc.doSearchHighlighting(),Doc.getPageKind()=="section"){t==""||Doc.loadedOnce||Doc.openPath(t);n=$("div#document");n.on("click","div",Doc.clickParagraph);n.on("mouseenter","div",Doc.enterParagraph);n.on("mouseleave","div",Doc.leaveParagraph);n.on("click","a",Doc.sectionLinkClick);Doc.configContent();Doc.getScrolling()=="true"&&($("#document").bind("infinitescroll.finish",Doc.configContent),$(".navigation").remove(),$(window).infinitescroll({appendTo:"#document"}),$(window).scroll(function(){$("#tools").hide();$("#pulltab").hide()}),e=$("div#top-button a"),e.attr("href",Doc.getOwnerPath()))}else{n=$("div#contentFrame");n.on("click","a",Doc.linkClick);f=location.hash;f!=""&&Doc.scrollToHash(f,!0)}Doc.initMenu();$(".menu-link").click(function(){return Doc.toggleMenu()});Doc.preferPdf&&$("span.hasPdfLink").each(function(){var n=$(this),t=n.data("pdf-link");t&&n.html(t)});r=$("#disclaimerFrame");r&&r.contents().text().match(/\w/)||r.hide();Doc.isLoading=!1;Doc.loadedOnce=!0}};jQuery.fn.extend({highlight:function(n){function t(n,i){var o=0,e,u,r;if(n.nodeType==3){if(e=n.data.toUpperCase().indexOf(i),e>=0){u=document.createElement("span");u.className="searchHit";var f=n.splitText(e),h=f.splitText(i.length),s=f.cloneNode(!0);u.appendChild(s);f.parentNode.replaceChild(u,f);o=1}}else if(n.nodeType==1&&n.childNodes&&!/(script|style)/i.test(n.tagName))for(r=0;r<n.childNodes.length;++r)r+=t(n.childNodes[r],i);return o}return this.each(function(){t(this,n.toUpperCase())})}});$(document).ready(function(){Doc.startup()});Slate=Slate||{};Slate.Queue=function(){this._q=[];this._qRunning=!1;this._qInitialized=!1;this._qExecNext=function(){if(this._qInitialized){this._qRunning=!0;var n=this._q.shift();n?n($.proxy(this._qExecNext,this)):this._qRunning=!1}};this.initialize=function(){this._qInitialized||(this._qInitialized=!0,this._qExecNext())};this.enqueue=function(n){this._q.push(n);this._qRunning||this._qExecNext()}}