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:"GET",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:"GET",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,a)),n.SectionTitle2(e(t,h)))}}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:"GET",url:printViewUrl,data:printViewFilter,cache:!1,success:function(n){isFileDownloadProcessed(n)}})}function ui(){return sw.isXs()||sw.isSm()?$("#topLeftPanel").outerHeight()+$("#mobileToolbar").outerHeight()+dt:$("#DesktopToolbar").outerHeight()+dt}function g(){var n,i,t;if(!vi&&!k&&!b){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),ni.insertBefore(n),b=1,sw.ajax({type:"GET",url:lazyLoadContentUrl,data:lazyLoadFilter,cache:!0,success:function(t,i,r){var f=r.getResponseHeader("XmlTag"),u=$(t);switch(f){case"derivations":$(".derTbl").append(u);n.remove();break;case"toBeTabled":$(".toBeTabled").append(u);n.remove();break;default:n.replaceWith(u)}gt===0&&nt(window.location.hash);$("#ToggleAnnotate").length>0&&($("#ToggleAnnotate").prop("checked")?$(".amendNote").show():$(".amendNote").hide());tt();b=0;ni.remove();resizePanels();sw.isTouchDevice||disableScrollTracking!=="0"||g()}}))}}function yi(){ct={};$("#toc a").each(function(n,t){var i=$(t).attr("href");i.indexOf("#")===0&&(ct[i]=1)})}function pi(n){if(!n)return 0;for(var t in ct)if(t===n)return 1;return 0}function nt(n){var t,r,i;return pi(n)&&(n=n.replace(".",""),t=$(ft(n)),t.length===0&&(t=$('a[name="'+ft(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")),gt=1,isScrolled=1,!0):!1}function tt(){$("#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 pt(){if(sw.isMobile()){$("#nav").height($("#topLeftPanel").outerHeight()+$("#mobileToolbar").outerHeight());return}if(et=$("#sidebar").width()-20,i=f.height(),disableScrollTracking==="1")t=i-ot-u-40,v=t-$("#topLeftPanel").outerHeight()-$("#tocTitle").outerHeight()-$("#tocButton").outerHeight();else{if($("#nav").hasClass("affix-top"))t=i-$("#breadcrumb").outerHeight()-u-(lt.offset().top<i?70:45);else{var n=$("#fs").outerHeight();t=n>i?i-20:n-50;f.scrollTop()+t>lt.offset().top&&(t=i-ai-30)}v=t-$("#topLeftPanel").outerHeight()-$("#tocTitle").outerHeight()-$("#tocButton").outerHeight()}$("#tocNav").width(et-2).animate({height:v},{queue:!0,duration:0});$("#nav").width(et).animate({height:t},{queue:!0,duration:0});$("#DesktopToolbar").width($("#fragview").outerWidth())}function hi(){h=Math.floor($("#topLeftPanel").outerWidth()/8.2);a=h}function it(){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 p(){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 wt(){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 bt(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 rt(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 ut(n){let t=".status";n.toLowerCase().indexOf("prov")>-1&&(t=".provision");$(n+" a.timeline-popover "+t).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 kt(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 ft(n){return n}function wi(){var n=$(window).scrollTop();y?(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+ot?(t=i-ti,$("#nav").css({height:t+"px",position:"fixed",top:"15px",bottom:"15px"})):(t=i-u-ot-ti,$("#nav").css({height:t+"px",position:"relative"})),v=t-$("#topLeftPanel").outerHeight()-$("#tocTitle").outerHeight()-$("#tocButton").outerHeight(),$("#tocNav").css({height:v+"px"}))}var n,fi,ei,oi,d,yt,b;sw.isMobile=function(){return sw.isXs()||sw.isSm()};validStartDate=parseServerDate(validStartDate);var dt=0,w=0,gt=0,b=0,ni=$('<div class="ajax-loading">&nbsp;<\/div>'),k=0,a,h,v,et,u=$("#siteHeader").outerHeight()+$("#topSection").outerHeight();$("#mastHeadRow").length>0&&(u+=$("#mastHeadRow").outerHeight());var ot=$("#breadcrumb").outerHeight(),bi=u+143,f=$(window),i=f.height(),st=f.width(),t=i-u-10,t=500,ti=30,ht=0,s=$.getQueryParameters(),o={},c,ct={},l="",y=sw.isMobile(),li=54,lt=$(".footer"),ai=lt.outerHeight(!0),r=$("#tocNav"),at=0,vt="",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:"GET",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,g());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,h)),HideSearchWithin:function(){return(n.Show.SearchWithin(0),!$("#searchWithinListTab").is(":visible"))?($("#searchWithinTabs").hide(),!1):(s.ViewType&&delete s.ViewType,s.Phrase&&delete s.Phrase,window.location=exitSearchUrl+"?"+$.param(s),!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),rt(0),!1},ShowDesktopProvTimeline:function(){return isProvisionView?(n.Show.DesktopDocTimeline(!1),n.Show.DesktopProvTimeline(!0),rt(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),bt(0),!1},ShowMobileProvTimeline:function(){return isProvisionView?(n.Show.MobileDocTimeline(!1),n.Show.MobileProvTimeline(!0),bt(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=kt("Timeline",i)+window.location.hash;History.pushState({state:t},document.title,t);rt(isProvisionView)},ShowMobileToc:function(){n.Show.Sidebar(!0);n.Show.Toc(!0);n.Show.TopLeftPanel(!1);n.Show.MobileToolbar(!1);$("#topSection").hide();c=$(window).scrollTop();var t=$("#tocNav .nav .active");l=t.length>1?$(t.get(1)).attr("href"):t.attr("href");$("html,body").addClass("mobile-modal-open");setTimeout(function(){if(l&&($("#tocNav .nav .active").removeClass("active"),t=$('#tocNav .nav li a[href="'+ft(l)+'"').addClass("active"),l="",!si(t,r))){var n=t.offset(),i=n?n.top:0,u=r.offset().top;r.scrollTop(r.scrollTop()+(i-u)-50)}},100);it()},HideMobileToc:function(){p();$("html,body").removeClass("mobile-modal-open");$(window).scrollTop(c);$("#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);bt(isProvisionView);$("#topSection").hide();c=$(window).scrollTop();$("html,body").addClass("mobile-modal-open");it()},HideMobileTimeline:function(){p();$("html,body").removeClass("mobile-modal-open");$(window).scrollTop(c);$("#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);tt()}},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=kt("ProvIds",n)+(t.length===1?"#"+n:""),window.location=u):(currViewFilter.ProvIds=n,sw.postForm(currViewUrl,currViewFilter,"")),!1},OnPrintClick:function(){c=$(window).scrollTop();$("#printModal").on("shown.bs.modal",function(){ci()});return w||(w=1,initPrintForm()),$("#printModal").modal("show"),!1}};$(document).on("click",".legis-download",function(){var n=$(this);return w?ri(n):$("#printModal .modal-body").load($("#printLink").attr("href")+"&partial=1",function(){w=1;initPrintForm();ri(n)}),!1});ii(provTitle);$("#printModal").on("hidden.bs.modal",function(){$(window).scrollTop(c)});disableScrollTracking==="0"&&(fi=ui(),$("body").css("position","relative"),$("#tocNav").swscrollspy({offset:fi,onChange:function(){var i=$("#toc").find("a.active").last(),t="",u,f;at===1?(t=vt,setTimeout(function(){at=0;vt=""},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,a)),n.SectionTitle(t),n.SectionTitle1(e(t,a)),n.SectionTitle2(e(t,h))):(n.SectionTitle(provTitle),n.SectionTitle1(e(provTitle,a)),n.SectionTitle2(e(provTitle,h)))}}));sw.isMobile()?(p(),s.Timeline==="On"&&n.ShowMobileTimeline()):(wt(),s.Timeline==="On"&&(n.Show.DesktopTimeline(!0),rt(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(){ht=1;y=sw.isMobile();setTimeout(function(){sw.isMobile()?(p(),it()):(wt(),resizePanels());tt()},200)});f.on("resize",function(){i=f.height();st=f.width();y=sw.isMobile();var t=$(".top-bar").length>0?$(".top-bar").outerHeight():0;if(u=y?$("#topSection").outerHeight()+t:$("#siteHeader").outerHeight()+$("#topSection").outerHeight()+t,hi(),ht){ht=0;return}setTimeout(function(){sw.isMobile()?sw.isTouchDevice&&(n.Show.MobileTimeline()||n.Show.Toc())?it():p():wt();resizePanels();ci();tt()},200)});resizePanels=function(){var n,t;pt();disableScrollTracking==="0"&&(n=$("#colLegis").width(),st<n?$(".table-responsive").parent().css({width:st-62+"px",display:"block"}):(t=n-20,$(".table-responsive").parent().css({"max-width":n+"px"}),$(".img-responsive").each(function(n,i){var r=$(i),u=r.attr("width");!isNaN(u)&&parseInt(u)>t?r.css({width:t+"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>=(y?li:$("#sidebar").position().top)){if(i=$("#nav"),i.addClass("affix").removeClass("affix-top"),sw.isMobile()){$("#colLegis").css({"margin-top":$("#nav").outerHeight()+"px"});return}setTimeout(pt,100)}else $("#nav").addClass("affix-top").removeClass("affix"),$("#colLegis").css({"margin-top":"0px"}),setTimeout(pt,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)});ut("#docTimeline");ut("#provTimeline");ut("#mobileDocTimeline");ut("#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()})});yt=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<=d&&d<i&&(k=1,window.location=t.Item2+"&Timeline=On")}k||alert("Could not find any version in force as at "+(sw.isMobile()?$("#versionDateHidden").val():$("#versionDatePicker").val())+".")};$("#versionForm").submit(function(){return yt(),!1});$(".datepicker-trigger").datepicker({autoclose:!0,format:"dd M yyyy",disableTouchKeyboard:!1}).each(function(n,t){validStartDate.getFullYear()!==1753&&($(t).datepicker("setDate",validStartDate),d=validStartDate)}).on("changeDate",function(n){d=n.date;sw.isMobile()&&yt()});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(),at=1,vt=$.trim($(this).text()),t=this,i=t.href.substring(t.href.indexOf("#")+1),l="#"+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),k=1,window.location.href=kt("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(){nt(window.location.hash)});yi();setTimeout(function(){var n,t,i,u,f;(window.location.hash?(t=nt(window.location.hash),n=window.location.hash):fragmentPath.length>0&&(t=nt(fragmentPath.split(",")[0]),n=fragmentPath.split(",")[0]),n&&t)&&(n=n.replace("#",""),n=n.replace(".",""),i=$('a[href="'+ft("#"+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")});b=0;sw.isTouchDevice||disableScrollTracking!=="0"?($("#loadingIndicator").hide(),$(window).scroll(function(){$(window).scrollTop()+$(window).height()>$(document).height()-100&&g()})):g();$("#legisContent img").on("error",function(){const n=$(this);n.replaceWith($('<span style="display: inline-block;background-color: #ddd;padding: 5px; border: 1px solid #999;">').text("No Image Available"));const t=new Image;t.src=n.attr("src")+"?tocSysId="+tocSysId});$("#legisContent img").on("load",function(){if(console.log(this.naturalWidth),this.naturalWidth===0){const n=$(this);n.replaceWith($('<span style="display: inline-block;background-color: #ddd;padding: 5px; border: 1px solid #999;">').text("No Image Available"));const t=new Image;t.src=n.attr("src")+"?tocSysId="+tocSysId}})});$(function(){window.location.href.indexOf("Print")>-1&&initPrintForm();typeof isPrintView!="undefined"&&isPrintView&&initPrintView()})