var PagingUtil = function(){ this.curPage = 1; this.pageSize = 10; this.blockSize = 10; this.totalRecord = 10; this.firstRow = 0; this.lastRow = 0; this.totalPage = 1; this.firstPage = 1; this.lastPage = 1; this.descNo = 1; this.imageRoot = ''; this.move_url = ''; this.href_str = ''; this.pagingAreaId = 'paging'; this.callScriptFunc = 'movePaging'; }; PagingUtil.prototype = { initPaging : function(curPage , pageSize, blockSize , totalRecord , pagingAreaId , callScriptFunc){ this.curPage = curPage; this.pageSize = pageSize; this.blockSize = blockSize; this.totalRecord = totalRecord; this.firstRow = ((parseInt(this.curPage)*parseInt(this.pageSize))-parseInt(this.pageSize))+1; this.lastRow = parseInt(this.firstRow) + (parseInt(this.pageSize) -1); if(this.lastRow>this.totalRecord) this.lastRow = this.totalRecord; //this.totalPage = parseInt(this.totalRecord/this.pageSize); this.totalPage = Math.ceil(parseInt(this.totalRecord)/parseInt(this.blockSize)); this.firstPage = parseInt(this.curPage)-((parseInt(this.curPage)-1)%parseInt(this.blockSize)); //this.lastPage = parseInt(this.firstPage) + (parseInt(this.blockSize) -1); this.lastPage = parseInt(this.firstPage) + (parseInt(this.pageSize) -1); if(this.lastPage > this.totalPage) this.lastPage = this.totalPage; this.descNo = parseInt(this.totalRecord) - (parseInt(this.curPage)-1)*parseInt(this.pageSize); this.pagingAreaId = pagingAreaId; this.callScriptFunc = callScriptFunc; }, getMoveBlockStrHref : function(){ var userScriptFunc = this.callScriptFunc; getMoveBlockStrDefaultHref = function( flag , imgOption , movePage){ var href_str = ""; if(flag==-2){ href_str +="첫페이지"; }else if(flag==-1){ href_str +="마지막페이지"; } href_str +=""; return href_str; }; var href = ''; var movePage = this.curPage; if(this.curPage>this.blockSize){ movePage = 1; href += getMoveBlockStrDefaultHref( -2, "", movePage ); }else{ href += "첫페이지"; } if(this.curPage>1){ movePage = this.firstPage - this.blockSize; if(this.firstPage==1){ movePage = 1; } href += getMoveBlockStrDefaultHref( -1, "", movePage ); }else{ href += ""; } href += ''; if(this.curPage