/* Copyright (c) 2008, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version: 2.6.0 */ (function(){var D=YAHOO.util.Dom,H=YAHOO.util.Event,C=YAHOO.widget.Tab,F=document;var E="element";var J=function(L,K){K=K||{};if(arguments.length==1&&!YAHOO.lang.isString(L)&&!L.nodeName){K=L;L=K.element||null;}if(!L&&!K.element){L=I.call(this,K);}J.superclass.constructor.call(this,L,K);};YAHOO.extend(J,YAHOO.util.Element,{CLASSNAME:"yui-navset",TAB_PARENT_CLASSNAME:"yui-nav",CONTENT_PARENT_CLASSNAME:"yui-content",_tabParent:null,_contentParent:null,addTab:function(N,P){var Q=this.get("tabs");if(!Q){this._queue[this._queue.length]=["addTab",arguments];return false;}P=(P===undefined)?Q.length:P;var S=this.getTab(P);var U=this;var M=this.get(E);var T=this._tabParent;var R=this._contentParent;var K=N.get(E);var L=N.get("contentEl");if(S){T.insertBefore(K,S.get(E));}else{T.appendChild(K);}if(L&&!D.isAncestor(R,L)){R.appendChild(L);}if(!N.get("active")){N.set("contentVisible",false,true);}else{this.set("activeTab",N,true);}var O=function(W){YAHOO.util.Event.preventDefault(W);var V=false;if(this==U.get("activeTab")){V=true;}U.set("activeTab",this,V);};N.addListener(N.get("activationEvent"),O);N.addListener("activationEventChange",function(V){if(V.prevValue!=V.newValue){N.removeListener(V.prevValue,O);N.addListener(V.newValue,O);}});Q.splice(P,0,N);},DOMEventHandler:function(Q){var L=this.get(E);var R=YAHOO.util.Event.getTarget(Q);var T=this._tabParent;if(D.isAncestor(T,R)){var M;var N=null;var K;var S=this.get("tabs");for(var O=0,P=S.length;O1){if(L+1==M){this.set("activeIndex",L-1);}else{this.set("activeIndex",L+1);}}}this._tabParent.removeChild(N.get(E));this._contentParent.removeChild(N.get("contentEl"));this._configs.tabs.value.splice(L,1);},toString:function(){var K=this.get("id")||this.get("tagName");return"TabView "+K;},contentTransition:function(L,K){L.set("contentVisible",true);K.set("contentVisible",false);},initAttributes:function(K){J.superclass.initAttributes.call(this,K);if(!K.orientation){K.orientation="top";}var M=this.get(E);if(!D.hasClass(M,this.CLASSNAME)){D.addClass(M,this.CLASSNAME);}this.setAttributeConfig("tabs",{value:[],readOnly:true});this._tabParent=this.getElementsByClassName(this.TAB_PARENT_CLASSNAME,"ul")[0]||G.call(this);this._contentParent=this.getElementsByClassName(this.CONTENT_PARENT_CLASSNAME,"div")[0]||B.call(this);this.setAttributeConfig("orientation",{value:K.orientation,method:function(N){var O=this.get("orientation");this.addClass("yui-navset-"+N);if(O!=N){this.removeClass("yui-navset-"+O);}switch(N){case"bottom":this.appendChild(this._tabParent);break;}}});this.setAttributeConfig("activeIndex",{value:K.activeIndex,method:function(N){},validator:function(N){return !this.getTab(N).get("disabled");}});this.setAttributeConfig("activeTab",{value:K.activeTab,method:function(O){var N=this.get("activeTab");if(O){O.set("active",true);}if(N&&N!=O){N.set("active",false);}if(N&&O!=N){this.contentTransition(O,N);}else{if(O){O.set("contentVisible",true);}}},validator:function(N){return !N.get("disabled");}});this.on("activeTabChange",this._handleActiveTabChange);this.on("activeIndexChange",this._handleActiveIndexChange);if(this._tabParent){A.call(this);}this.DOM_EVENTS.submit=false;this.DOM_EVENTS.focus=false;this.DOM_EVENTS.blur=false;for(var L in this.DOM_EVENTS){if(YAHOO.lang.hasOwnProperty(this.DOM_EVENTS,L)){this.addListener.call(this,L,this.DOMEventHandler);}}},_handleActiveTabChange:function(M){var K=this.get("activeIndex"),L=this.getTabIndex(M.newValue);if(K!==L){if(!(this.set("activeIndex",L))){this.set("activeTab",M.prevValue);}}},_handleActiveIndexChange:function(K){if(K.newValue!==this.getTabIndex(this.get("activeTab"))){if(!(this.set("activeTab",this.getTab(K.newValue)))){this.set("activeIndex",K.prevValue);}}}});var A=function(){var R,M,Q;var P=this.get(E);var O=D.getChildren(this._tabParent);var L=D.getChildren(this._contentParent);for(var N=0,K=O.length;N