jQuery.fn.initBogoTabs=function(E,G){G=jQuery.extend({activeLabelClass:"bogoTabsActiveLabel",inactiveLabelClass:"bogoTabsInactiveLabel",debugBogoTabs:false},G);var J=this;J.dbgdiv=null;function B(L){if(J.dbgdiv){J.dbgdiv.append("BogoTabs: "+L+"<br/>")}}if(G.debugBogoTabs){this.after("<div id='bogoTabsDebugDiv'>Debugging area</div>");J.dbgdiv=jQuery("#bogoTabsDebugDiv");J.dbgdiv.css("border","1px dashed #000");B("debugging activated.")}function D(){var L=this;L.buttons=[];L.funcs={};L.currentTab=null}J.holder=new D();function A(M){if(M[0]!="#"){M="#"+M}M=M.replace(/-tabtrigger/,"");B("switchTabs("+M+")");if(J.currentTab){var R=J.currentTab.attr("id");if("#"+R==M){B("Skipping tab activated: tab '"+M+"' already active.");return false}J.currentTab.hide();var Q=J.holder.funcs["#"+R];if(Q.onhide){B("Calling onhide handler for tab "+R+".");(Q.onhide)(J.currentTab)}}var P=null;for(var N in J.holder.buttons){var O=J.holder.buttons[N];if(N==M){P=jQuery(N);O.removeClass(G.inactiveLabelClass).addClass(G.activeLabelClass)}else{O.removeClass(G.activeLabelClass).addClass(G.inactiveLabelClass)}}var L=J.holder.funcs[M];if(L.onselect){(L.onselect)(P)}P.show();if(L.onshow){B("Calling onshow handler for tab "+M+".");(L.onshow)(P)}J.currentTab=P;return false}var K=null;for(var I in E){if(!K){K=I}var C=jQuery(I);var H=E[I];if(H["selected"]){K=I}C.hide();this.append(C);var F=jQuery("<span/>");J.holder.buttons[I]=F;J.holder.funcs[I]={"onselect":H.onselect,"onshow":H.onshow,"onhide":H.onhide};C[0].activateTab=function(){B(I+": activateTab(): "+this.id);return A(this.id)};F[0].tabElem=C[0];F.html(H["label"]).css("cursor","pointer");F.click(function(){return this.tabElem.activateTab()});this.before(F)}A(K)}
