var bottomBarHeight=-1;(function(a){a.tabpane={build:function(c){var d=a.extend({},a.tabpane.defaults,c),b;return this.each(function(){var h=a(this),g=a.extend({},d,h.metadata()),e,f;function i(){var j=window.location.hash.replace(/^.*#/,"");if(typeof(b)!==undefined&&b==j){return}b=j;h.find("> .jqTab").filter(function(k){if(j==""){return(k+1==g.select||a(this).hasClass(g.select))}else{return("!"+this.id==j)}}).each(function(){a.tabpane.switchTab(h,g,this.id)})}if(a.browser.msie){g.animate=false}if(!h.is(".jqTabPaneInitialized")){h.addClass("jqTabPaneInitialized");e=h;a('<span class="foswikiClear"></span>').prependTo(h);f=a('<ul class="jqTabGroup"></ul>').prependTo(h);index=1;h.find("> .jqTab").each(function(){var j=a(this),k=j.find("h2:first").remove().html();f.append('<li><a href="#" data="'+this.id+'">'+k+"</a></li>");j.data("hash","!"+this.id);if(index==g.select||a(this).hasClass(g.select)){a.tabpane.switchTab(h,g,this.id)}index++});if(g.autoMaxExpand){a.tabpane.autoMaxExpand(h,g)}h.find(".jqTabGroup > li > a").click(function(){var j=a(this).attr("data");a(this).blur();if(j!=g.currentTabId){a.tabpane.switchTab(h,g,j);var k=a("#"+j).data("hash"),l=window.location.hash.replace(/^.*#/,"");if(k!=l){window.location.hash=k}}return false});i();a(window).bind("hashchange",function(){i()})}})},switchTab:function(n,b,j){var g=b.currentTabId,l=jQuery("#"+j),h=jQuery("#"+g),d=l.find(".jqTabContents:first"),e=h.find(".jqTabContents:first"),m=e.height(),i,f,k;if(g==j){return}a.log("TABPANE: switching from "+g+" to "+j);h.removeClass("current");l.addClass("current");n.find("li a[data="+g+"]").parent().removeClass("current");n.find("li a[data="+j+"]").parent().addClass("current");if(!b[j]){b[j]=l.metadata()}i=b[j];if(typeof(i.beforeHandler)=="function"){i.beforeHandler.call(this,g,j)}if((b.animate||b.autoMaxExpand)&&m>0){d.height(m)}f=d;k=false;if(typeof(i.container)!="undefined"){f=d.find(i.container);if(f.length){k=true}else{f=d}}function c(){var p="none",o;if(m>0){p="easeInOutQuad"}if(b.autoMaxExpand){if(b.animate&&p!="none"){f.css({opacity:0}).animate({opacity:1},300)}a(window).trigger("resize")}else{if(b.animate){d.height("auto");if(p!="none"){o=d.height();if(k){d.height(m).animate({height:o},300,p,function(){d.height("auto")});f.css({opacity:0}).animate({opacity:1},300,p)}else{d.height(m).css({opacity:0}).animate({opacity:1,height:o},300,p,function(){d.height("auto")})}}}}if(typeof(i.afterHandler)=="function"){i.afterHandler.call(this,g,j)}b.currentTabId=j}if(typeof(i.url)!="undefined"){f.load(i.url,undefined,function(p,o,q){if(typeof(i.afterLoadHandler)=="function"){i.afterLoadHandler.call(this,g,j)}c()});delete b[j].url}else{c()}},autoMaxExpand:function(c,b){window.setTimeout(function(){jQuery.tabpane.fixHeight(c,b);jQuery(window).one("resize",function(){a.tabpane.autoMaxExpand(c,b)})},100)},fixHeight:function(e,d){var f=e.find("> .jqTab.current .jqTabContents:first"),c=f.offset(),i,h,b,g;jQuery.log("TABPANE: called fixHeight()");if(typeof(c)=="undefined"){return}i=c.top;if(bottomBarHeight<=0){bottomBarHeight=jQuery(".natEditBottomBar").outerHeight(true)}h=jQuery(window).height();if(!h){h=window.innerHeight}b=h-i-2*bottomBarHeight+0.5;g=a("#DEBUG");if(g){b-=g.outerHeight(true)}if(d&&d.minHeight&&b<d.minHeight){b=d.minHeight}if(b<0){return}f.height(b)},defaults:{select:1,animate:false,autoMaxExpand:false,minHeight:230}};a.fn.tabpane=a.tabpane.build})(jQuery);