
//'-------------------------------------------------------------------------------------------------------------------------
//'例如：PageList(1,3,10,123,"acton=12",1)
//'页次：1/13页　每页：10篇 共：123篇 [1][2][3]...[13] 
//'页次：当前第currentpag页，n 分隔数量；每页显示记录数:MaxRows,总记录数：CountNum,v为显示类型
//'-------------------------------------------------------------------------------------------------------------------------
function PageList(CurrentPage,n,MaxRows,CountNum,ClickPage)
{
	var PageStr="";
	CountNum=parseInt(CountNum);
	CurrentPage=parseInt(CurrentPage);
	if (CountNum%MaxRows==0){var Pagecount= parseInt(CountNum / MaxRows);}else{var Pagecount = parseInt(CountNum / MaxRows)+1}
	if (Pagecount>CurrentPage+n){var Endpage=CurrentPage+n;}else{var Endpage=Pagecount;}
	var ShowPage;
		ShowPage="<div class='Showpage'><tt>";
		PageStr = SeachPage(CurrentPage,n,MaxRows,Endpage,Pagecount,ClickPage)
		ShowPage+="页次：<b><font color=red>"+CurrentPage+"<\/font><\/b>/<b>"+Pagecount+"</b>页";
		ShowPage+="　每页：显示<b>"+MaxRows+"<\/b>条　共：<b>"+CountNum+"<\/b>条记录　<\/tt>";
		ShowPage+=PageStr;
		ShowPage+="</div>";
	return ShowPage;

}


function SeachPage(CurrentPage,n,MaxRows,Endpage,Pagecount,ClickPage) {
var PageStr="";
		var p;
		if ((CurrentPage-1)%n==0) 
		{
			p=(CurrentPage-1) /n
		}
		else
		{
			p=(((CurrentPage-1)-(CurrentPage-1)%n)/n)
		}
		if (CurrentPage!=1)
		{
			PageStr += "<tt id='showimg'><a href=\"javascript:"+ClickPage+"(1)\" title=\"首页\"><img src=\"/images/pagelist/First.gif\" border=\"0\" alt=\"第一页\"><\/a><\/tt>";
		}

		if (p*n > 0)
		{
			PageStr += "<tt id='showimg'><a href=\"javascript:"+ClickPage+"("+p*n+")\" title=\"上十页\"><img src=\"/images/pagelist/Previous.gif\" border=\"0\"><\/a><\/tt>";
		}
		PageStr += "<tt>";
		for (var i=p*n+1;i<p*n+n+1;i++)
		{
			if (i==CurrentPage)
			{
				PageStr += " <font color=\"red\">["+i+"]<\/font> ";
			}
			else
			{
				PageStr += " <a href=\"javascript:"+ClickPage+"("+i+")\">"+i+"<\/a> ";
			}
			if (i==Pagecount) break;
		}
		PageStr += "<\/tt>";
		if (i<Pagecount)
		{
			PageStr += "<tt id='showimg'><a href=\"javascript:"+ClickPage+"("+i+")\" title=\"下十页\"><img src=\"/images/pagelist/Next.gif\" border=\"0\"><\/a><\/tt>";
		}
		if (CurrentPage!=Pagecount)
		{
			PageStr += "<tt id='showimg'><a href=\"javascript:"+ClickPage+"("+Pagecount+")\" title=\"尾页\"><img src=\"/images/pagelist/Last.gif\" border=\"0\"><\/a><\/tt>";
		}
	return PageStr;
}
