(function(){JUI.Class("Page",{init:function(b){this.grid=b;this.pageIndex=this.grid.opt("pageNumber");this.pageSize=this.grid.opt("pageSize");this.total=0;this.pageCount=0;this.pagination=this.grid.opt("pagination")},getPageData:function(){var b={};b[this.grid.opt("requestPageIndexName")]=this.pageIndex;b[this.grid.opt("requestPageSizeName")]=this.pageSize;return b},reload:function(){this.grid.reload()},goPage:function(b){this.pageIndex=b;this.reload()},canFirst:function(){return this.pageIndex!=1},first:function(){if(this.canFirst()){this.goPage(1)}},canPre:function(){return this.pageIndex>1},pre:function(){if(this.canPre()){this.goPage(this.pageIndex-1)}},canNext:function(){return this.pageIndex<this.pageCount},next:function(){if(this.canNext()){this.goPage(this.pageIndex+1)}},canLast:function(){return this.pageIndex!=this.pageCount&&this.pageCount>0},last:function(){if(this.pageIndex!=this.pageCount){var b=this.pageCount;this.goPage(b)}},setPageSize:function(b){this.pageSize=parseInt(b)||10;this.onChange()},onChange:function(){this.goPage(1)},setPageInfo:function(b){this.total=b[this.grid.opt("serverTotalName")]||0;this.pageCount=a(this.pageSize,this.total)}});function a(b,c){return b==0?1:parseInt((c+b-1)/b)}})();