!function(t){t.TableOfContents=function(e,n,i){var o=this;return o.$el=t(e),o.el=e,o.toc="",o.listStyle=null,o.tags=["h1","h2","h3","h4","h5","h6"],o.init=function(){if(o.options=t.extend({},t.TableOfContents.defaultOptions,i),void 0!==n&&null!=n||(n=document.body),o.$scope=t(n),1==o.$scope.find(o.tags.join(", ")).filter(":first").length){o.starting_depth=o.options.startLevel,o.options.depth<1&&(o.options.depth=1);var e=o.tags.splice(o.options.startLevel-1,o.options.depth);if(o.$headings=o.$scope.find(e.join(", ")),!1!==o.options.topLinks){var s=t(document.body).attr("id");""==s&&(s=o.options.topBodyId,document.body.id=s),o.topLinkId=s}return o.$el.is("ul")?o.listStyle="ul":o.$el.is("ol")&&(o.listStyle="ol"),o.buildTOC(),!0!==o.options.proportionateSpacing||o.tieredList()||o.addSpacing(),o}},o.tieredList=function(){return"ul"==o.listStyle||"ol"==o.listStyle},o.buildTOC=function(){o.current_depth=o.starting_depth,o.$headings.each(function(t,e){var n=this.nodeName.toLowerCase().substr(1,1);(t>0||0==t&&n!=o.current_depth)&&o.changeDepth(n),o.toc+=o.formatLink(this,n,t)+"\n",!1!==o.options.topLinks&&o.addTopLink(this)}),o.changeDepth(o.starting_depth,!0),o.tieredList()&&(o.toc="<li>\n"+o.toc+"</li>\n"),o.$el.html(o.toc)},o.addTopLink=function(e){var n=!0===o.options.topLinks?"Top":o.options.topLinks,i=t("<a href='#"+o.topLinkId+"' class='"+o.options.topLinkClass+"'></a>").html(n);t(e).append(i)},o.formatLink=function(e,n,i){var s=e.id;""==s&&(s=o.buildSlug(t(e).text()),e.id=s);var l="<a href='#"+s+"'";return o.tieredList()||(l+=" class='"+o.depthClass(n)+"'"),l+=">"+o.options.levelText.replace("%",t(e).text())+"</a>"},o.changeDepth=function(t,e){if(!0!==e&&(e=!1),!o.tieredList())return o.current_depth=t,!0;if(t>o.current_depth){for(var n=[],i=o.current_depth;i<t;i++)n.push("<"+o.listStyle+">\n");o.toc+=n.join("<li>\n")+"<li>\n"}else if(t<o.current_depth){for(var s=[],i=o.current_depth;i>t;i--)s.push("</"+o.listStyle+">\n");o.toc+="</li>\n"+s.join("</li>\n"),e||(o.toc+="</li>\n<li>\n")}else e||(o.toc+="</li>\n<li>\n");o.current_depth=t},o.buildSlug=function(t){return t=t.toLowerCase().replace(/[^a-z0-9 -]/gi,"").replace(/ /gi,"-"),t=t.substr(0,50)},o.depthClass=function(t){return o.options.levelClass.replace("%",t-(o.starting_depth-1))},o.addSpacing=function(){var e=o.$headings.filter(":first").position().top;o.$headings.each(function(n,i){var s=o.$el.find("a:eq("+n+")"),l=(t(this).position().top-e)/(o.$scope.height()-e)*o.$el.height();s.css({position:"absolute",top:l})})},o.init()},t.TableOfContents.defaultOptions={startLevel:1,depth:3,levelClass:"toc-depth-%",levelText:"%",topLinks:!1,topLinkClass:"toc-top-link",topBodyId:"toc-top",proportionateSpacing:!1},t.fn.tableOfContents=function(e,n){return this.each(function(){var i=new t.TableOfContents(this,e,n);delete i})}}(jQuery),function(){"use strict";var t=jQuery(document);t.on("contentloaded",function(e){var n=jQuery(e.target),i=n.find(".button.open"),o=n.find(".button.close"),s={source:".dialog.loader",modal:!0};i.on("click",function(e){t.trigger("dialog:open",s)}),o.on("click",function(e){t.trigger("dialog:close")})})}(),function(){var t=jQuery(document);t.on("contentloaded",function(e){var n=jQuery(e.target);if(n[0]==t[0]){var i=n.find("main h1").first();if(!(i.length<1)){jQuery("<ul />").addClass("table-of-contents").insertAfter(i).tableOfContents(jQuery("main"),{startLevel:2})}}})}();