function BuilderPage(totalRows, pageSize){
    this.totalRows=totalRows;
    this.pageSize=pageSize;
    this.totalPages=Math.floor((totalRows+pageSize-1)/pageSize);
}

BuilderPage.prototype.getPage=function(page,action){
        var myPage=null;
        if(page==null){
            myPage=new Page(1,this.totalPages,this.pageSize,this.totalRows);
        }else{
        	myPage=new Page(page,this.totalPages,this.pageSize,this.totalRows);
    	}
    if(action!=null){
        if(action=="first"){
            myPage.first();
        }else if(action=="last"){
            myPage.last();
        }else if(action=="next"){
            myPage.nextPage();
        }else if(action=="previous"){
            myPage.previousPage();
        }
        
    }
    return myPage;
};