zul.tab.Tabpanel=zk.$extends(zul.ContainerWidget,{getTabbox:function(){return this.parent?this.parent.parent:null},isVisible:function(){return this.$supers("isVisible",arguments)&&this.isSelected()},setVisible:function(){this.$supers("setVisible",arguments);this.desktop&&!this.isSelected()&&(this.$n().style.display="none")},domClass_:function(){var a=this.$supers("domClass_",arguments);this.getTabbox().inAccordionMold()&&(a+=" "+this.$s("content"));return a},getLinkedTab:function(){var a=this.getTabbox();
return a?(a=a.getTabs())?a.getChildAt(this.getIndex()):null:null},getIndex:function(){return this.getChildIndex()},isSelected:function(){var a=this.getLinkedTab();return a&&a.isSelected()},_changeSel:function(a){if(a){var b=this.$n("cave");b&&!b.style.height&&(a=a.$n("cave"))&&(b.style.height=a.style.height)}},_sel:function(a,b){var c=this.getTabbox();if(c){var d=c.inAccordionMold();if(d&&b)b=zk(this.$n("cave")),a?(c._animating=!0,b.slideDown(this,{afterAnima:function(){delete c._animating}})):b.slideUp(this);
else if(b=jq(d?this.$n("cave"):this.$n()),d=b.zk.isVisible(),a)d||(b.show(),(zk.ie9||zk.webkit)&&b.scrollTop(this._lastScrollTop),zUtl.fireShown(this));else if(d){zWatch.fireDown("onHide",this);if(zk.ie9||zk.webkit)this._lastScrollTop=b.scrollTop();b.hide()}}},getPanelContentHeight_:function(){var a=this.$n(),b=this.parent&&this.parent.$n();b=b&&b.scrollHeight+zk(b).padBorderHeight();return Math.max(a&&a.offsetHeight,b)},_fixPanelHgh:function(){var a=this.getTabbox(),b=a.$n();var c=b.style.height;
!c&&a._vflex&&(c=b.offsetHeight);if(c&&"auto"!=c)if(a.inAccordionMold()){var d=this.$n();c=b.offsetHeight;a=zk(d.parentNode);c-=a.padBorderHeight();for(a=d.parentNode.firstChild;a;a=a.nextSibling)a!=d&&(c-=a.offsetHeight);c-=d.firstChild.offsetHeight;this.$n("cave").style.height=jq.px0(c)}else d=this.$n(),c=a.isHorizontal()?zk(a).contentHeight()-zk(a.tabs).offsetHeight():zk(a).contentHeight()-zk(d.parentNode).padBorderHeight(),d.style.height=jq.px0(c)},onSize:function(){this.getTabbox().inAccordionMold()&&
!zk(this.$n("cave")).isVisible()||this._fixPanelHgh()},setVflex:function(a){"min"!=a&&(a=!1);this.$supers("setVflex",arguments)},setHflex:function(a){"min"!=a&&(a=!1);this.$supers("setHflex",arguments)},bind_:function(a){this.$supers(zul.tab.Tabpanel,"bind_",arguments);zWatch.listen({onSize:this});var b;this.getTabbox().inAccordionMold()&&(b=this.getLinkedTab())&&(b.$n()?!jq.isAncestor(this.$n(),b.$n())&&(b=this.$n("cave"))&&(b.style.display="none"):b.unbind().bind(a))},unbind_:function(){zWatch.unlisten({onSize:this});
this._lastScrollTop=null;this.$supers(zul.tab.Tabpanel,"unbind_",arguments)}});
