﻿//*************** 分页函数 ***************
// Copyright (C)2007 CUTE.HK
// Powered by DengJianCheng | XSTYLE.CN
// Update: 2007-07-30
//
// rsCount		总记录数
// pageSize		每页显示的数
// pageCount	总页数
// pageNo		当前页码
// strParam		参数字符串
//****************************************

function ShowListPager(rsCount,pageSize,pageCount,pageNo,strParam)
{
	with(document)
	{
		write("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr style=\"padding:5px\"><td>");
		write("有 " + rsCount + " 条记录，共 " + pageCount + " 页");
		write("</td><td align=\"right\"><div class=\"paginator\">");
		write("<form style=\"margin:0px; padding:0px;\" onsubmit=\"location.replace('?" + strParam + "' + this.PageNumber.value);return false;\">");
		var intSeed = 5;
		var intFrom = pageNo - intSeed;
		if(intFrom < 1)intFrom = 1;
		var intTo = intFrom + intSeed*2;
		if(intTo > pageCount)
		{
			intTo = pageCount;
			if(pageCount > intSeed*2)
				intFrom = intTo - intSeed*2;
			else
				intFrom = 1;
		}
		//write("分页：&nbsp; ");
		write("页次：" + pageNo + "/" + pageCount + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
		if(pageNo>1){
			var PrevPageNo = pageNo - 1;
			write("<a href=\"?" + strParam + PrevPageNo + "\" style=\"border:none;background:none\"><img src=\"/img/btn_previouspage.gif\" width=\"17\" height=\"17\" border=\"0\" align=\"absbottom\" alt=\"上一页\" /></a>");
		}
		if(intFrom>1){
			write("<a href=\"?" + strParam + "1\">1</a> ... ");
		}
		for(var i = intFrom; i <= intTo; i++)
		{
			if(i == pageNo)
				write("<span class=\"this-page\">" + i +"</span>");
			else
				write("<a href=\"?" + strParam + i + "\">" + i + "</a>");
		}
		if(intTo < pageCount){
			write(" ... <a href=\"?" + strParam + pageCount + "\">" + pageCount + "</a>");
		}
		if(pageCount>pageNo){
			var NextPageNo = pageNo + 1;
			write("<a href=\"?" + strParam + NextPageNo + "\" style=\"border:none;background:none\"><img src=\"/img/btn_nextpage.gif\" width=\"48\" height=\"17\" border=\"0\" align=\"absbottom\" alt=\"下一页\" /></a> ");
		}
		write("&nbsp;&nbsp; 到第 <input type=\"text\" name=\"PageNumber\" style=\"width:30px;text-align:center\" value=\"" + pageNo + "\" /> 页 ");
		write("<input type=\"submit\" class=\"btn\" value=\"GO\" />");
		write("</form></div></td></tr></table>");
	}
}
