//*********************************
//      VTBBS JSFun
// Copyright 2004-2008 VTbbs.com
// Function Edit by xiaotong
//*********************************

//'CurrentPage=当前页,n=一次最多显示几个页码,MaxRows=每页记录数,CountNum=总记录数,PageSearch=链接参数
function PageList(CurrentPage,n,MaxRows,CountNum,PageSearch)
{
	var PageStr="";
	if (PageSearch.length>0){
		PageSearch+="&";
	}
	else{
		PageSearch+="?";
	}
	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;
	var p;
		if ((CurrentPage-1)%n==0) 
		{
			p=(CurrentPage-1) /n
		}
		else
		{
			p=(((CurrentPage-1)-(CurrentPage-1)%n)/n)
		}
		if (CurrentPage>=1)
		{			
			PageStr+="<td class=bg1><a href=\""+PageSearch+"topage=1\" title=\"第一页\">首页<\/a><\/td>";
			if (CurrentPage<=1){
				PageStr +="<td class=bg1><a href=\""+PageSearch+"topage=1\" title=\"上页\">上页<\/a><\/td>";
			}
			else{
				PageStr +="<td class=bg1><a href=\""+PageSearch+"topage="+(CurrentPage-1)+"\" title=\"上页\">上页<\/a><\/td>";
			}
		}
		if (CurrentPage<=Pagecount)
		{
			if (CurrentPage>=Pagecount){
				PageStr +="<td class=bg1><a href=\""+PageSearch+"topage="+Pagecount+"\" title=\"下页\">下页<\/a><\/td>";
			}else{
				PageStr +="<td class=bg1><a href=\""+PageSearch+"topage="+(CurrentPage+1)+"\" title=\"下页\">下页<\/a><\/td>";
			}
			PageStr +="<td class=bg1><a href=\""+PageSearch+"topage="+Pagecount+"\" title=\"末页\">末页<\/a><\/td>";
		}
	// CountNum 处理
	if (CountNum==2000){
		CountNum=84780
	}

	ShowPage="<table cellpadding=0 cellspacing=1 class=tabcss>";
	ShowPage=ShowPage+"<FORM action=\""+PageSearch+"\" method=\"post\" name=\"PageForm\"><tr align=center>";
	ShowPage=ShowPage+"<td title=\"总数\" class=bg1>共<font color=#000000> "+CountNum+" </font>条</td>";
	ShowPage=ShowPage+"<td title=\"每页\" class=bg1><font color=#000000> "+MaxRows+" </font>条</td>";
	ShowPage=ShowPage+"<td title=\"分页\" class=bg1>第<font color=#000000> "+CurrentPage+"/"+Pagecount+" </font>页</td>";
	ShowPage=ShowPage+PageStr;
	ShowPage=ShowPage+"<td class=bg1>";
/*
	ShowPage=ShowPage+"<select name=topage onchange=\"document.PageForm.submit();\">";
	for (var i=1;i<=Pagecount;i++){
		ShowPage=ShowPage+"<option value="+i+"";
		if (i==CurrentPage){
			ShowPage=ShowPage+" selected";
		}
		ShowPage=ShowPage+">第"+i+"页</option>";
	}
	ShowPage=ShowPage+"</select>";
*/
//	ShowPage=ShowPage+"<input type=text name=topage size=3 value=\""+CurrentPage+"\" style=\"padding:0;border:1px solid #dddddd;\"><input type=submit value=\"GO\" name=submit>";
	ShowPage=ShowPage+"</td>";
	ShowPage=ShowPage+"</tr></FORM></table>";
	document.write (ShowPage);
}

