function initJSForDocument(){var n,t,i,r;Document.arbeitshilfenFancyBoxForImage();window.document.documentElement.doScroll=null;updateSelectedTocNodeOnClickLinkAfterPageLoad();handleWordBreak();window.hotkeyManager.registerHotkey("ArrowLeft",37,function(){handleKeyboardNavigationWithElementId("prev")},{altKey:!1,ctrlKey:!1,shiftKey:!1},!1);window.hotkeyManager.registerHotkey("ArrowRight",39,function(){handleKeyboardNavigationWithElementId("next")},{altKey:!1,ctrlKey:!1,shiftKey:!1},!1);window.hotkeyManager.registerHotkey("3",51,function(){var n=document.querySelector("#toccontent > ul > li > ul > li:nth-child(1) > a:nth-child(2)");n&&n.focus()},{altKey:!0},!0);n=document.getElementById("viewVerweiszettel");n&&window.hotkeyManager.registerHotkey("4",51,function(){var t=n.querySelector(".content.hidden");t&&openVerweiszettel(n,t);findFirstTargettableVerweiszettelEntry()},{altKey:!0},!0);$("#dokument").focus();$(window).on("scroll resize",handleScrollToTopButtonPosition);$("button.scrollToTop").click(function(){$(window).scrollTop(0)});handleScrollToTopButtonPosition();checkTableScrollbars();checkBannerHref();handleTooBigTableScrollbars();t=document.createElement("i");t.className="icon icon-site-color icon-down-open";i=document.getElementById("dtlAaendverz");i&&(r=i.parentElement,r.insertAdjacentHTML("afterbegin",t.outerHTML))}function checkTableScrollbars(){$("div.ZDOK table, div.GESDOK table, div.aK table, div.niK table").each(function(){var n=$(this);n.get(0).scrollWidth>$("#dokcontent").width()&&n.css("display","block")})}function handleScrollToTopButtonPosition(){var n=$("button.scrollToTop"),t,i;n.length&&!$("#bo_center.columnize").length&&(n.css({display:$(window).scrollTop()>0?"block":"none"}),t=$("#bo_right"),t.length?n.css({left:t.position().left-n.width()-100}):n.css({left:$(window).width()-n.width()-100}),i=$("#bottomleiste"),i.css("position")!=="fixed"?i.visibleHeight(function(t){var i=t>0?$(window).outerHeight()-n.height()-t+"px":"";n.css({top:i,bottom:0})}):n.css({bottom:"",top:""}))}function handleKeyboardNavigationWithElementId(n){var t=document.getElementById(n);t&&t.getAttribute&&t.getAttribute("href")&&(window.location.href=t.getAttribute("href"))}function openVerweiszettel(n,t){t.classList.remove("hidden");var i=n.querySelector(".column.icons");Array.from(i.children).forEach(function(n){n.className.includes("hidden")?n.classList.remove("hidden"):n.classList.add("hidden")})}function findFirstTargettableVerweiszettelEntry(){for(var t,i=document.querySelectorAll("#verweiszettel-content > ul > li"),n=0;n<i.length;n++)if(t=i[n].querySelector("div:nth-child(2) > a"),t){t.focus();break}}function refreshDokumentMarkierenUndZurAkteIcon(n){$.ajax({type:"POST",url:"/Toolleiste/RefreshDokumentenlisteIcon",dataType:"html",success:function(n){n&&n.length>0&&$("#dokumentenlisteicon").replaceWith(n)}});$.ajax({type:"POST",url:"/Toolleiste/RefreshDocumentMarkierenIcon/"+n+"/",dataType:"html",success:function(n){n.length>0&&$("#dokumenteMarkierenIcon").replaceWith(n)}})}function MarkDocument(n){$.ajax({type:"POST",url:"/Search/ToggleMarkingForDocument",data:"docIds="+n,complete:function(){refreshDokumentMarkierenUndZurAkteIcon(n)}})}function GetToc(n){$.ajax({type:"POST",url:"/Dokument/GetToc",data:"vpath="+n,dataType:"text",success:function(t){t.length>0&&($("#toccontent").replaceWith(t),updateOnClickLinkAfterAjax(n))}})}function updateSelectedTocNodeOnClickLinkAfterPageLoad(){var t=$("#toccontent span.bf_selected a.icon")[0],n;t&&t.attributes.onclick&&(n=t.attributes.onclick.value,n&&(n=n.slice(n.indexOf("'")+1,n.lastIndexOf("'")),t.attributes.onclick.value=t.attributes.onclick.value.replace(n,updateOnClickLink(n))))}function updateOnClickLinkAfterAjax(n){$("#toccontent a.icon").each(function(){this.attributes.onclick&&this.attributes.onclick.value.indexOf(n)!==-1&&(this.attributes.onclick.value=this.attributes.onclick.value.replace(n,updateOnClickLink(n)))})}function updateOnClickLink(n){var i=n.slice(n.lastIndexOf(".")),t=n.slice(0,n.lastIndexOf("."));return t.lastIndexOf(".")!==-1?t.slice(0,t.lastIndexOf("."))+i:t+i}function VerifyVersionCompareSelection(){var i=document.getElementById("periodOfValidityList"),n,t;return isNull(i)?!1:(n=$('input[name="version"]',i),t=n.filter(":checked").length>=2,n.filter(":not(:checked)").attr("disabled",t),$("#versionCompareButton").attr("disabled",!t),!1)}function dtlToggle(n){var t=document.getElementById(n),r=document.getElementById(t.id.replace(prefixIds.linkId,prefixIds.containerId)),i;innerTextToggle(t,r);i=jQuery.Event("bo: dtlToggle");$(document).trigger(i)}function toggleAenderungsverz(n){var t=document.getElementById(n),i=document.getElementById(t.id.replace(prefixIds.linkId,prefixIds.containerId)),r=t.children[0];t.insertBefore(r,t.childNodes[0]);innerTextToggle(t,i,n)}function innerTextToggle(n,t){var i=n.children[0];t.style.display===""?(t.style.display="none",n.innerText=n.innerText===""||n.innerText==="Text1"?"Details öffnen":n.innerText.indexOf("schließen")!=-1?n.innerText.replace("schließen","öffnen"):n.innerText.indexOf(" ",n.innerText.length-1)!=-1?n.innerText+"öffnen":n.innerText+" öffnen"):t.style.display==="none"&&(t.style.display="",n.innerText=n.innerText===""||n.innerText==="Text1"?"Details schließen":n.innerText.indexOf("öffnen")!==-1?n.innerText.replace("öffnen","schließen"):n.innerText.indexOf(" ",n.innerText.length-1)!=-1?n.innerText+"schließen":n.innerText+" schließen");i!==undefined&&n.insertBefore(i,n.childNodes[0])}function dtlClose(){var n=$("div[id^="+prefixIds.containerId+"]"),t="span.hit,span.highlight",i=new RegExp("<a +name=[\"']?"+window.location.hash.substring(1)+"[\"']?>","ig");n.each(function(n,r){var u=r.id.replace(prefixIds.containerId,prefixIds.linkId),f,e;dtlToggle(u);f=r.querySelectorAll(t).length;e=i.test(r.innerHTML);(f||e)&&dtlToggle(u)});$("div#bo_center").each(function(){$(this).toggleClass("hidedetailsect-js-enabled",!1)})}function handleHoverOverImage(n){var t=$(n.currentTarget);return toggleTocImage(t),!1}function handleHoverOverImageTableLayout(n){var t=$(n.currentTarget).parent();return toggleTocImage(t),!1}function toggleTocImage(n){var t=n.parent().find("i").first(),i=$("#toccontent > ul > li > a > i:first-of-type"),r=$("#toccontent > ul > li > span.bf_selected a.icon > span.icon > i:first-of-type");$(t).is(i)||$(t).is(r)||t&&t.attr("class")&&t.attr("class").indexOf("icon")!==-1&&(t.attr("class").indexOf("right")!==-1?t.attr("class",t.attr("class").replace("right","down")):t.attr("class",t.attr("class").replace("down","right")))}function clearSelection(){window.getSelection?window.getSelection().empty?window.getSelection().empty():window.getSelection().removeAllRanges&&window.getSelection().removeAllRanges():document.selection&&document.selection.empty()}function selectText(n){clearSelection();var t=void 0;document.selection?(t=document.body.createTextRange(),t.moveToElementText(document.getElementById(n)),t.select()):window.getSelection&&(t=document.createRange(),t.selectNode(document.getElementById(n)),window.getSelection().addRange(t))}function copyText(n){var i=$(n).text(),t;if(navigator.clipboard)navigator.clipboard.writeText(i);else try{$("body").remove("#_copyArea").append('<textarea id="_copyArea" style="position:absolute;top:-1000px;left:0">'+i+"<\/textarea>");t=$("#_copyArea")[0];t.focus();t.select();document.execCommand("copy")}catch(r){alert("Der Link konnte leider nicht kopiert werden. Benutzen Sie bitte die Browserfunktionalität.");return}alert("Der Link wurde in die Zwischenablage kopiert.")}function handleWordBreak(){$("#toccontent li a").not("a:has(img)").contents().filter(function(){return this.nodeType===Node.TEXT_NODE}).each(function(){var n=this;n.textContent=n.textContent.replace(/[\\/]/g,function(n){return n+"​"})})}function markExternalLinks(n){var t=new RegExp("/"+window.location.host+"/");$('a[href^="http"]',"#toccontent, #dokument").filter(function(){return this.hostname?this.hostname!==location.hostname&&isNotBeckonlineLink(this.hostname):this.href?!t.test(this.href)&&isNotBeckonlineLink(this.href):!1}).each(function(){var t=document.createElement("i");t.className="link-icon icon-site-color "+n;t.setAttribute("aria-hidden","true");this.appendChild(t)})}function checkBannerHref(){var n=$("div#doktoc h1"),r,t,i;n.length!==0&&((r=n.parent().is("a"),r)||(t=$("div#toccontent a:not(.icon)"),t.length!==0)&&(i=t.get(0).href,i!=="")&&n.wrap($("<a>").prop("class","noToolTip").prop("href",i)))}function isNotBeckonlineLink(n){return n.indexOf("beck-online.de")<0&&n.indexOf("beck.de")<0}function escapeRegExp(n){return String(n).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function handleTooBigTableScrollbars(){$("div.ZDOK table, div.GESDOK table, div.aK table, div.niK table").each(function(){var n=$(this),t;n.get(0).scrollWidth>$("#dokcontent").width()&&(n.wrapAll('<div class = "divscrolltoptable"><\/div>'),t=$('<div class="scrolltoptable scrolltoptable-'+idTable+'"><div class="scrolltoptable2ndlvl scrolltoptable2ndlvl-'+idTable+'"><\/div><\/div>'),t.insertBefore(n),n.addClass("scrolltoptablemain-"+idTable),setScrollbarParam(idTable,n.get(0).scrollWidth),idTable++)})}function setScrollbarParam(n,t){$(".scrolltoptable-"+n).css("width",$("#dokcontent").width()-2);$(".scrolltoptable2ndlvl-"+n).css("width",t);$(".scrolltoptable-"+n).scroll(function(){$(".scrolltoptablemain-"+n).scrollLeft($(".scrolltoptable-"+n).scrollLeft())});$(".scrolltoptablemain-"+n).scroll(function(){$(".scrolltoptable-"+n).scrollLeft($(".scrolltoptablemain-"+n).scrollLeft())})}var Document=new function(){},idTable=0,prefixIds,SourceOfInformation,gotoAnker;document.addEventListener("DOMContentLoaded",function(){initJSForDocument()});$(document).on("click","a[href^='#FN'], a[href^='#AFN']",function(){$("div.fn dl dd.fntext").removeClass("selected-fntext");$("div.fn dl dt.fnnr").removeClass("selected-fntext");var t=$(this).attr("href"),n=$("a"+t).parents(".fnnr"),i=n.next();n.addClass("selected-fntext");i.addClass("selected-fntext")});Document.arbeitshilfenFancyBoxForImage=function(){document.addEventListener("DOMContentLoaded",function(){$('img[src*="bibdata"]:not(".titelseitebild")').on("click",function(){$.colorbox({href:this.src,title:$(this).attr("alt"),maxHeight:"80%",maxWidth:"100%",onComplete:function(){$("#cboxTitle").addClass("out-of-viewport")}})})})};prefixIds={linkId:"dtlA",containerId:"dtlD"};$(function(){var n=$("#doktoc");n.on("mouseenter mouseleave toggleIcon","a.icon",handleHoverOverImage);n.on("mouseenter mouseleave toggleIcon","a.icon+a",handleHoverOverImage);n.on("mouseenter mouseleave toggleIcon","div.TocGesamtversion span.icon",handleHoverOverImage);n.on("mouseenter mouseleave","td a",handleHoverOverImageTableLayout)});jQuery(function(){var n=$(".svgui").find("a");n.click(function(n){var t=n.target.id,r,i;t===""&&n.currentTarget.id!=""&&(t=n.currentTarget.id);r="#"+t;i=$(r).find("i");i.hasClass("clickflag")?i.toggleClass("icon-down-open icon-right-open"):i.toggleClass("clickflag");toggleAenderungsverz(t)})});$(document).on("click","a#section-view-next-page",function(){var n=document.getElementById("ansichtbox_selection_CurrentChapter"),t="/DACore/ShowSubordinateSection/";isNotNull(n)&&n.checked===!0&&(t="/DACore/ShowCurrentSection");$.ajax({type:"POST",url:t,data:{docVPath:$("#section-view-vpath").val(),page:$("#section-view-page").val()},beforeSend:function(){showProgressAnsicht()},complete:function(){hideProgressAnsicht();$(document).scrollTop(0)},success:function(t){if(t){if(t.err){window.location.href="/"+t.err.controller+"/"+t.err.action+t.err.param;return}t.gesetz!==null&&t.gesetz.length>0&&(isNotNull(n)&&n.checked===!0?refreshPrintExportManager("CurrentChapter",!0,!0,null,null):refreshPrintExportManager("ParentChapter",!0,!0,null,null),displayAbschnittBook(t.gesetz))}}})});SourceOfInformation=function(n,t,i){function e(){for(var t,e,r,w,o,f,s,h,a=function a(n){if(n===null||n.length===0)return null;n=n.prev();var t=n.find("em.randnr").ignore("span.unsichtbar");return t.length>0?t:a(n)},v=function(n){var t,i,u,r;if(n===null||n.length===0)return null;for(t=n,i=void 0;!t.is("div");){if(u=t.prevAll(".sidebar-outside"),i=u.first().find("em.randnr").ignore("span.unsichtbar"),i.length>0)return i;if(t=t.parent(),t===null||t.length===0)return null;if(i=t.find("em.randnr").ignore("span.unsichtbar"),i.length>0)return i;if(!t.is("div"))for(r=t.prev();r!==null&&r.length>0;){if(i=r.find("em.randnr").ignore("span.unsichtbar"),i.length>0)return i;r=r.prev()}}return a(n.parent())},b=function(n,t){if(n===null||n.length===0||(n=n.parents("div"),n===null||n.length===0))return null;var r=void 0,u="";return(n.each(function(){return(r=i(this).next().find("em.randnr").ignore("span.unsichtbar"),r.length>0&&r.first().text()!=t)?(u=r.first().text(),!1):!0}),u.length>0)?u:null},k=function(n){var r,t;if(n===null||n.length===0||(r=n.parents("div.margoutside").prev(),r.hasClass("dk2")))return null;for(n=n.parents("div.margoutside").next(),t=void 0;n.length>0;){if(t=n.find("em.randnr").ignore("span.unsichtbar"),t.length>0)return i(t[0]).text();n=n.next()}return null},d=function(n){if(n===null||n.length===0)return null;n=n.parents("div.margoutside").prev();for(var t=void 0;n.length>0;){if(t=n.find("em.randnr").ignore("span.unsichtbar"),t.length>0)return t.text();n=n.prev()}return null},u=[],y=n.getSelection(),c=!1,p=!1,l=0;l<y.rangeCount;l++)if(t=y.getRangeAt(l),t!==null)if(e=v(i(t.startContainer)),e!==null&&e.length===1?(u.push(e.text()),c=!0):(r=k(i(t.startContainer)),r!==null&&r.length>0&&(w=r.match(/\d+/g),o=parseInt(w)-1,o<=0&&(o=1),r=r.replace(/\d+/g,o.toString()),u.push(r),c=!0,p=!0)),f=v(i(t.endContainer)),f!==null&&f.length===1)u.push(f.text()),c===!1&&(s=b(i(t.startContainer),f.text()),s!==null&&s.length>0&&u.push(s));else if(h=d(i(t.endContainer)),h!==null&&h.length>0)u.push(h);else if(p!==!0)return null;return u.filter(function(n,t,i){return i.indexOf(n)===t}).sort(function(n,t){var i=n.match(/\d+/g),r=t.match(/\d+/g);return i-r})}function o(n){var t,i,r;return n===null||n.length===0?"":(t=n[0],t=t.replace(/  +/g," "),t=t.trimStart(),i=n[n.length-1],i=i.replace(/  +/g," "),i=i.trimStart(),r=i-t==1?", ":"-",n.length>1?t+r+i:t)}function y(n){var t=n.match(/ Rn\. (\d+(\.\d+)*\.?[a-z]*\s*)((-|, )(\s*\d+(\.\d+)*\.?[a-z]*))?/g),i,r,u;if(t!==null)t.length>1&&(t=t[t.length-1]),i=o(e()),r="",i.length>0&&(r=" Rn. "+i),n=n.replace(t,r);else if(u=o(e()),u!==""){var f=" Rn. "+u,s=n.substring(0,n.lastIndexOf(",")),h=n.substring(n.lastIndexOf(","),n.length);n=s+f+h}return n}function s(n){var t=n||"",r=i("#zitMitAuflage");r.text()!==""&&(t=r.html());t.length>0&&(t="\n("+t+")");this.handler=function(n){if(!i("#source-of-information-icon").length)return!0;var r=this;return i.get("/SourceOfInformationContainer",function(n){var u=i("#source-of-information-container"),e,f;u.html(n);e=i("#source-of-information-box",u);f=i("#source-of-information-textarea",u);f.html(r.selectedText+y(t));f.select();i(e,f).on("click",function(n){n.target.id!=="source-of-information-print-icon"&&(n.stopPropagation(),n.preventDefault())}).on("keyup keydown keypress",function(n){n.stopPropagation()}).on("scroll wheel mousewheel",function(n){n.stopPropagation()});i("#source-of-information-close-icon").on("click",function(n){e.remove();u.remove();n.preventDefault()});i("#source-of-information-print-icon").on("click",r.printSelection).on("mouseenter",function(){var n=i("img",this)[0];n.src=i(n).data("hover")?i(n).data("hover"):n.src}).on("mouseleave",function(){var n=i("img",this)[0];n.src=i(n).data("src")?i(n).data("src"):n.src})}),n.stopPropagation(),n.preventDefault(),!1};this.setupEvents()}function r(n,t,r){i(".unsichtbar, .nichtZitierbar, .dk2, sup, .randnr, .pagebreak, .footnoteAnchor").each(function(){this.innerHTML=n===!0?t+this.innerHTML+r:this.innerHTML.replace(t,"").replace(r,"")})}function h(n){for(var f,e,o,r=i("<div>"),s=t.getElementById("dokument"),u=0;u<n.rangeCount;u++)f=n.getRangeAt(u),s.contains(f.commonAncestorContainer)&&(e=f.cloneContents(),r.append(e));return i("div.pagebreak",r).each(function(){var r=i(this),n=r.prev(),t=r.next();n.length<=0||t.length<=0||(n.text().slice(-1)!==" "&&t.text().slice(0,1)!==" "&&n.append("&nbsp;"),n.append(t.html()),t.remove(),r.remove())}),o=r.html().replace(/\t/g,"").replace(/<\/(p|li|hr|table|dd|h\d)>/g,function(n){return n+"\n"}),i("<div/>").html(o).text()}function c(){return n.getSelection?n.getSelection():t.selection&&t.selection.createRange?t.selection.createRange():!1}function p(n){return n.focusNode.nodeName!=="#text"&&n.rangeCount===1}function w(n){var r=t.createRange(),u=n.startContainer,i=n.endContainer,f;if(!(u&&i&&u.compareDocumentPosition))return n.cloneRange?n.cloneRange():n.duplicate();if(u.compareDocumentPosition(i)&2&&(i=n.startContainer),i.nodeName.toLowerCase()==="a"||i.parentNode.nodeName.toLowerCase()==="a"||i.nodeName.toLowerCase()==="img"||i.parentNode.nodeName.toLowerCase()==="img")i.parentNode.nextSibling?r.setStartAfter(i.parentNode.nextSibling):r.setStartAfter(i.parentNode.parentNode);else{if(f=n.endOffset,i.nodeType===1)if(i=i.lastChild,i&&i.nodeType==3)f=i.data.length;else if(i&&i.nodeType===1)i=i.nextSibling?i.nextSibling:i.parentNode;else return n.cloneRange?n.cloneRange():n.duplicate();r.setStart(i,f)}return r}function l(){var n=i("#source-of-information-container");return n.remove(),n=i('<div id="source-of-information-container"><\/div>'),n.html('<img id="source-of-information-icon" src="/bilder/kopieren.png" />'),n}function a(n){var r=n.target,i=t.getElementById("source-of-information-container");return i&&(r===i||(i.compareDocumentPosition?i.compareDocumentPosition(r)&16:i.contains(r)))}function v(){n.setTimeout(function(){i(t).on("mousedown",function(n){return i(n.target).closest("#source-of-information-container").length||(i("#source-of-information-box").remove(),i("#source-of-information-container").remove(),i(t).prop("onmousedown",null)),!0})},0)}function b(n,t){t.removeRange?t.removeRange(n):t.removeAllRanges();t.addRange(n)}var u=3,f=!1;return i(t).ready(function(){i("__ClientFingerprintAntiforgeryFormId")&&Fingerprint2.computeAndSendClientFingerprintAsync()}),s.prototype={setupEvents:function(){var t=this,r=i("#dokument *"),n=!1;r.on("mousedown",function(r){n=i(r.target).closest(".dk2").length<=0&&i(r.target).closest(".pagebreak").length<=0;t.hide(r)});r.on("mouseup",function(i){i.button!==2&&(n&&t.insertOpenSymbol(i),n=!1)})},setActive:function(n){f=n},hide:function(n){n&&a(n)||(i("#source-of-information-box").remove(),i("#source-of-information-container").remove())},insertOpenSymbol:function(t){function ot(n){var t=n.replace(/(\n(\s)*)(\n(\s)*)+\n?/g,"\n\n ");return t.replace(/(\n+\s*)$/g,"\n")}function ut(r){var u=i("#dokument"),h=u.offset().top,e=u.offset().left,c=n.pageYOffset,l=u.scrollLeft(),a=t.clientY-h+c,o=t.clientX-e+l,s=23,v=u.width()+e-t.clientX<=s,f;v&&(o-=s);f=r.find("#source-of-information-icon");f.css("position","absolute");f.css("left",o);f.css("top",a);r.appendTo(u)}var d,tt,e,it,o,rt,g,nt,ft,et;if(a(t)||i("#source-of-information-box").length||!f||(d=c(),!d)||(tt=h(d),tt.length<u))return!1;var s="¡",y="¿",k=this;if(r(!0,s,y),e=c(),!e)return r(!1,s,y),!1;if(it=["zitStandard","zitMitAuflage"],p(e)&&it.indexOf(e.focusNode.id)>=0)return r(!1,s,y),selectText(e.focusNode.id),!0;if(o=h(e),rt=new RegExp(s+"((.|\\s)*?)"+y,"g"),o=o.replace(rt,""),o=o.replace(/ {2,}/g," "),r(!1,s,y),o=ot(o),k.selectedText=o,o.length<u)return k.hide(t),!1;if(e.getRangeAt){g=e.getRangeAt(0);w(g);nt=l();ut(nt);b(g,e);nt.on("mousedown",function(n){return k.handler.call(k,n),!0});v()}else if(e.duplicate){ft=e.duplicate();ft.setEndPoint("StartToEnd",e);et=l();ut(et);e.select();i("#source-of-information-container").on("mousedown",function(n){return k.handler(n),!0});v()}else return!1;return!1},printSelection:function(){var n=t.createElement("iframe"),r=t.getElementById("source-of-information-container");i(n).attr({style:"display: none",frameBorder:0,scrolling:"no",title:t.title,src:"/SourceOfInformationPrintFrame"});r.appendChild(n)}},s}(window,document,jQuery);gotoAnker=function(n,t){function i(t){var r=t.toLowerCase(),i=n("a").filter(function(n,t){var i=t.getAttribute("name");return i?r===i.toLowerCase():!1}).first();return i.length?i.get(0):null}function r(i){for(var e,u,f=n(i).closest("[id*=dtlD]"),o=i.getAttribute("id"),r=0;r<f.length;r++)for(e=f[r].getElementsByTagName("a"),u=0;u<e.length;u++)e[u].getAttribute("id")===o&&t(f[r].id.replace("D","A"))}function u(t,i,r){for(var f=n(window),u=t;!!u&&n(u).offset().top<0;)u=u.parentElement;u&&window.setTimeout(function(){f.scrollTo(u,100,{offset:{top:i},axis:r})},1)}return function(t){var f,e;try{if(!t||t.length<=0||window.performance&&window.performance.navigation.type===window.performance.navigation.TYPE_BACK_FORWARD)return;if(f=i(t),!f)return;if(r(f),e=n("a[name^='Y']").first().prop("name"),typeof e!="undefined"&&t===e.toUpperCase())return;u(f,offset,"y")}catch(o){}}}(jQuery,dtlToggle),function(n,t){typeof module=="object"&&module.exports?module.exports=t():typeof define=="function"&&define.amd?define(t):n.findAndReplaceDOMText=t()}(this,function(){function o(n){return String(n).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function n(){return s.apply(null,arguments)||f.apply(null,arguments)}function s(t,i,r,u,e){var o,s;return i&&!i.nodeType&&arguments.length<=2?!1:(o=typeof r=="function",o&&(r=function(n){return function(t,i){return n(t.text,i.startIndex)}}(r)),s=f(i,{find:t,wrap:o?null:r,replace:o?r:"$"+(u||"&"),prepMatch:function(n,t){if(!n[0])throw"findAndReplaceDOMText cannot handle zero-length matches";if(u>0){var i=n[u];n.index+=n[0].indexOf(i);n[0]=i}return n.endIndex=n.index+n[0].length,n.startIndex=n.index,n.index=t,n},filterElements:e}),n.revert=function(){return s.revert()},!0)}function f(n,t){return new r(n,t)}function r(t,r){var f=r.preset&&n.PRESETS[r.preset],u;if(r.portionMode=r.portionMode||e,f)for(u in f)i.call(f,u)&&!i.call(r,u)&&(r[u]=f[u]);this.node=t;this.options=r;this.prepMatch=r.prepMatch||this.prepMatch;this.reverts=[];this.matches=this.search();this.matches.length&&this.processMatches()}var e="retain",u="first",t=document,i={}.hasOwnProperty;return n.NON_PROSE_ELEMENTS={br:1,hr:1,script:1,style:1,img:1,video:1,audio:1,canvas:1,svg:1,map:1,object:1,input:1,textarea:1,select:1,option:1,optgroup:1,button:1},n.NON_CONTIGUOUS_PROSE_ELEMENTS={address:1,article:1,aside:1,blockquote:1,dd:1,div:1,dl:1,fieldset:1,figcaption:1,figure:1,footer:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,header:1,hgroup:1,hr:1,main:1,nav:1,noscript:1,ol:1,output:1,p:1,pre:1,section:1,ul:1,br:1,li:1,summary:1,dt:1,details:1,rp:1,rt:1,rtc:1,script:1,style:1,img:1,video:1,audio:1,canvas:1,svg:1,map:1,object:1,input:1,textarea:1,select:1,option:1,optgroup:1,button:1,table:1,tbody:1,thead:1,th:1,tr:1,td:1,caption:1,col:1,tfoot:1,colgroup:1},n.NON_INLINE_PROSE=function(t){return i.call(n.NON_CONTIGUOUS_PROSE_ELEMENTS,t.nodeName.toLowerCase())},n.PRESETS={prose:{forceContext:n.NON_INLINE_PROSE,filterElements:function(t){return!i.call(n.NON_PROSE_ELEMENTS,t.nodeName.toLowerCase())}}},n.Finder=r,r.prototype={search:function(){function f(o){for(var s,h=0,c=o.length;h<c;++h){if(s=o[h],typeof s!="string"){f(s);continue}if(n.global)while(t=n.exec(s))r.push(u.prepMatch(t,e++,i));else(t=s.match(n))&&r.push(u.prepMatch(t,0,i));i+=s.length}}var t,e=0,i=0,n=this.options.find,s=this.getAggregateText(),r=[],u=this;return n=typeof n=="string"?RegExp(o(n),"g"):n,f(s),r},prepMatch:function(n,t,i){if(!n[0])throw new Error("findAndReplaceDOMText cannot handle zero-length matches");return n.endIndex=i+n.index+n[0].length,n.startIndex=i+n.index,n.index=t,n},getAggregateText:function(){function i(r){var u,f,e;if(r.nodeType===3)return[r.data];if(t&&!t(r))return[];if(u=[""],f=0,r=r.firstChild)do{if(r.nodeType===3){u[f]+=r.data;continue}e=i(r);n&&r.nodeType===1&&(n===!0||n(r))?(u[++f]=e,u[++f]=""):(typeof e[0]=="string"&&(u[f]+=e.shift()),e.length&&(u[++f]=e,u[++f]=""))}while(r=r.nextSibling);return u}var t=this.options.filterElements,n=this.options.forceContext;return i(this.node)},processMatches:function(){var s=this.matches,e=this.node,h=this.options.filterElements,u,r,o=[],n=e,t=s.shift(),i=0,a=0,f=0,c,l=[e];n:for(;;){if(n.nodeType===3&&(!r&&n.length+i>=t.endIndex?r={node:n,index:f++,text:n.data.substring(t.startIndex-i,t.endIndex-i),indexInMatch:i-t.startIndex,indexInNode:t.startIndex-i,endIndexInNode:t.endIndex-i,isEnd:!0}:u&&o.push({node:n,index:f++,text:n.data,indexInMatch:i-t.startIndex,indexInNode:0}),!u&&n.length+i>t.startIndex&&(u={node:n,index:f++,indexInMatch:0,indexInNode:t.startIndex-i,endIndexInNode:t.endIndex-i,text:n.data.substring(t.startIndex-i,t.endIndex-i)}),i+=n.data.length),c=n.nodeType===1&&h&&!h(n),u&&r){if(n=this.replaceMatch(t,u,o,r),i-=r.node.data.length-r.endIndexInNode,u=null,r=null,o=[],t=s.shift(),f=0,a++,!t)break}else if(!c&&(n.firstChild||n.nextSibling)){n.firstChild?(l.push(n),n=n.firstChild):n=n.nextSibling;continue}for(;;){if(n.nextSibling){n=n.nextSibling;break}if(n=l.pop(),n===e)break n}}},revert:function(){for(var n=this.reverts.length;n--;)this.reverts[n]();this.reverts=[]},prepareReplacementString:function(n,t,i){var r=this.options.portionMode;return r===u&&t.indexInMatch>0?"":(n=n.replace(/\$(\d+|&|`|')/g,function(n,t){var r;switch(t){case"&":r=i[0];break;case"`":r=i.input.substring(0,i.startIndex);break;case"'":r=i.input.substring(i.endIndex);break;default:r=i[+t]}return r}),r===u)?n:t.isEnd?n.substring(t.indexInMatch):n.substring(t.indexInMatch,t.indexInMatch+t.text.length)},getPortionReplacementNode:function(n,i){var r=this.options.replace||"$&",u=this.options.wrap,e,f;return(u&&u.nodeType&&(e=t.createElement("div"),e.innerHTML=u.outerHTML||(new XMLSerializer).serializeToString(u),u=e.firstChild),typeof r=="function")?(r=r(n,i),r&&r.nodeType)?r:t.createTextNode(String(r)):(f=typeof u=="string"?t.createElement(u):u,r=t.createTextNode(this.prepareReplacementString(r,n,i)),!r.data)?r:f?(f.appendChild(r),f):r},replaceMatch:function(n,i,r,u){var e=i.node,o=u.node,s,h,f,c,v,w,y,b,l,p,a;if(e===o)return f=e,i.indexInNode>0&&(s=t.createTextNode(f.data.substring(0,i.indexInNode)),f.parentNode.insertBefore(s,f)),c=this.getPortionReplacementNode(u,n),f.parentNode.insertBefore(c,f),u.endIndexInNode<f.length&&(h=t.createTextNode(f.data.substring(u.endIndexInNode)),f.parentNode.insertBefore(h,f)),f.parentNode.removeChild(f),this.reverts.push(function(){s===c.previousSibling&&s.parentNode.removeChild(s);h===c.nextSibling&&h.parentNode.removeChild(h);c.parentNode.replaceChild(f,c)}),c;for(s=t.createTextNode(e.data.substring(0,i.indexInNode)),h=t.createTextNode(o.data.substring(u.endIndexInNode)),v=this.getPortionReplacementNode(i,n),w=[],y=0,b=r.length;y<b;++y)l=r[y],p=this.getPortionReplacementNode(l,n),l.node.parentNode.replaceChild(p,l.node),this.reverts.push(function(n,t){return function(){t.parentNode.replaceChild(n.node,t)}}(l,p)),w.push(p);return a=this.getPortionReplacementNode(u,n),e.parentNode.insertBefore(s,e),e.parentNode.insertBefore(v,e),e.parentNode.removeChild(e),o.parentNode.insertBefore(a,o),o.parentNode.insertBefore(h,o),o.parentNode.removeChild(o),this.reverts.push(function(){s.parentNode.removeChild(s);v.parentNode.replaceChild(e,v);h.parentNode.removeChild(h);a.parentNode.replaceChild(o,a)}),a}},n});$(function(){function nt(n){clearTimeout(g);g=setTimeout(function(){v=n;y(n)},400)}function f(n){v&&v===n?tt():(ni(),nt(n))}function lt(){n().val("");f("")}function tt(){var n=kt(r);o(n,!0);r=n}function at(){var n=bt(r);o(n,!0);r=n}function vt(){var n=wt(r);o(n,!1);r=n}function y(n){var e,f;a&&a.revert();i=0;n?(e=RegExp(escapeRegExp(n),"gi"),a=findAndReplaceDOMText(ht[0],{preset:"prose",find:e,replace:function(n,t){var r=document.createElement("match");return r.setAttribute("name","#"+t.index),r.className="highlight",r.innerHTML=n.text,i===0&&(r.className="highlight_first"),i++,r}}),i===0?u.addClass("icon-disabled"):(f=yt(),o(f,!0),r=f),h.removeClass("nosee"),t.addClass("nosee")):($("div#search-in-document  #matches").text(""),h.addClass("nosee"),t.removeClass("nosee"),$("div#search-in-document-wrapper input[type=text]#search-input").val()||t.addClass("icon-disabled"))}function yt(){return{previousMatch:{id:-1,element:null},currentMatch:{id:-1,element:null},nextMatch:p({id:-1,element:null})}}function p(n){for(var u,t,f,o=$("#dokument > #dokcontent"),r=n.id+1;r<i;++r)if(u=e(o,r),u)return{id:r,element:u};for(t=0;t<n.id;++t)if(f=e(o,t),f)return{id:t,element:f};return{id:i+1,element:null}}function e(n,t){var i=n.find("match[name='#"+t+"']:visible"),r;return i.length?(r=i.parents(".unsichtbar"),r.length)?null:i:null}function w(n){for(var u,t,f,o=$("#dokument > #dokcontent"),r=n.id-1;r>=0;--r)if(u=e(o,r),u)return{id:r,element:u};for(t=i;t>n.id;--t)if(f=e(o,t),f)return{id:t,element:f};return{id:-1,element:null}}function pt(n){var u=$("#dokument > #dokcontent"),t=n.id,r;return t<0||t>=i?{id:-1,element:null}:(r=u.find("match[name='#"+t+"']:visible"),r.length>0)?n:w(n)}function wt(n){var t=pt(n.currentMatch);return Object.is(t,n.currentMatch)||b(n.currentMatch.element),{previousMatch:w(t),currentMatch:t,nextMatch:p(t)}}function it(n){return!n.previousMatch.element&&!n.nextMatch.element}function bt(n){return it(n)?n:{previousMatch:w(n.previousMatch),currentMatch:n.previousMatch,nextMatch:n.currentMatch}}function kt(n){return it(n)?n:{previousMatch:n.currentMatch,currentMatch:n.nextMatch,nextMatch:p(n.nextMatch)}}function b(n){n!==null&&(n.addClass("highlight"),n.removeClass("highlight_first"))}function dt(n){n!==null&&(n.addClass("highlight_first"),n.removeClass("highlight"))}function rt(n,t){t!==null?n.removeClass("icon-disabled"):n.addClass("icon-disabled")}function gt(n){if(n!==null){var t=n.offset();t.left-=20;t.top-=200;$("html, body").animate({scrollTop:t.top,scrollLeft:t.left},"fast")}}function o(n,t){rt(ot,n.previousMatch.element);b(n.previousMatch.element);dt(n.currentMatch.element);t&&gt(n.currentMatch.element);rt(st,n.nextMatch.element);b(n.nextMatch.element)}function ni(){var n=$("div#search-in-document-wrapper"),t;n.length!==0&&(t=n[0].getClientRects(),t.length!==0)&&(n.addClass("fixed-on-search"),n.css("top",t[0].top))}function ti(){var n=$("div#search-in-document-wrapper");n.length!==0&&(n.removeClass("fixed-on-search"),n.css("top",""))}function ut(){l.removeClass("nosee");n().val()?t.removeClass("icon-disabled"):(n().removeAttr("placeholder"),t.addClass("icon-disabled"))}function n(){return $("div#search-in-document input[type=text]")}function s(n){n==""&&($("#search-type-opus").is(":checked")?n="Werk":$("#search-type-section").is(":checked")&&(n="Kommentar"));_paq.push(["trackEvent","Abschnittsuche",n,$("#vpath").val()])}function ft(i){s("");i.closest("form").submit();k();t.addClass("icon-disabled");n().prop("disabled",!0);$("input:radio[name='AbschnittsucheType']").prop("disabled",!0)}function ii(n){u.removeClass("nosee");c.removeClass("nosee");t.addClass("nosee");y(n)}function k(){u.addClass("nosee");c.addClass("nosee");t.removeClass("nosee");!n().prop("disabled")&&n().val()&&t.removeClass("icon-disabled");y("")}function et(){lt();h.addClass("nosee");t.removeClass("nosee");t.addClass("icon-disabled");l.addClass("nosee");n().attr("placeholder",ct);ti()}var h=$("div#search-in-document #close, div#search-in-document #next-hit, div#search-in-document #prev-hit"),t=$("div#search-in-document #search"),u=$("div#search-in-document #next-hit, div#search-in-document #prev-hit"),c=$("div#search-in-document #close"),ot=$("div#search-in-document #prev-hit"),st=$("div#search-in-document #next-hit"),ht=$("#dokument"),l=$("#search-in-document-options"),d=4,ct=n().attr("placeholder"),r;$("#search-in-document-wrapper").removeClass("nosee");n().find("#search-input").focus();n().val()&&t.removeClass("icon-disabled");var a=void 0,i=void 0,v=void 0,g=void 0;r={previousMatch:{id:-1,element:null},currentMatch:{id:-1,element:null},nextMatch:{id:-1,element:null}};n().on("click",ut);n().on("keydown",function(){ut()});$("div#search-in-document").on("click","#search:not(.icon-disabled)",function(){if($("#search-type-document").is(":checked")){s("Dokument");var t=n().val();f(t)}else ft($(this))});$("div#search-in-document-wrapper").on("change","#search-type-opus, #search-type-section",function(){$(this).is(":checked")&&n().val()&&ft($(this))});$("body").on("focus click",function(t){var i=t.target;return i!==null&&$(i).closest("#search-in-document-form").length>0?!0:n().val()&&!/^\s*$/.test(n().val())?!0:(et(),!0)});document.addEventListener("bo:dtlToggle",vt);$("div#search-in-document #next-hit").on("click",tt);$("div#search-in-document #prev-hit").on("click",at);$("div#search-in-document #close").on("click",et);$("input:radio[name='AbschnittsucheType']").change(function(){if(!n().prop("disabled")){var t=n().val();$(this).is(":checked")&&$(this).val()=="Document"&&t.length>=d?ii(t):k()}});n().on("keydown",function(t){if(t.keyCode==13){if($("#search-type-document").is(":checked"))return s("Dokument"),t.preventDefault(),f(n().val()),!1;s("")}return!0});n().on("keyup",function(n){var i=this.value;if($("#search-type-document").is(":checked")){if(n.keyCode==13)return!0}else return i?t.removeClass("icon-disabled"):t.addClass("icon-disabled"),k(),!1;return l.removeClass("nosee"),(n.key.length==1||n.keyCode==8)&&(i.length>=d?f(i):(u.addClass("nosee"),c.addClass("nosee"),t.removeClass("nosee"),t.remove("icon-disabled"),nt(""))),!0})})