(function(){if(zk._p=zkpi('zkmax'))try{

zk.copy(zkmax, {
	rod: function (wgt) {
		var rod = true, w = wgt, v;
		for (; w; w = w.parent)
			if ((v = w.z$rod) != null) {
				if (wgt === w)
					return v;
				rod = v;
				break;
			}
		if (wgt && (wgt = wgt.parent) && wgt !== w)
			wgt.z$rod = rod;
			
		return rod;
	},
	rodRender: function (wgt) {
		var p;
		wgt.replaceHTML('#' + wgt.uuid, (p=wgt.parent) ? p.desktop: wgt.desktop);
			
	}
});

zk.afterLoad('zul.tab',function(){

(function () {
	var _xTabpanel = {}, Tabpanel = zul.tab.Tabpanel;

zk.override(Tabpanel.molds, _xTabpanel.molds = {}, {
	'default': function (out) {
		if (!this.isSelected() && !this.getTabbox().inAccordionMold()
		&& zkmax.rod(this)) {
			this.z_rod = true;
			out.push('<div id="', this.uuid, '" style="display:none"></div>');
			return;
		}
		_xTabpanel.molds['default'].apply(this, arguments);
	}
});
zk.override(Tabpanel.prototype, _xTabpanel, {
	_sel: function (toSel) {
		if (toSel && this.z_rod)
			zkmax.rodRender(this);

		_xTabpanel._sel.apply(this, arguments);
	}
});

})();
});
zk.afterLoad('zul.wgt',function(){

(function () {
	var _xPopup = {}, Popup = zul.wgt.Popup;

zk.override(Popup.molds, _xPopup.molds = {}, {
	'default': function (out) {
		if (this._rodopen)
			delete this._rodopen;
		else if (!this.isOpen() && zkmax.rod(this)) {
			this.z_rod = true;
			out.push('<div id="', this.uuid, '" style="display:none"></div>');
			return;
		}
		_xPopup.molds['default'].apply(this, arguments);
	}
});
zk.override(Popup.prototype, _xPopup, {
	open: function () {
		if (this.z_rod) {
			this._rodopen = true; 
			zkmax.rodRender(this);
		}

		_xPopup.open.apply(this, arguments);
	}
});

})();

(function () {
	var _xGroupbox = {};

	function firstChild(wgt) {
		for (var w = wgt.firstChild, cap = wgt.caption; w; w = w.nextSibling)
			if (w != cap) return w;
	}

zk.override(zul.wgt.Groupbox.prototype, _xGroupbox, {
	_redrawCave: function (out) {
		var w;
		if (this._rodopen)
			delete this._rodopen;
		else if ((w = firstChild(this)) && !this._open && zkmax.rod(this)) {
			out.push('<div id="', this.uuid, '-cave"');
			if (!this.isLegend())
				out.push(' style="display:none;border:1px solid"');
					
			out.push('></div>');

			this.z_childrod = true; 
			for (; w; w = w.nextSibling)
				if (w != this.caption)
					w.z_rod = true;
			return;
		}

		delete this.z_childrod;
		_xGroupbox._redrawCave.apply(this, arguments);
	},
	setOpen: function () {
		var w;
		if ((w=firstChild(this)) && w.z_rod) {
			this._rodopen = true; 

			var out = [];
			this._redrawCave(out);
			jq('#' + this.uuid + '-cave').replaceWith(out.join(''));

			for (; w; w = w.nextSibling) {
				w.unbind();
				w.bind(this.desktop);
			}
			this.clearCache();
		}

		_xGroupbox.setOpen.apply(this, arguments);
	}
});

})();

});
zk.afterLoad('zul.menu',function(){

(function () {
	var _xMenupopup = {}, Menupopup = zul.menu.Menupopup;

zk.override(Menupopup.molds, _xMenupopup.molds = {}, {
	'default': function (out) {
		if (this._rodopen)
			delete this._rodopen;
		else if (!this.isOpen() && zkmax.rod(this)) {
			this.z_rod = true;
			out.push('<div id="', this.uuid, '" style="display:none"></div>');
			return;
		}
		_xMenupopup.molds['default'].apply(this, arguments);
	}
});
zk.override(Menupopup.prototype, _xMenupopup, {
	open: function () {
		if (this.z_rod) {
			this._rodopen = true; 
			zkmax.rodRender(this);
		}

		_xMenupopup.open.apply(this, arguments);
	}
});

})();
});
zk.afterLoad('zul.inp',function(){

(function () {
	var _xCombobox = {}, _xBandbox = {};

	function _redrawpp(wgt, out) {
		var w;
		if (wgt._rodopen)
			delete wgt._rodopen;
		else if ((w = wgt.firstChild) && !wgt._open && zkmax.rod(wgt)) {
			out.push('<div id="', wgt.uuid,
				'-pp" style="display:none"></div>');
			wgt.z_childrod = true; 
			for (; w; w = w.nextSibling)
				w.z_rod = true;
			return true;
		}
		delete wgt.z_childrod;
	}
	function _renderpp(wgt) {
		var w;
		if ((w=wgt.firstChild) && w.z_rod) {
			wgt._rodopen = true; 

			var out = [];
			wgt.redrawpp_(out);
			jq('#' + wgt.uuid + '-pp').replaceWith(out.join(''));

			for (; w; w = w.nextSibling) {
				w.unbind();
				w.bind(wgt.desktop);
			}
			wgt.clearCache();
		}
	}

zk.override(zul.inp.Combobox.prototype, _xCombobox, {
	redrawpp_: function (out) {
		if (!_redrawpp(this, out))
			_xCombobox.redrawpp_.apply(this, arguments);
	},
	open: function () {
		_renderpp(this);
		_xCombobox.open.apply(this, arguments);
	}
});

zk.override(zul.inp.Bandbox.prototype, _xBandbox, {
	redrawpp_: function (out) {
		if (!_redrawpp(this, out))
			_xBandbox.redrawpp_.apply(this, arguments);
	},
	open: function () {
		_renderpp(this);
		_xBandbox.open.apply(this, arguments);
	}
});

})();

});
zk.afterLoad('zul.sel',function(){

(function () {
	var listbox$overrode = {};
	
zk.override(zul.sel.Listbox.prototype, listbox$overrode, {
	_totalSize: 0, 
	_avgrowhgh: 21, 
	_offset: 0, 
	_limit: 20, 
	_bufpad: 16*10, 
	_viewtop: 0,
	_lasttop: 0,
	_totalhgh: null,
	_rowshgh: null,
	_topPad: 0,
	_itop: 0, 
	_ibottom: 0, 
	domPad_: function (out, padId) { 
		if (this._listbox$rod) {
			if (!zk.safari)
				out.push('<tbody><tr id="',
						this.uuid, padId, '"></tr></tbody>');
			else
				out.push('<tbody><tr><td id="',
						this.uuid, padId, '"></td></tr></tbody>');
		}
	},
	setTotalSize: function (v) { 
		if (this._listbox$rod) {
			if (v != this._totalSize) {
				this._totalSize = v;
			}
			if (!this._scrolling) {
				this._initPadSizes();
				if (zk.ie) this._doScroll();
			}
		}
	},
	_doScroll: function () {
		listbox$overrode._doScroll.apply(this, arguments);
		if (this._listbox$rod && !this.inPagingMold() && !this.inSelectMold())
				this._fireScrollPage();
	},
	_fireScrollPage: function(time) {
		if (!this.inPagingMold() && !this.inSelectMold())
			setTimeout(this.proxy(this._scrollPage), time >= 0 ? time : zk.gecko ? 200 : 60);
	},
	_calcSize: function () {
		listbox$overrode._calcSize.apply(this, arguments);
		if (this._listbox$rod && !this.inPagingMold() && !this.inSelectMold()) 
			this._initPadSizes();
	},
	_initPadSizes: function() {
		if (this.inPagingMold()) return; 
		if (this._justScrollPads) { 
			delete this._justScrollPads;
			return;
		}
		var erows = this.$n('rows');
		if (!erows) return; 

		var	nrow = this._nrows,
			tpad = this.$n('tpad'),
			tpadstyle = tpad.style,
			bpad = this.$n('bpad'),
			bpadstyle = bpad.style,
			rowshgh = this._rowshgh = erows.offsetHeight,
			tsize = this._totalSize,
			ebody = this.ebody;
		this._avgrowhgh = nrow > 0 ? ((rowshgh / nrow) | 0) : 21;
		this._ibottom = this._offset + nrow;
		if (this._topPad < 0)
			this._topPad = this._offset * this._avgrowhgh;
		if (this._offset == 0)
			this._topPad = 0;
		var tpadhgh = this._topPad,
			bpadhgh = tsize * this._avgrowhgh - rowshgh - tpadhgh;
		if (bpadhgh < 0) {
			if (this._offset > 0) tpadhgh += bpadhgh;
			bpadhgh = 0;
			if (tpadhgh < 0) tpadhgh = 0;
		} else if (this._totalSize <= this._ibottom)
			bpadhgh = 0;
		
		this._topPad = tpadhgh;
		this.fire('onTopPad', {topPad:this._topPad});

		tpadstyle.height = tpadhgh + 'px';
		bpadstyle.height = bpadhgh + 'px';
		this._totalhgh = this.ebodytbl.offsetHeight;
		this._itop = this._offset;
		var ebodyhgh = ebody.offsetHeight;
		this._limit = (((ebodyhgh + this._bufpad * 2) / this._avgrowhgh) | 0) + 2;
		
		if (!this._viewtop && !this._lasttop && this._currentTop > 0)
			this._viewtop = this._lasttop = this._currentTop; 

		if (this._totalSize > this._ibottom) {
			ebody.scrollTop = this._currentTop;
			var viewtop = this._viewtop = ebody.scrollTop,
				viewbottom = viewtop + ebodyhgh,
				lasterow = erows.lastChild,
				rowbottom = lasterow ? this._rowScrollBottom(lasterow) : tpadhgh;
			if (viewbottom > rowbottom) 
				this.fire('onDataLoading', {offset:this._itop, limit:this._limit});
		}
	},
	_rowScrollBottom: function(erow) { 
		return erow.offsetTop + erow.offsetHeight - (this.ebodytbl.offsetParent == erow.offsetParent ? this.ebodytbl.offsetTop : 0); 
	},
	_rowOffsetTop: function(erow) { 
		var erows = this.$n('rows'); 
		return erow.offsetTop - (erows.offsetParent == erow.offsetParent ? erows.offsetTop : 0); 
	},
	setJumpTo_: function (v) {
		var top = v * this._avgrowhgh;
		this.ebody.scrollTop = top; 
	},	
	_scrollPage: function () {
		var erows= this.$n('rows');
		
		if (!this.desktop || !erows) return;
		
		var ebody = this.ebody,
			viewtop = this._viewtop = ebody.scrollTop, 
			viewbottom = viewtop + ebody.offsetHeight;
		
		if (this._inScrollPads) {
			return;
		}
		
		var	tpadhgh = this.$n('tpad').offsetHeight,
			top = this._lasttop,
			rowstop = tpadhgh,
			rowshgh = this._rowshgh,
			rowsbottom = rowstop + rowshgh;
		
		if (viewtop != top) { 
			
			var buftop = viewtop - this._bufpad,
				bufbottom = viewbottom + this._bufpad;
			if (buftop < 0) buftop = 0;
			if (bufbottom > this._totalhgh) bufbottom = this._totalhgh - (zk.ie ? 1 : 0);
			if (viewtop > top) {
				if (rowsbottom < bufbottom) { 
					var offset = this._itop;
					if (rowsbottom < buftop) { 
						offset = this._ibottom + (((buftop - rowsbottom) / this._avgrowhgh) | 0);
					} else {
						var uplimit = buftop - tpadhgh;
						if (uplimit >= 0) {
							var j = this._ibottom - 1;
							offset = 0;
							for (var row = this.lastItem; row; row = this.previousItem(row), --j) {
								var rowp = this._rowOffsetTop(row.$n());
								if (rowp < uplimit) { 
									offset = j;
									break;
								}
							}
						}
					}
					if (offset >= this._totalSize)
						offset = this._totalSize - this._limit;
					if (offset < 0 || viewtop == 0) offset = 0;
					if (offset != this._offset) {
						this._offset = offset;
						this._lasttop = viewtop;
						this.fire('onDataLoading', {offset:offset, limit:this._limit});
					}
				}
			} else { 
				if (rowstop > buftop || (buftop == 0 && this._offset > 0)) { 
					var offset = buftop == 0 ? 0 : (this._itop - ((rowstop - buftop) / this._avgrowhgh) | 0);
					if (offset >= this._totalSize)
						offset = this._totalSize - this._limit;
					if (offset < 0) offset = 0;
					if (offset != this._offset) {
						this._offset = offset;
						this._lasttop = viewtop;
						this.fire('onDataLoading', {offset:offset, limit:this._limit});
					}
				}
			}
		}
	},
	setScrollPads_: function (m) { 
		var v = m.offset,
			sel = m.sel;
		this._justScrollPads = true;
		
		delete this._scrolling;
		
	 	if (!this._listbox$rod || v != this._offset) return; 

		this._inScrollPads = true; 
		
		var erows = this.$n('rows'),
			tpad = this.$n('tpad'),
			bpad = this.$n('bpad'),
			tpadhgh = tpad.offsetHeight,
			bpadhgh = bpad.offsetHeight,
			orowshgh = this._rowshgh,
			oitop = this._itop,
			oibottom = this._ibottom,
			rowshgh = this._rowshgh = erows.offsetHeight,
			tsize = this._totalSize,
			itop = this._itop = v,
			ibottom = this._ibottom = itop + this._nrows;

		if (itop > oitop) { 
			if (itop >= oibottom) { 
				tpadhgh = tpadhgh + orowshgh + ((v - oibottom) * this._avgrowhgh | 0);
			} else { 
				var tgt = this.firstItem;
				for (var k = itop; k < oibottom && tgt; ++k)
					tgt = this.nextItem(tgt);
				
				tpadhgh = tpadhgh + orowshgh - (tgt ? this._rowOffsetTop(tgt.$n()) : rowshgh);
			}
		} else if (itop < oitop) { 
			if (ibottom <= oitop) { 
				tpadhgh = tpadhgh - ((oitop - v) * this._avgrowhgh | 0);
			} else { 
				var tgt = this.lastItem; 
				for (var k = ibottom - 1; k > oitop && tgt; --k)
					tgt = this.previousItem(tgt);
				
				tpadhgh = tpadhgh - (tgt ? this._rowOffsetTop(tgt.$n()) : rowshgh);
			}
		}
 		if (v == 0) 
 			tpadhgh = 0;
 		else if (tpadhgh == 0) 
 			tpadhgh = v * this._avgrowhgh;
		bpadhgh = this._totalhgh - rowshgh - tpadhgh;
		var resetend = bpadhgh > 0 && ibottom >= tsize; 
		if (resetend) 
			bpadhgh = 0;
			
		if (bpadhgh < 0) {
			resetend = true;
			bpadhgh = ((tsize - ibottom) * this._avgrowhgh) | 0;
		}
		this._topPad = tpadhgh;
		this.fire('onTopPad', {topPad:this._topPad});
		
		tpad.style.height = (tpadhgh < 0 ? 0 : tpadhgh) + 'px';
		bpad.style.height = (bpadhgh < 0 ? 0 : bpadhgh) + 'px';
		
		if (tpadhgh < 0 || bpadhgh < 0 || resetend)
			this._totalhgh = this.ebodytbl.offsetHeight; 
		
		
		if (this._totalSize <= ibottom && this._viewtop > this.ebody.scrollTop)
			this.ebody.scrollTop = this._viewtop;
		
		if (sel) {
			var item = zk.Widget.$(sel);
			if (item) {
				this._syncFocus(item);
				this._setFocus(item, true);
	 			zk(item).scrollIntoView(this.ebody);
			}
		}
		
		delete this._inScrollPads;
		if (this._lasttop != this._viewtop) {
			this._fireScrollPage();
		}
	}
});
})();


(function () {
	var _xTreerow = {}, _xTreeitem = {},
		Tree = zul.sel.Tree;

	function _isClose(wgt) { 
		
		wgt = wgt.parent; 
		if (wgt && !wgt._rodopen)
			while ((wgt = wgt.parent) && !Tree.isInstance(wgt))
				if (!wgt._rodopen && wgt.isOpen && !wgt.isOpen())
					return true;
	}
	function _renderItem(ti, open) {
		var tr;
		if (open && (ti = ti.treechildren) && (ti = ti.firstChild) 
		&& (tr = ti.treerow) 
		&& tr.z_rod) 
			for (; ti; ti = ti.nextSibling) { 
				ti._rodopen = true; 
				if (tr = ti.treerow)
					zkmax.rodRender(tr);
				if (ti.isOpen() && ti.treechildren)
					_renderItem(ti, true);
				delete ti._rodopen;
			}
	}

zk.override(zul.sel.Treerow.molds, _xTreerow.molds = {}, {
	'default': function (out) {
		if (zkmax.rod(this) && _isClose(this)) {
			this.z_rod = true;
			out.push('<tr id="', this.uuid, '" style="display:none"></tr>');
			return;
		}
		_xTreerow.molds['default'].apply(this, arguments);
	}
});
zk.override(zul.sel.Treeitem.prototype, _xTreeitem, {
	setOpen: function (open) {
		_renderItem(this, open);
		_xTreeitem.setOpen.apply(this, arguments);
	}
});

})();
});
zk.afterLoad('zul.grid', function(){

(function () {
	var grid$overrode = {};
	
zk.override(zul.grid.Grid.prototype, grid$overrode, {
	_totalSize: 0, 
	_avgrowhgh: 21, 
	_offset: 0, 
	_limit: 20, 
	_bufpad: 21*10, 
	_viewtop: 0,
	_lasttop: 0,
	_totalhgh: null,
	_rowshgh: null,
	_topPad: 0,
	_itop: 0, 
	_ibottom: 0, 
	domPad_: function (out, padId) { 
		if (this._grid$rod) {
			if (!zk.safari)
				out.push('<tbody><tr id="',
						this.uuid, padId, '"></tr></tbody>');
			else
				out.push('<tbody><tr><td id="',
						this.uuid, padId, '"></td></tr></tbody>');
		}
	},
	setTotalSize: function (v) { 
		if (this._grid$rod) {
			if (v != this._totalSize) {
				this._totalSize = v;
			}
			if (!this._scrolling) {
				this._initPadSizes();
				if (zk.ie) this._doScroll();
			}
		}
	},
	_doScroll: function () {
		grid$overrode._doScroll.apply(this, arguments);
		if (this._grid$rod && !this.inPagingMold())
				this._fireScrollPage();
	},
	_fireScrollPage: function(time) {
		if (!this.inPagingMold())
			setTimeout(this.proxy(this._scrollPage), time >= 0 ? time : zk.gecko ? 200 : 60);
	},
	_calcSize: function () {
		grid$overrode._calcSize.apply(this, arguments);
		if (this._grid$rod && !this.inPagingMold()) 
			this._initPadSizes();
	},
	_initPadSizes: function() {
		if (this.inPagingMold()) return; 
		var rows = this.rows;
		if (!rows) return; 
		
		var	nrow = rows.nChildren,
			erows = rows.$n(),
			tpad = this.$n('tpad'),
			tpadstyle = tpad.style,
			bpad = this.$n('bpad'),
			bpadstyle = bpad.style,
			rowshgh = this._rowshgh = erows.offsetHeight,
			tsize = this._totalSize,
			ebody = this.ebody;
		this._avgrowhgh = nrow > 0 ? ((rowshgh / nrow) | 0) : 21;
		this._ibottom = this._offset + nrow;
		if (this._topPad < 0)
			this._topPad = this._offset * this._avgrowhgh;
		if (this._offset == 0)
			this._topPad = 0;
		var tpadhgh = this._topPad;
		var bpadhgh = tsize * this._avgrowhgh - rowshgh - tpadhgh;
		if (bpadhgh < 0) {
			if (this._offset > 0) tpadhgh += bpadhgh;
			bpadhgh = 0;
			if (tpadhgh < 0) tpadhgh = 0;
		} else if (this._totalSize <= this._ibottom)
			bpadhgh = 0;
		
		this._topPad = tpadhgh;
		this.fire('onTopPad', {topPad:this._topPad});

		tpadstyle.height = tpadhgh + 'px';
		bpadstyle.height = bpadhgh + 'px';
		this._totalhgh = this.ebodytbl.offsetHeight;
		this._itop = this._offset;
		var ebodyhgh = ebody.offsetHeight;
		this._limit = (((ebodyhgh + this._bufpad * 2) / this._avgrowhgh) | 0) + 2;
		
		if (!this._viewtop && !this._lasttop && this._currentTop > 0)
			this._viewtop = this._lasttop = this._currentTop; 

		if (this._totalSize > this._ibottom) {
			ebody.scrollTop = this._currentTop;
			var viewtop = this._viewtop = ebody.scrollTop,
				viewbottom = viewtop + ebodyhgh,
				lasterow = rows.lastChild.$n(),
				rowbottom = this._rowScrollBottom(lasterow);
			if (viewbottom > rowbottom) 
				this.fire('onDataLoading', {offset:this._itop, limit:this._limit});
		}
	},
	_rowScrollBottom: function(erow) { 
		return erow.offsetTop + erow.offsetHeight - (this.ebodytbl.offsetParent == erow.offsetParent ? this.ebodytbl.offsetTop : 0); 
	},
	_rowOffsetTop: function(erow) { 
		var erows = this.rows.$n(); 
		return erow.offsetTop - (erows.offsetParent == erow.offsetParent ? erows.offsetTop : 0); 
	},
	_scrollPage: function () {
		var rows= this.rows;
		
		if (!this.desktop || !rows) return;
		
		var ebody = this.ebody,
			viewtop = this._viewtop = ebody.scrollTop, 
			viewbottom = viewtop + ebody.offsetHeight;
		
		if (this._inScrollPads) {
			return;
		}
		
		var	erows = rows.$n(), 
			tpadhgh = this.$n('tpad').offsetHeight,
			top = this._lasttop,
			rowstop = tpadhgh,
			rowshgh = this._rowshgh,
			rowsbottom = rowstop + rowshgh;
		
		if (viewtop != top) { 
			
			var buftop = viewtop - this._bufpad,
				bufbottom = viewbottom + this._bufpad;
			if (buftop < 0) buftop = 0;
			if (bufbottom > this._totalhgh) bufbottom = this._totalhgh - (zk.ie ? 1 : 0);
			if (viewtop > top) {
				if (rowsbottom < bufbottom) { 
					var offset = this._itop;
					if (rowsbottom < buftop) { 
						offset = this._ibottom + (((buftop - rowsbottom) / this._avgrowhgh) | 0);
					} else {
						var uplimit = buftop - tpadhgh;
						if (uplimit >= 0) {
							var j = this._ibottom - 1;
							offset = 0;
							for (var row = rows.lastChild; row; row = row.previousSibling, --j) {
								var rowp = this._rowOffsetTop(row.$n());
								if (rowp < uplimit) { 
									offset = j;
									break;
								}
							}
						}
					}
					if (offset >= this._totalSize)
						offset = this._totalSize - this._limit;
					if (offset < 0 || viewtop == 0) offset = 0;
					if (offset != this._offset) {
						this._offset = offset;
						this._lasttop = viewtop;
						this.fire('onDataLoading', {offset:offset, limit:this._limit});
					}
				}
			} else { 
				if (rowstop > buftop || (buftop == 0 && this._offset > 0)) { 
					var offset = buftop == 0 ? 0 : (this._itop - ((rowstop - buftop) / this._avgrowhgh) | 0);
					if (offset >= this._totalSize)
						offset = this._totalSize - this._limit;
					if (offset < 0) offset = 0;
					if (offset != this._offset) {
						this._offset = offset;
						this._lasttop = viewtop;
						this.fire('onDataLoading', {offset:offset, limit:this._limit});
					}
				}
			}
		}
	},
	setScrollPads_: function (v) { 
		
		delete this._scrolling;
		
	 	if (!this._grid$rod || v != this._offset) return; 

		this._inScrollPads = true; 
		
		var rows = this.rows,
			erows = rows.$n(),
			tpad = this.$n('tpad'),
			bpad = this.$n('bpad'),
			tpadhgh = tpad.offsetHeight,
			bpadhgh = bpad.offsetHeight,
			orowshgh = this._rowshgh,
			oitop = this._itop,
			oibottom = this._ibottom,
			rowshgh = this._rowshgh = erows.offsetHeight,
			tsize = this._totalSize,
			itop = this._itop = v,
			ibottom = this._ibottom = itop + rows.nChildren;

		if (itop > oitop) { 
			if (itop >= oibottom) { 
				tpadhgh = tpadhgh + orowshgh + ((v - oibottom) * this._avgrowhgh | 0);
			} else { 
				var tgt = rows.firstChild;
				for (var k = itop; k < oibottom && tgt; ++k)
					tgt = tgt.nextSibling;
				
				tpadhgh = tpadhgh + orowshgh - (tgt ? this._rowOffsetTop(tgt.$n()) : rowshgh);
			}
		} else if (itop < oitop) { 
			if (ibottom <= oitop) { 
				tpadhgh = tpadhgh - ((oitop - v) * this._avgrowhgh | 0);
			} else { 
				var tgt = rows.lastChild; 
				for (var k = ibottom - 1; k > oitop && tgt; --k)
					tgt = tgt.previousSibling;
				
				tpadhgh = tpadhgh - (tgt ? this._rowOffsetTop(tgt.$n()) : rowshgh);
			}
		}
 		if (v == 0) 
 			tpadhgh = 0;
 		else if (tpadhgh == 0) 
 			tpadhgh = v * this._avgrowhgh;
		bpadhgh = this._totalhgh - rowshgh - tpadhgh;
		var resetend = bpadhgh > 0 && ibottom >= tsize; 
		if (resetend) 
			bpadhgh = 0;
			
		if (bpadhgh < 0) {
			resetend = true;
			bpadhgh = ((tsize - ibottom) * this._avgrowhgh) | 0;
		}
		this._topPad = tpadhgh;
		this.fire('onTopPad', {topPad:this._topPad});
		
		tpad.style.height = (tpadhgh < 0 ? 0 : tpadhgh) + 'px';
		bpad.style.height = (bpadhgh < 0 ? 0 : bpadhgh) + 'px';
		
		if (tpadhgh < 0 || bpadhgh < 0 || resetend)
			this._totalhgh = this.ebodytbl.offsetHeight; 
		
		
		if (this._totalSize <= ibottom && this._viewtop > this.ebody.scrollTop)
			this.ebody.scrollTop = this._viewtop;
		
		delete this._inScrollPads;
		if (this._lasttop != this._viewtop) 
			this._fireScrollPage();
	}
});
})();

});
zk.afterLoad('zul.wnd', function(){

(function () {
	var _xPanelchildren = {};

zk.override(zul.wnd.Panelchildren.molds, _xPanelchildren.molds = {}, {
	'default': function (out) {
		if (this._rodopen)
			delete this._rodopen;
		else {
			var p;
			if ((p = this.parent) && !p._open && zkmax.rod(this)) {
				this.z_rod = true;
				out.push('<div id="', this.uuid, '" style="display:none"></div>');
				return;
			}
		}
		_xPanelchildren.molds['default'].apply(this, arguments);
	}
});
zk.override(zul.wnd.Panel.prototype, _xPanelchildren, {
	setOpen: function (open) {
		var pc;
		if (open && (pc = this.panelchildren) && pc.z_rod) {
			pc._rodopen = true; 
			zkmax.rodRender(pc);
		}

		_xPanelchildren.setOpen.apply(this, arguments);
	}
});

})();
});

}finally{zk.setLoaded(zk._p.n);}})();
