function Pager(curPageNum,totalNum,perPage,imgHost){
	this.baseURL = document.baseURI || document.URL;
	if (this.baseURL && this.baseURL.match(/(.*)\/([^\/]+)/))
		this.baseURL = RegExp.$1 + "/";
	this._pageImgUrl	 = this.baseURL + 'img/';
	this._pageLinkUrl    = '';
	this._currentPage    = curPageNum;
	this._totalRecordsNum = totalNum;
	if(typeof(imgHost)!='undefined'&&imgHost!=''){
	}else{
		imgHost = '';
	}
	this._firstPageHtml = "<img src='"+imgHost+"/common/img/page/first.gif'>";
	this._lastPageHtml  = "<img src='"+imgHost+"/common/img/page/end.gif'>";
	this._prevPageHtml  = "<img src='"+imgHost+"/common/img/page/last.gif'>";
	this._nextPageHtml  = "<img src='"+imgHost+"/common/img/page/next.gif'>";

	if(typeof perPage=='undefined')
		this._perPage   = 10;
	else
		this._perPage   = perPage;
	this._linkPerPage   = 5;
	this._pageLayerWidth= 813;
	this._nextMoreLink 	= "→";
	this._prevMoreLink 	= "←";
	this._pageHeader     = "页码:";
	this._nextPageParam  = 'page';
	this._showPageLink = true;
	if(this._totalRecordsNum % this._perPage ==0)
		this._totalPageNum = this._totalRecordsNum / this._perPage;
	else if(this._totalRecordsNum > this._perPage){
		this._totalPageNum = Math.floor(this._totalRecordsNum / this._perPage) + 1;
	}else if(Math.floor(this._totalRecordsNum / this._perPage)==0){
		this._totalPageNum = 1;
	}else{
		this._totalPageNum = Math.floor(this._totalRecordsNum / this._perPage);
	}
	this._startRecordsNO = (this._currentPage - 1) * this._perPage;
}
/**
 * set current page link url
 */
Pager.prototype.setFirstPageHtml = function(fh){
	this._firstPageHtml = fh;
}
Pager.prototype.setPrevPageHtml = function(ph){
	this._prevPageHtml = ph;
}
Pager.prototype.setNextPageHtml = function(nh){
	this._nextPageHtml = nh;
}
Pager.prototype.setLastPageHtml = function(lp){
	this._lastPageHtml = lp;
}
Pager.prototype.setPrevMoreLink = function(pml){
	this._prevMoreLink = pml;
}
Pager.prototype.setLastMoreLink = function(lml){
	this._lastMoreLink = lml;
}
Pager.prototype.setNextPageParam = function(para){
	this._nextPageParam = para;
}
Pager.prototype._getFirstPageHtml = function(anchor){
	if(typeof anchor == 'undefined'){
		anchor = true;
	}
	var outPut = '';
	if(anchor){
		outPut = "<a href='"+this.getUrl(1) + "' class=\"first\">"+this._firstPageHtml+"</a>";
		return outPut;
	}else{
		return "";	
	}
}
Pager.prototype._getNextPageHtml = function(anchor){
	if(typeof anchor == 'undefined'){
		anchor = true;
	}
	tmpPage = parseInt(this._currentPage) + 1;
	var outPut = '';
	if(anchor){
		outPut = "<a href='"+this.getUrl(tmpPage) + "' class=\"next\">"+this._nextPageHtml+"</a>";
		return outPut;
	}else{
		return "";	
	}
}
Pager.prototype._getPrevPageHtml = function(anchor){
	if(typeof anchor == 'undefined'){
		anchor = true;
	}
	tmpPage = parseInt(this._currentPage) - 1;
	var outPut = '';
	if(anchor){
		outPut = "<a href='"+this.getUrl(tmpPage) + "' class=\"last\">"+this._prevPageHtml+"</a>";
		return outPut;
	}else{
		return "";	
	}
}
Pager.prototype._getLastPageHtml = function(anchor){
	if(typeof anchor == 'undefined'){
		anchor = true;
	}
	var outPut = '';
	if(anchor){
		outPut = "<a href='"+this.getUrl(this._totalPageNum) + "' class=\"end\">"+this._lastPageHtml+"</a>";
		return outPut;
	}else{
		return "";	
	}
}
Pager.prototype._getPagesLinks = function(){
	pages = parseInt(this._totalPageNum);
	start = 1;
	for(i=1;i<=parseInt(this._totalPageNum);i+=this._linkPerPage){
		if(this._currentPage>=i){	
			start = i;
		}
	}
	
	end  = start + this._linkPerPage - 1;
	if(end > pages)
		end = pages;
	var numbers='';
	
	if(typeof this._prevMoreLink!='undefined'&&start>1){
		pos = start - 1;
		numbers+= "<a href='"+this.getUrl(pos) + "' class=\"more\">"+this._prevMoreLink+"</a>";
	}
	
	for(i=start;i<=end;i++){
		if(this._currentPage==i)
			numbers+="<span class=\"current\">"+i+"</span>";
		else{
			numbers+= "<a href='"+this.getUrl(i) + "' class=\"more\">"+i+"</a>";
		}
	}
	
	
	if(typeof this._nextMoreLink!='undefined' && end<pages){
		numbers+= "<a href='"+this.getUrl(i) + "' class=\"more\">"+this._nextMoreLink+"</a>";
	}
	
	return numbers;
}
Pager.prototype.setPageHeader = function(str){
	this._pageHeader = str;
}
Pager.prototype.render = function(){
	var outPutBuffer ='';
	//outPutBuffer+= this._getTotalPageString();
	//outPutBuffer+= "<div class=\"PagerDivNav\">" + this._totalPageNum;
	
	outPutBuffer+= "&nbsp;"+this._pageHeader;
	outPutBuffer+= "&nbsp;<span class='total'><span class='current'>"+this._currentPage+'</span>/'+this._totalPageNum+",</span>";
	outPutBuffer+= "<span class='totalrecords'>"+this._totalRecordsNum+'</span>';
	bolAnchor = true;
	if(this._currentPage!=1 && this._totalPageNum > 1){
		bolAnchor = true;
	}else{
		bolAnchor = false;
	}
	outPutBuffer += this._getFirstPageHtml(bolAnchor);
	
	outPutBuffer += this._getPrevPageHtml(bolAnchor);
	if(this._showPageLink){
		outPutBuffer += this._getPagesLinks();
	}
	if(this._currentPage!=this._totalPageNum && this._totalPageNum > 1)
		bolAnchor = true;
	else
		bolAnchor = false;
	
	outPutBuffer += this._getNextPageHtml(bolAnchor);
	outPutBuffer += this._getLastPageHtml(bolAnchor);
	if(this._totalRecordsNum==0)
		outPutBuffer = '';
	//document.write(outPutBuffer);
	
	return outPutBuffer;
}
Pager.prototype.setUrl=function(url){
	this._pageLinkUrl = url;
}
Pager.prototype.getUrl=function(page){
	return this._pageLinkUrl.replace(/@@page@@/,page);
}
Pager.prototype.loadPage=function(id){
	s = this.render();
	document.getElementById(id).innerHTML =s;
}