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