
function ListPager(param,poirequest){if(!param||!param&&!param["hit"]&&!param["pm"]&&!param["page"])return null;this.hit=parseInt(param["hit"]);this.pm=parseInt(param["pm"]);this.page=parseInt(param["page"]);this.vp=parseInt(param["vp"]);if(this.pm<this.vp){this.pageMax=Math.ceil(this.hit/this.vp);this.pm=this.vp;}
else{this.pageMax=Math.ceil(this.hit/this.pm);}
if(this.hit-(this.vp*this.page)>this.vp){this.next_pm=this.vp;}
else{this.next_pm=this.hit-(this.vp*this.page);}
this.startIndex=(this.page-1)*this.pm+1;this.endIndex=this.startIndex+this.pm-1<this.hit?this.startIndex+this.pm-1:this.hit;this.prevAble=this.page!=1?true:false;this.nextAble=this.page!=this.pageMax?true:false;if(this.endIndex==0)this.startIndex=0;this.hiddenZero=true;if(typeof(param["hiddenZero"])!="undefined"&&param["hiddenZero"]==false){this.hiddenZero=false;}
if(typeof(param["return_count"])!="undefined"&&param["return_count"]){this.addmati_return_count=param['return_count'];}else{this.addmati_return_count=false;}
this.id="ListPager"+(ListPager.IDCounter);this.instanceId=ListPager.IDCounter;ListPager.INSTANCE_HASH[this.instanceId]=this;ListPager.IDCounter++;this.pr=poirequest;}
ListPager.IDCounter=0;ListPager.INSTANCE_HASH=new Array();ListPager.GETNEXT=function(insId){var ins=ListPager.INSTANCE_HASH[insId];ins.getNext();}
ListPager.GETPREV=function(insId){var ins=ListPager.INSTANCE_HASH[insId];ins.getPrev();}
ListPager.GETBYPAGEINDEX=function(insId,index){var ins=ListPager.INSTANCE_HASH[insId];ins.getByPageIndex(index);}
ListPager.prototype.getNext=function(){if(search_api_type=="rangeinfo"){info_search_next();return;}
if(search_api_type=="block_poiwithin"){block_search_next();return;}
if(mblock_grp!=""){getNextBlock();}
else{getPAndNLandMark('next');}}
ListPager.prototype.getPrev=function(){if(search_api_type=="rangeinfo"){info_search_prev();return;}
if(search_api_type=="block_poiwithin"){block_search_prev();return;}
if(mblock_grp!=""){getPrevBlock();}
else{getPAndNLandMark('prev');}}
ListPager.prototype.getByPageIndex=function(index){this.pr.getByPageIndex(index);}
ListPager.prototype.regExpReplace=function(replaceStr){var exp=new RegExp("getNext\\([^\)]*\\)","g");var str="ListPager.GETNEXT("+this.instanceId+")";replaceStr=replaceStr.replace(exp,str)
exp=new RegExp("getPrev\\([^\)]*\\)","g");str="ListPager.GETPREV("+this.instanceId+")";replaceStr=replaceStr.replace(exp,str)
for(var i=0;i<10;i++){var exp=new RegExp("getByPageIndex","g");var result=replaceStr.match(exp);if(!result||result.length==0)break;exp=new RegExp("(.*)(getByPageIndex\\()([^\\)]*)(.*)");replaceStr.match(exp);replaceStr=RegExp.$1+"ListPager.GETBYPAGEINDEX("+this.instanceId+","+RegExp.$3+RegExp.$4;}
return replaceStr;}
