var tabSwitcher={config:{tabbox:{box:"div.tabbox",tocitems:"ul.index li"}},defaults:{handle:null,anchorClass:"stream tabswitcher_anchorElm",showFirst:true,cssHide:true},_1:{},_3:{},init:function(a){if(a){Object.merge(this.config,a)}for(var b in this.config){var c=this.config[b]=Object.beget(this.defaults,this.config[b]);if(!c.handle){c.handle=b}var d=DOM.get(c.box),i=d.length;while(i--){var e=d[i];DOM.aquireId(e);var f=e.id;var g=document.location.href.match(/#([a-zA-Z0-9_-]+)$/);g=(g)?g[1]:"";var h=false;var l=(c.showFirst)?0:null;var m=DOM.get(c.tocitems,e);var n=document.createElement("a");n.className=c.anchorClass;n.innerHTML="#";this._1[f]=[];var k=-1,_6=m.length;for(var j=0;j<_6;j++){var o=m[j],_0=(o.tagName=="A")?o:DOM.get("a",o)[0];if(!_0){continue}var p=_0.href.match(/#([a-z][a-z0-9_.:-]*)$/i);p=(p)?p[1]:"";if(!p||!$(p)){continue}k++;this._1[f][k]=_0;this._3[p]=[f,k];var q=$(p),_2=n.cloneNode(1);_2.href="#"+p;if(q.childNodes.length){DOM.prependChild(_2,q)}else{DOM.appendChild(_2,q)}_0.tsSection=q;_0.tsBlockId=f;_0.sectionAnchorElm=_2;_0.tsConfig=c;_0.tsListItem=o;Event.add(_0,"click",this.doSwitch);if(c.cssHide){DOM.addClass(_0.tsSection,"section-closed");DOM.addClass(_0.tsSection,b+"-section-closed")}else{_0.tsSection.style.display="none"}if(!h&&((p==g)||DOM.hasClass(o,"current"))){if(p==g){h=true}l=k}}DOM.addClass(e,b+"-active");if(this._1[f].length&&l!==null){this.doSwitch(this._1[f][l])}}}},doSwitch:function(e,a){var b=this,_4=false;if(e){if(e.tagName){b=e}else if(tabSwitcher._3[e]){var c=tabSwitcher._3[e];b=tabSwitcher._1[c[0]][c[1]]}else if(!a){_4=true}}var d=tabSwitcher._1[b.tsBlockId],i=d.length;while(i--){var f=d[i];if(DOM.removeClass(f.tsListItem,"current")){if(b.tsConfig.cssHide){DOM.replaceClass(f.tsSection,"section-open","section-closed");DOM.replaceClass(f.tsSection,b.tsConfig.handle+"-section-open",b.tsConfig.handle+"-section-closed")}else{f.tsSection.style.display="none"}break}}DOM.addClass(b.tsListItem,"current");if(b.tsConfig.cssHide){DOM.replaceClass(b.tsSection,"section-closed","section-open");DOM.replaceClass(b.tsSection,b.tsConfig.handle+"-section-closed",b.tsConfig.handle+"-section-open")}else{b.tsSection.style.display=""}if(_4){var g=DOM.scrollPos()[1],_5=b.tsSection.id;b.tsSection.id="";document.location.hash=_5;b.tsSection.id=_5;b.sectionAnchorElm.focus();if(DOM.scrollPos()[1]!=g){window.scrollTo(0,b.sectionAnchorElm.offsetTop-30)}}return!!a}};