function initPrintForm(){function n(n){var t=[],u=$(".print-filter input:checked"),i,r,f;if(u.each(function(n,i){t.push($(i).val())}),i=u.length,i===0){alert("Please select at least 1 item to print");return}return r=$(".print-filter input").length,i===r?t=["all-.","toc-."]:i!==r-1||$("#tocCheck").prop("checked")||(t=["all-."]),printViewFilter.ViewType="Print",printViewFilter.PrintType=n,printViewFilter.ProvIds=t.join(","),n==="html"?sw.postForm(printViewUrl,printViewFilter,"_blank"):(f=sw.getLoadingCover("loadingCover",sw.isXs()?"body":"#Main"),f.show(),sw.ajax({type:"POST",url:printViewUrl,data:printViewFilter,cache:!1,success:function(n){isFileDownloadProcessed(n)}})),!0}var t={onSelectAllClick:function(){$(".print-filter input").prop("checked",!0)},onClearAllClick:function(){$(".print-filter input").prop("checked",!1)},onPrintToHtmlClick:function(){return n("html")},onPrintToPdfClick:function(){return n("pdf")},onPrintToWordClick:function(){return n("word")}};ko.applyBindings(t,$(".print-form").get(0));$(':checkbox[id^="PartID_"]').click(function(){var n=$(this).attr("id").replace("PartID_","");checkAll(n);GetContent()});$(':checkbox[id^="PartID2_"]').click(function(){var n=$(this).attr("id").replace("PartID2_","");checkAll2(n);GetContent()});$(':checkbox[id^="PartID_"]:checked').each(function(){$(this).trigger("click").trigger("click")});$(":checkbox.childID").click(function(){uncheckPart2($(this).attr("data-id2"));uncheckPart($(this).attr("data-id"));GetContent()});$(".displayText").click(function(){var n=$(this).hasClass("displayText")?$(this).attr("data-id"):$(this).parent().attr("data-id");return showProvision(n),!1});$(".displayText2").click(function(){var n=$(this).hasClass("displayText2")?$(this).attr("data-id"):$(this).parent().attr("data-id");return showProvision2(n),!1})}function initPrintView(){$(document).on("click",".legis-download",function(){var n=$(this),t;return printViewFilter.PrintType=n.attr("data-PrintType"),printViewFilter.ProvIds=n.attr("data-ProvIds")+".",printViewFilter.ProvIds==="all-."&&(printViewFilter.ProvIds+=",toc-."),t=sw.getLoadingCover("loadingCover",sw.isXs()?"body":"#Main"),t.show(),sw.ajax({type:"POST",url:printViewUrl,data:printViewFilter,cache:!1,success:function(n){isFileDownloadProcessed(n)}}),!1})}function isFileDownloadProcessed(n){var t=sw.getLoadingCover("loadingCover",sw.isXs()?"body":"#Main");t.show();sw.ajax({type:"POST",url:sw.getRootPath()+"FileDownload/IsProcessed",data:{fileDownloadTaskSysId:n},cache:!1,success:function(i){i==="1"?(t.hide(),sw.postForm(sw.getRootPath()+"FileDownload/DownloadFile",{fileDownloadTaskSysId:n},"")):i==="0"&&setTimeout(function(){isFileDownloadProcessed(n)},2e3)}})}function showProvision(n){for(var i=getElementsByClassName("showText_"+n),r=$(".displayText[data-id='"+n+"']").get(0),t=0;t<i.length;t++)i[t].style.display=="block"?(i[t].style.display="none",r.innerHTML="<span class='fa fa-caret-right'><\/span>"):(i[t].style.display="block",r.innerHTML="<span class='fa fa-caret-down'><\/span>")}function showProvision2(n){for(var i=getElementsByClassName("showText2_"+n),r=$(".displayText2[data-id='"+n+"']").get(0),t=0;t<i.length;t++)i[t].style.display=="block"?(i[t].style.display="none",r.innerHTML="<span class='fa fa-caret-right'><\/span>"):(i[t].style.display="block",r.innerHTML="<span class='fa fa-caret-down'><\/span>")}function getElementsByClassName(n){var i,r,t,u;for(i=document.all?document.all:document.getElementsByTagName("*"),r=[],t=0,u=i.length;t<u;t++)i[t].classList.contains(n)&&(r[r.length]=i[t]);return r}function ckcount(){var n=document.getElementsByName("item"),r=document.getElementById("limitId").checked,t=0;for(i=0;i<n.length;i++)n[i].checked==!0&&t++;sessionStorage.ckcount=t}function setId(){var t=document.getElementById("limitId").checked,n=document.getElementById("headId").checked;n==!0&&(sessionStorage.title=document.getElementById("titleId").value,sessionStorage.chapter=document.getElementById("chapId").value);sessionStorage.limitId=t;sessionStorage.headId=n}function checkAll(n){var r=document.getElementById("PartID_"+n),i=$(".childID[data-id='"+n+"']").get(),t;if(r.checked==!0)for(t=0;t<i.length;t++)i[t].checked=!0;else for(t=0;t<i.length;t++)i[t].checked=!1}function checkAll2(n){var r=document.getElementById("PartID2_"+n),i=$(".childID[data-id2='"+n+"']").get(),t;if(r.checked==!0)for(t=0;t<i.length;t++)i[t].checked=!0;else for(t=0;t<i.length;t++)i[t].checked=!1}function uncheckPart(n){var r=document.getElementById("PartID_"+n),t,u,i;if(r!==null)for(t=$(".childID[data-id='"+n+"']").get(),u=0,i=0;i<t.length;i++)t[i].checked==!1?r.checked=!1:(u++,u==t.length&&(r.checked=!0))}function uncheckPart2(n){var r=document.getElementById("PartID2_"+n),t,u,i;if(r!==null)for(t=$(".childID[data-id2='"+n+"']").get(),u=0,i=0;i<t.length;i++)t[i].checked==!1?r.checked=!1:(u++,u==t.length&&(r.checked=!0))}function check(){var n=document.getElementsByName("item"),t=document.getElementsByName("partItem"),r=document.getElementById("limitId"),u=document.getElementById("headId");for(u.checked==!1&&(u.checked=!0),r.checked==!1&&(r.checked=!0),i=0;i<n.length;i++)n[i].checked=!0;for(i=0;i<t.length;i++)t[i].checked=!0;setId()}function uncheck(){var n=document.getElementsByName("item"),t=document.getElementsByName("partItem"),r=document.getElementById("limitId"),u=document.getElementById("headId");for(u.checked==!0&&(u.checked=!1),r.checked==!0&&(r.checked=!1),i=0;i<n.length;i++)n[i].checked=!1;for(i=0;i<t.length;i++)t[i].checked=!1;setId()}function checkboxes(){var n=document.getElementsByName("item").length;document.getElementById("totalcnt").value=n}function validation(){var t,i,n;for(totalcount=0,t=document.getElementsByTagName("input"),i=0,n=0;n<t.length;n++)t[n].type=="checkbox"&&t[n].checked==!0&&totalcount++,t[n].type=="checkbox"&&i++;document.getElementById("totcount").value=totalcount;setId();checkboxCt()}function checkboxCt(){var t=document.getElementsByName("item"),r=document.getElementsByName("partItem"),n=0,u=t.length+r.length;for(i=0;i<t.length;i++)t[i].checked==!0&&n++;for(i=0;i<r.length;i++)r[i].checked==!0&&n++;sessionStorage.val=n;sessionStorage.flag=u!=n?0:-1}function CheckItems(){var r=document.getElementById("ckItem").value,t=r.replace("[","").replace("]","").split(","),n=document.getElementsByName("item");for(i=0;i<n.length;i++)for(j=0;j<t.length;j++)if(n[i].value==t[j].replace(/^\s+|\s+$/g,"")){n[i].checked=!0;break}}function GetContent(){document.getElementById("message").style.visibility="hidden"}var resizePanels,initPrintForm;(function(n,t,i,r){var c=function(n,t){return parseInt(n,10)+parseInt(t,10)},l=function(t){for(var f,o,e=[],r=0;r<t.length;r++){var s=t[r],u=n(s).attr("href"),i=n(u.substring(u.indexOf("#")));i.length>0&&(f=Math.floor(i.offset().top),o=f+Math.floor(i.outerHeight()),e.push({element:i,hash:u,top:f,bottom:o}))}return e},a=function(t,i){for(var u,r=0;r<t.length;r++)if(u=n(t[r]),u.attr("href")===i)return u},s=function(t,i,r){for(var f,u=0;u<t.length;u++)f=n(t[u]),f.attr("href")!==r&&f.removeClass(i.activeClass)},f="",e,u,o,h={init:function(h){var v={namespace:"scrollspy",activeClass:"active",animate:!1,duration:1e3,offset:0,container:t,replaceState:!1};return h=n.extend({},v,h),o=h.offset,this.each(function(){var y=this,b=n(h.container),v,w,p;for(u=n(y).find("a.nav-link"),v=0;v<u.length;v++){w=u[v];n(w).on("click",function(i){var f=n(this).attr("href"),u=n(f),r;u.length>0&&(r=c(u.offset().top,o),h.animate?n("html, body").animate({scrollTop:r},h.duration):t.scrollTo(0,r),i.preventDefault())})}s(u,h);e=l(u);p=function(){for(var l,i,v={top:c(n(this).scrollTop(),Math.abs(o)),left:n(this).scrollLeft()},t,p,w=0;w<e.length;w++){if(l=e[w],v.top<l.top)break;p=l}if(p!==r){if(i=p.hash,t=a(u,i),t&&(h.replaceState&&history.replaceState({},"","/"+i),s(u,h,""),t.addClass(h.activeClass),t.parent().hasClass("nav-pills")?t.parent().prev().addClass(h.activeClass):t.next().children(":first").addClass(h.activeClass),h.onChange&&f!==i)){h.onChange(l.element,n(y),v);f=i}if(!t&&f!=="exit"&&h.onExit){h.onExit(n(y),v);s(u,h);f="exit";h.replaceState&&history.replaceState({},"","/")}}};b.bind("scroll."+h.namespace,function(){p()});n(i).ready(function(){p()})})},refresh:function(t){o=t;e=l(n(this).find("a.nav-link"))}};n.fn.swscrollspy=function(n){if(h[n])return h[n].apply(this,Array.prototype.slice.call(arguments,1));if(typeof n!="object"&&n)console&&console.log("Method "+n+" does not exist on jQuery.swscrollspy");else return h.init.apply(this,arguments)}})(jQuery,window,document,undefined);$(function(){function ii(t){if(viewMode===4){var i=$("#fragview").outerWidth()-130;t=e(t,i/8);t&&($("#searchWithinProvTab").addClass("active").show().find("a").text(t),n.SectionTitle1(e(t,l)),n.SectionTitle2(e(t,s)))}}function ri(n){printViewFilter.ViewType="Print";printViewFilter.PrintType=n.attr("data-PrintType");printViewFilter.ProvIds=n.attr("data-ProvIds")+".";printViewFilter.ProvIds==="all-."&&(printViewFilter.ProvIds+=",toc-.");var t=sw.getLoadingCover("loadingCover",sw.isXs()?"body":"#Main");t.show();sw.ajax({type:"POST",url:printViewUrl,data:printViewFilter,cache:!1,success:function(n){isFileDownloadProcessed(n)}})}function ui(){return sw.isXs()||sw.isSm()?$("#topLeftPanel").outerHeight()+$("#mobileToolbar").outerHeight()+kt:$("#DesktopToolbar").outerHeight()+kt}function d(){var n,i,t;if(!vi&&!b&&!w){if(n=$("div.dms:first"),n.length===0){resizePanels();$("#loadingIndicator").hide();return}$("#loadingIndicator").show();i=n.attr("data-field");t=n.attr("data-term");i==="seriesId"&&(lazyLoadFilter.SeriesId=t,fragments&&(lazyLoadFilter.FragSysId=fragments[t].Item1,lazyLoadFilter._=fragments[t].Item2),gt.insertBefore(n),w=1,sw.ajax({type:"GET",url:lazyLoadContentUrl,data:lazyLoadFilter,cache:!0,success:function(t,i,r){var u=r.getResponseHeader("XmlTag");switch(u){case"derivations":$(".derTbl").append(t);n.remove();break;case"toBeTabled":$(".toBeTabled").append(t);n.remove();break;default:n.replaceWith(t)}dt===0&&g(window.location.hash);$("#ToggleAnnotate").length>0&&($("#ToggleAnnotate").prop("checked")?$(".amendNote").show():$(".amendNote").hide());nt();w=0;gt.remove();resizePanels();sw.isTouchDevice||disableScrollTracking!=="0"||d()}}))}}function yi(){ht={};$("#toc a").each(function(n,t){var i=$(t).attr("href");i.indexOf("#")===0&&(ht[i]=1)})}function pi(n){if(!n)return 0;for(var t in ht)if(t===n)return 1;return 0}function g(n){var t,r,i;return pi(n)&&(n=n.replace(".",""),t=$(ut(n)),t.length===0&&(t=$('a[name="'+ut(n.substr(1))+'"]')),t.length>0)?(r=t.offset(),r&&(i=r.top,sw.isXs()||sw.isSm()?i-=160:n.indexOf("pr")>-1&&(i-=20),$(window).scrollTop(i),$(window).trigger("scroll")),dt=1,isScrolled=1,!0):!1}function nt(){$("#tocNav").swscrollspy("refresh",ui())}function e(n,t){var i=n;return i.length<=t?i:(i=i.substr(0,t-4),i+"...")}function si(n,t){var i=t.offset().top,f=i+t.height(),r=n.offset(),u=r?r.top:0,e=u+30;return e<=f&&u>=i}function yt(){if(sw.isMobile()){$("#nav").height($("#topLeftPanel").outerHeight()+$("#mobileToolbar").outerHeight());return}if(ft=$("#sidebar").width()-20,i=f.height(),disableScrollTracking==="1")t=i-et-u-40,a=t-$("#topLeftPanel").outerHeight()-$("#tocTitle").outerHeight()-$("#tocButton").outerHeight();else{if($("#nav").hasClass("affix-top"))t=i-$("#breadcrumb").outerHeight()-u-(ct.offset().top<i?70:45);else{var n=$("#fs").outerHeight();t=n>i?i-20:n-50;f.scrollTop()+t>ct.offset().top&&(t=i-ai-30)}a=t-$("#topLeftPanel").outerHeight()-$("#tocTitle").outerHeight()-$("#tocButton").outerHeight()}$("#tocNav").width(ft-2).animate({height:a},{queue:!0,duration:0});$("#nav").width(ft).animate({height:t},{queue:!0,duration:0});$("#DesktopToolbar").width($("#fragview").outerWidth())}function hi(){s=Math.floor($("#topLeftPanel").outerWidth()/8.2);l=s}function tt(){var t=window.innerHeight?window.innerHeight:$(window).outerHeight(),i,r;(n.Show.MobileTimeline()||n.Show.Toc())&&$("#nav").css({height:t+"px"}).addClass("mobile-expanded");i=$("#sidebar").width();$("#nav").width(i);n.Show.Toc()&&$("#tocNav").height(t-89).width(i);n.Show.MobileTimeline()&&(r=221,$("#mobileDocTimeline").height(t-r),$("#mobileProvTimeline").height(t-r))}function y(){n.Show.Sidebar(!0);n.Show.TopLeftPanel(!0);n.Show.Toc(!1);n.Show.MobileTimeline(!1);n.Show.MobileToolbar(!0);var t=177;$("#nav").hasClass("affix-top")&&(t+=10);$("#nav").width($("#sidebar").width()).height(t);$("body").attr("data-offset","200")}function pt(){n.Show.MobileToolbar(!1);n.Show.MobileTimeline(!1);n.Show.Toc(!0);n.Show.TopLeftPanel(!0);$("#topSection").show();$("html,body").removeClass("mobile-modal-open");$("body").attr("data-offset","100")}function ci(){if(sw.isXs())$("#printModal .modal-dialog").css({margin:"0",width:$(window).width()+"px",height:$(window).height()+"px"}),$("#printModal .print-filter").css("height",$(window).height()-179+"px");else{$("#printModal .print-filter").css({height:$(window).height()-260+"px"});var n=$(window).width();n>=1200?n=1024:n-=200;$("#printModal .modal-dialog").css({margin:"",width:n+"px"})}}function wt(n){n?o.expandProvTimelineOnce||(setTimeout(function(){$("#mobileProvTimeline").scrollTop((provTimelineLen-provTimelineIdx)*60-20)},100),o.expandProvTimelineOnce=1):o.expandDocTimelineOnce||(setTimeout(function(){$("#mobileDocTimeline").scrollTop((timelineItems.length-docTimelineIdx)*60-50)},100),o.expandDocTimelineOnce=1)}function it(n){n?o.expandProvTimelineOnce||(setTimeout(function(){$("#provTimeline").scrollLeft(provTimelineIdx*140)},100),o.expandProvTimelineOnce=1):o.expandDocTimelineOnce||(setTimeout(function(){$("#docTimeline").scrollLeft(docTimelineIdx*140)},100),o.expandDocTimelineOnce=1)}function rt(n){$(n+" a.timeline-popover .status").each(function(){var t=$(this),r="hover",i;n.indexOf("#mobile")>-1&&(r="manual",t.click(function(){var i=$(this),t;return i.data("showPopover")===1?!0:($(n+" a.timeline-popover .status").each(function(){$(this).data("showPopover",0);var n=bootstrap.Popover.getInstance(this);n&&n.hide()}),i.data("showPopover",1),t=bootstrap.Popover.getInstance(this),t&&t.show(),!1)}));i={trigger:r,title:t.parent().attr("title"),content:t.parent().attr("data-date")};i.offset=n.indexOf("#mobile")>-1?[-50,10]:[0,-100];new bootstrap.Popover(this,i)})}function bt(n,t){var r=currUrlPath,f,i,e,u;r=r.replaceAll("//","/");f=r.indexOf("#");f>-1&&(r=r.substr(0,f));i=$.getQueryParameters();i[n]=t;e="";i.ViewType&&i.ViewType!==null&&(e=i.ViewType);e.toLowerCase()==="within"&&(delete i.ViewType,i.Phrase&&delete i.Phrase);var s=r.indexOf("?"),o=s>-1?r.substr(0,s):r,h=0;for(u in i)typeof i[u]!="undefined"&&(o+=h===0?"?":"&",o+=u+"="+i[u],h+=1);return o}function ut(n){return n}function wi(){var n=$(window).scrollTop();v?(t=$("#topLeftPanel").outerHeight()+$("#mobileToolbar").outerHeight(),n>u?$("#nav").css({height:t+"px",position:"fixed",bottom:"",top:"0"}):$("#nav").css({height:t+"px",position:"relative"})):(n>u+et?(t=i-ni,$("#nav").css({height:t+"px",position:"fixed",top:"15px",bottom:"15px"})):(t=i-u-et-ni,$("#nav").css({height:t+"px",position:"relative"})),a=t-$("#topLeftPanel").outerHeight()-$("#tocTitle").outerHeight()-$("#tocButton").outerHeight(),$("#tocNav").css({height:a+"px"}))}var n,fi,ei,oi,k,vt,w;sw.isMobile=function(){return sw.isXs()||sw.isSm()};validStartDate=parseServerDate(validStartDate);var kt=0,p=0,dt=0,w=0,gt=$('<div class="ajax-loading">&nbsp;<\/div>'),b=0,l,s,a,ft,u=$("#siteHeader").outerHeight()+$("#topSection").outerHeight();$("#mastHeadRow").length>0&&(u+=$("#mastHeadRow").outerHeight());var et=$("#breadcrumb").outerHeight(),bi=u+143,f=$(window),i=f.height(),ot=f.width(),t=i-u-10,t=500,ni=30,st=0,ti=$.getQueryParameters(),o={},h,ht={},c="",v=sw.isMobile(),li=54,ct=$(".footer"),ai=ct.outerHeight(!0),r=$("#tocNav"),lt=0,at="",ki=window.location.href.toLowerCase().indexOf("wholedoc=1")>-1,vi=!sw.isTouchDevice&&window.location.href.toLowerCase().indexOf("wholedoc=1")===-1;sw.isTouchDevice&&window.location.href.toLowerCase().indexOf("provids=")===-1&&$("#wholeDoc").hide();hi();initAddToCollection();sw.popover("#compareVersions","#compareVersionsPopover","bottom","");sw.popover(".pager-bottom .page-size","#pageSizePopover","bottom","search-within",0);sw.popover(".pager-bottom .page-index","#pageIndexPopover","bottom","search-within",0);$(document).on("click","a",function(){var n=$(this),t;return n.hasClass("non-ajax")?!0:n.parents("#searchWithinList").length===0&&n.parents(".popover.search-within").length===0?!0:(t=n.hasClass("prov")?"prov":"list",History.pushState({state:n.attr("href"),getPartialView:t,provTitle:n.text()},document.title,n.attr("href")),!1)});$("#searchWithinListTab, searchWithinListTab a").click(function(){return $("#searchWithinListTab").addClass("active"),$("#searchWithinProvTab").removeClass("active"),$("#searchWithinList").show(),$("#legisContent").hide(),!1});$("#searchWithinProvTab, searchWithinProvTab a").click(function(){return $("#searchWithinListTab").removeClass("active"),$("#searchWithinProvTab").addClass("active"),$("#searchWithinList").hide(),$("#legisContent").show(),!1});History.Adapter.bind(window,"statechange",function(){var t=History.getState(),r,i;t.data.getPartialView&&(r=sw.getLoadingCover("loadingCover","#main"),r.show(),i=t.url,i+=i.indexOf("?")>-1?"&":"?",i+="getPartialView="+t.data.getPartialView,$("#legisContent").hide(),$(".pager-bottom .page-size, .pager-bottom .page-index").popover("hide"),sw.ajax({method:"POST",url:i,success:function(i){t.data.getPartialView==="list"?($("#searchWithinTabs").show(),$("#searchWithinListTab").show().addClass("active"),$("#searchWithinProvTab").removeClass("active"),$("#legis").length>0&&$("#legisContent").html(""),$("#tocNav").html(i.Toc),$("#searchWithinList").html(i.SearchResult).show(),sw.popover(".pager-bottom .page-size","#pageSizePopover","bottom","search-within",0),sw.popover(".pager-bottom .page-index","#pageIndexPopover","bottom","search-within",0)):($("#searchWithinTabs").show().show(),$("#searchWithinListTab").removeClass("active"),ii(t.data.provTitle),$("#searchWithinList").hide(),$("#legisContent").html(i.Content).show(),$("#provTimeline").html(i.DesktopTimeline),$("#mobileProvTimeline").html(i.MobileTimeline),$("#wholeDoc").show(),exitSearchUrl=i.ExitSearchUrl,isProvisionView=1,n.ShowDesktopProvTimeline(),window.scrollTo(0,0),lazyLoadFilter=i.LazyLoadFilter,d());r.hide()}}))});$("#searchPhrase").focus();n={Show:{Sidebar:ko.observable(showSideBar),TopLeftPanel:ko.observable(!0),MobileToolbar:ko.observable(!0),Legis:ko.observable(!0),Toc:ko.observable($(".device-md").is(":visible")||$(".device-lg").is(":visible")),Timeline:ko.observable($(".device-md").is(":visible")||$(".device-lg").is(":visible")),ActDetails:ko.observable(!0),DesktopTimeline:ko.observable(!1),MobileTimeline:ko.observable(!1),DesktopDocTimeline:ko.observable(isProvisionView===0),DesktopProvTimeline:ko.observable(isProvisionView===1),MobileDocTimeline:ko.observable(isProvisionView===0),MobileProvTimeline:ko.observable(isProvisionView===1),SearchWithin:ko.observable(viewMode===4)},LegisTitle:ko.observable(legisTitle),LegisTitle1:ko.observable(""),SectionTitle:ko.observable(""),SectionTitle1:ko.observable(""),SectionTitle2:ko.observable(e(provTitle,s)),HideSearchWithin:function(){return(n.Show.SearchWithin(0),!$("#searchWithinListTab").is(":visible"))?($("#searchWithinTabs").hide(),!1):(window.location=window.location.href.substr(0,window.location.href.indexOf("&ViewType=Within")),!1)},ShowSearchWithin:function(){return n.Show.SearchWithin(1),n.Show.DesktopTimeline(0),$("#searchPhrase,#searchPhraseMobile").focus(),!1},SearchWithinPhrase:ko.observable(searchWithinPhrase),SubmitSearchWithin:function(t){var u=$(t),i=n.SearchWithinPhrase(),r;return i=i.replaceAll("<","lt;"),i=i.replaceAll(">","gt;"),r=u.attr("action"),r+="&Phrase="+encodeURIComponent(i),viewMode=4,History.pushState({state:r,getPartialView:"list"},document.title,r),document.body.scrollTop=document.documentElement.scrollTop=0,$("#searchPhraseMobile").blur(),!1},ShowDesktopDocTimeline:function(){return n.Show.DesktopDocTimeline(!0),n.Show.DesktopProvTimeline(!1),it(0),!1},ShowDesktopProvTimeline:function(){return isProvisionView?(n.Show.DesktopDocTimeline(!1),n.Show.DesktopProvTimeline(!0),it(1),!1):(sw.bsAlert("Provision Timeline","The Provision timeline is only available when a single provision is being viewed.<br /><br />To view a single provision, select the checkbox next to the provision in the Table of Contents panel and click on 'Get Provisions'."),!1)},ShowMobileDocTimeline:function(){return n.Show.MobileDocTimeline(!0),n.Show.MobileProvTimeline(!1),wt(0),!1},ShowMobileProvTimeline:function(){return isProvisionView?(n.Show.MobileDocTimeline(!1),n.Show.MobileProvTimeline(!0),wt(1),!1):(sw.bsAlert("Provision Timeline","The Provision timeline is only available when a single provision is being viewed.<br /><br />To view a single provision, select the checkbox next to the provision in the Table of Contents panel and click on 'Get Provisions'."),!1)},ToggleDesktopTimeline:function(){var i,t;n.Show.DesktopTimeline(!n.Show.DesktopTimeline());i=n.Show.DesktopTimeline()?"On":"Off";n.Show.SearchWithin(0);t=bt("Timeline",i)+window.location.hash;History.pushState({state:t},document.title,t);it(isProvisionView)},ShowMobileToc:function(){n.Show.Sidebar(!0);n.Show.Toc(!0);n.Show.TopLeftPanel(!1);n.Show.MobileToolbar(!1);$("#topSection").hide();h=$(window).scrollTop();var t=$("#tocNav .nav .active");c=t.length>1?$(t.get(1)).attr("href"):t.attr("href");$("html,body").addClass("mobile-modal-open");setTimeout(function(){if(c&&($("#tocNav .nav .active").removeClass("active"),t=$('#tocNav .nav li a[href="'+ut(c)+'"').addClass("active"),c="",!si(t,r))){var n=t.offset(),i=n?n.top:0,u=r.offset().top;r.scrollTop(r.scrollTop()+(i-u)-50)}},100);tt()},HideMobileToc:function(){y();$("html,body").removeClass("mobile-modal-open");$(window).scrollTop(h);$("#topSection").show();$("#nav").removeClass("mobile-expanded").width($("#sidebar").width())},ShowMobileTimeline:function(){n.Show.Sidebar(!0);n.Show.Toc(!1);n.Show.MobileTimeline(!0);n.Show.TopLeftPanel(!1);n.Show.MobileToolbar(!1);wt(isProvisionView);$("#topSection").hide();h=$(window).scrollTop();$("html,body").addClass("mobile-modal-open");tt()},HideMobileTimeline:function(){y();$("html,body").removeClass("mobile-modal-open");$(window).scrollTop(h);$("#topSection").show();$("#nav").removeClass("mobile-expanded").width($("#sidebar").width())},ToggleActDetails:function(){return n.Show.ActDetails(!n.Show.ActDetails()),!1},ToggleSidebar:function(){var t=$("#toc ul.nav .active"),r,i;return t.length===0&&(t=$("#toc .active")),r=t.first(),i=r.attr("href"),$(".body-content").hasClass("toc-hidden")?$(".body-content").removeClass("toc-hidden"):$(".body-content").addClass("toc-hidden"),n.Show.Toc(!0),n.Show.Sidebar(!n.Show.Sidebar()),resizePanels(),$("#DesktopToolbar").css("width",$("#fragview").outerWidth()+"px"),setTimeout(function(){var n=$(i);if(n.length>0){var t=$(i).offset(),r=$("#DesktopToolbar").outerHeight(),u=t.top-r-30;$(window).scrollTop(u);nt()}},100),!1},GoToTop:function(){return window.location.hash=window.location.hash==="#top"?"top2":"top",!1},OnClearProvisions:function(){return $(".toc input").prop("checked",!1),!1},OnGetProvisions:function(){var t=[],i=$(".toc input:checked"),r,n,u;if(i.each(function(n,i){t.push($(i).val())}),r=i.length,r===0){alert("Please select at least 1 provision");return}return n=t.join(","),n.length<1700?(u=bt("ProvIds",n)+(t.length===1?"#"+n:""),window.location=u):(currViewFilter.ProvIds=n,sw.postForm(currViewUrl,currViewFilter,"")),!1},OnPrintClick:function(){h=$(window).scrollTop();$("#printModal").on("shown.bs.modal",function(){ci()});return p||(p=1,initPrintForm()),$("#printModal").modal("show"),!1}};$(document).on("click",".legis-download",function(){var n=$(this);return p?ri(n):$("#printModal .modal-body").load($("#printLink").attr("href")+"&partial=1",function(){p=1;initPrintForm();ri(n)}),!1});ii(provTitle);$("#printModal").on("hidden.bs.modal",function(){$(window).scrollTop(h)});disableScrollTracking==="0"&&(fi=ui(),$("body").css("position","relative"),$("#tocNav").swscrollspy({offset:fi,onChange:function(){var i=$("#toc").find("a.active").last(),t="",u,f;lt===1?(t=at,setTimeout(function(){lt=0;at=""},200)):(i.length>0&&!si(i,r)&&(u=i.offset().top,f=r.offset().top,r.scrollTop(r.scrollTop()+(u-f)-50)),t=$.trim(i.text()));t?(n.LegisTitle1(e(legisTitle,l)),n.SectionTitle(t),n.SectionTitle1(e(t,l)),n.SectionTitle2(e(t,s))):(n.SectionTitle(provTitle),n.SectionTitle1(e(provTitle,l)),n.SectionTitle2(e(provTitle,s)))}}));sw.isMobile()?(y(),ti.Timeline==="On"&&n.ShowMobileTimeline()):(pt(),ti.Timeline==="On"&&(n.Show.DesktopTimeline(!0),it(isProvisionView)));ei=!1;oi=function(){$("div[data-toggle=popover]").each(function(){$(this).popover("hide")})};$(document).on("touchstart",function(){oi();ei=!1});if(disableScrollTracking==="1")f.on("scroll",function(){wi()});f.on("orientationchange",function(){st=1;v=sw.isMobile();setTimeout(function(){sw.isMobile()?(y(),tt()):(pt(),resizePanels());nt()},200)});f.on("resize",function(){i=f.height();ot=f.width();v=sw.isMobile();var t=$(".top-bar").length>0?$(".top-bar").outerHeight():0;if(u=v?$("#topSection").outerHeight()+t:$("#siteHeader").outerHeight()+$("#topSection").outerHeight()+t,hi(),st){st=0;return}setTimeout(function(){sw.isMobile()?sw.isTouchDevice&&(n.Show.MobileTimeline()||n.Show.Toc())?tt():y():pt();resizePanels();ci();nt()},200)});resizePanels=function(){var t,n;yt();disableScrollTracking==="0"&&(t=$("#colLegis").width(),ot<t?$(".table-responsive").parent().css({width:ot-62+"px",display:"block"}):(n=t-20,$(".table-responsive").parent().css({"max-width":n+"px"}),$(".img-responsive").each(function(t,i){var r=$(i),u=r.attr("width");!isNaN(u)&&parseInt(u)>n?r.css({width:n+"px"}):r.css({width:""})}),$(".table-responsive").each(function(){var i=$(this),t={},r;t=i.width()<i.find(".table").width()?{"max-height":$(window).height()-100,"overflow-y":"auto"}:{"max-height":"none","overflow-y":"initial"};t["max-width"]=n;r=i.parent().prev();r.length>0&&(r.hasClass("p1No")||r.hasClass("sProvP1No"))&&(t["max-width"]=t["max-width"]-44);i.css(t)})))};setTimeout(function(){disableScrollTracking==="1"&&$(".footer").hide();resizePanels()},100);disableScrollTracking==="0"&&$(window).on("scroll",function(){var t=f.scrollTop(),i;if(t>=(v?li:$("#sidebar").position().top)){if(i=$("#nav"),i.addClass("affix").removeClass("affix-top"),sw.isMobile()){$("#colLegis").css({"margin-top":$("#nav").outerHeight()+"px"});return}setTimeout(yt,100)}else $("#nav").addClass("affix-top").removeClass("affix"),$("#colLegis").css({"margin-top":"0px"}),setTimeout(yt,100);t>=201?($("#DesktopToolbar").addClass("affix").removeClass("affix-top"),$("#fragview").css({"margin-top":$("#DesktopToolbar").outerHeight()+"px"}),$("#DesktopToolbar").width($("#fragview").outerWidth())):($("#DesktopToolbar").addClass("affix-top").removeClass("affix"),$("#fragview").css({"margin-top":"20px"}),n.LegisTitle1(""),n.SectionTitle1(""))}).trigger("scroll");$('[data-toggle="tooltip"]').tooltip();$("a[data-toggle=popover]").each(function(){new bootstrap.Popover(this)});rt("#docTimeline");rt("#provTimeline");rt("#mobileDocTimeline");rt("#mobileProvTimeline");$(document).on("click",function(){var n=$(this);n.hasClass("popover")||n.parents(".popover").length>0||$('[aria-describedby^="popover"]:not(#mobileMenuBtn)').each(function(){var n=bootstrap.Popover.getInstance(this);n&&n.hide()})});vt=function(){for(var n=0;n<timelineItems.length;n++){var t=timelineItems[n],r=parseServerDate(t.Item1),i=new Date(2999,11,31);n+1<timelineItems.length&&(i=parseServerDate(timelineItems[n+1].Item1));r<=k&&k<i&&(b=1,window.location=t.Item2+"&Timeline=On")}b||alert("Could not find any version in force as at "+(sw.isMobile()?$("#versionDateHidden").val():$("#versionDatePicker").val())+".")};$("#versionForm").submit(function(){return vt(),!1});$(".datepicker-trigger").datepicker({autoclose:!0,format:"dd M yyyy",disableTouchKeyboard:!1}).each(function(n,t){validStartDate.getFullYear()!==1753&&($(t).datepicker("setDate",validStartDate),k=validStartDate)}).on("changeDate",function(n){k=n.date;sw.isMobile()&&vt()});sw.popover("#versionsButton","#versionsPopover","bottom");sw.popover("#versionsButton2","#versionsPopover","bottom");$("#toc").find(".form-check").click(function(n){n.stopPropagation()});$("#toc").find("a").click(function(t){var t,i,u,f,e,r;return t.target.tagName==="INPUT"&&t.preventDefault(),$(".row-offcanvas").toggleClass("active"),sw.isMobile()&&n.HideMobileToc(),lt=1,at=$.trim($(this).text()),t=this,i=t.href.substring(t.href.indexOf("#")+1),c="#"+i,u=!1,f=document.getElementById(i),f==null?(f=document.getElementsByName(i),f.length>0&&(u=!0)):u=!0,u?(window.location.hash=i,!1):(e=$(this).attr("data-part"),r=e?e:i,r.indexOf("-.")===-1&&(r=r),b=1,window.location.href=bt("ProvIds",r)+"#"+i,!1)});$("#nav, #TocBar, #ButtonRow, .front .actHd, .front .chapNo").trigger("affixed.bs.affix");ko.applyBindings(n,$("#Container").get(0));$("#docTimeline,#provTimeline").each(function(){var n=$(this).find("ul");n.width(n.find("li").length*140)});$("#ToggleAnnotate").change(function(){$(this).prop("checked")?$(".amendNote").show():$(".amendNote").hide()});$("#ToggleShowDiff").change(function(){var n=currUrlPath+currQs;window.location=n.replaceAll("&ShowDiff=on","").replaceAll("&ShowDiff=off","")+(n.indexOf("?")>-1?"&":"?")+"ShowDiff="+($(this).prop("checked")?"on":"off")});$("#mobileToggleAnnotate").click(function(){$("#ToggleAnnotate").prop("checked")?($(".amendNote").hide(),$("#ToggleAnnotate").prop("checked",!1),$(this).text("Show Amendment Annotation")):($(".amendNote").show(),$("#ToggleAnnotate").prop("checked",!0),$(this).text("Hide Amendment Annotation"))});$(window).on("hashchange",function(){g(window.location.hash)});yi();setTimeout(function(){var n,t,i,u,f;(window.location.hash?(t=g(window.location.hash),n=window.location.hash):fragmentPath.length>0&&(t=g(fragmentPath.split(",")[0]),n=fragmentPath.split(",")[0]),n&&t)&&(n=n.replace("#",""),n=n.replace(".",""),i=$('a[href="'+ut("#"+n)+'"'),i.length>0&&(u=i.offset().top,f=r.offset().top,r.scrollTop(r.scrollTop()+(u-f)-50)))},200);$(document).on("click","#legis img",function(){window.open($(this).attr("src"),"Legislation Image","width=800,height=600,location=0,menubar=0")});w=0;sw.isTouchDevice||disableScrollTracking!=="0"?($("#loadingIndicator").hide(),$(window).scroll(function(){$(window).scrollTop()+$(window).height()>$(document).height()-100&&d()})):d()});$(function(){window.location.href.indexOf("Print")>-1&&initPrintForm()})