<%
page=request("page")
if page="" then page=1
if request.servervariables("content_length") > 0 then curPage=1 else curPage=clng(page) end if

sub page1(canshu)
rs.pagesize=canshu
totalpage=rs.pagecount
if curPage>totalpage then curPage=totalpage 
if not(rs.eof) then rs.absolutepage = curPage
end sub

sub page2(ps,canshu)
totalpage=rs.pagecount
pageStart=curPage-ps

if pageStart<=0 then
pageStart=1
pageEnd=ps*2
else
pageEnd=curPage+ps
end if

pagestart2=curPage-(ps+(ps-(totalpage-curPage)))

if pagestart2<=0 then
pageStart=1
else
if totalPage-curPage<ps then
pageStart=pagestart2
end if
end if


if pageEnd>totalPage then pageEnd=totalPage
response.write "<table border=0 cellspacing=2 cellpadding=1><tr>"

response.write "<td class=page_td>"&p_all&""& rs.recordcount &""&p_dw&"</td>"
		
if pageStart>1 and curPage>1 then
response.write "<td class=page_td><a href='?"&canshu&"page=1'>1..</a></td>"
end if
      
if curPage>1 then
response.write"<td class=page_td><a href='?"&canshu&"page="&curPage-1&"'>"&p_Previous&"</a></td>"
end if
		
for i=pageStart to pageEnd
if i<>curPage then
response.write"<td class=page_td><a href='?"&canshu&"page="&i&"'>"&i&"</a></td>"
else
response.write"<td class=page_tdbg><a href='?"&canshu&"page="&i&"'><font color=red>"&i&"</font></a></td>"
end if
next

		
if curPage<totalPage then
response.write "<td class=page_td><a href='?"&canshu&"page="&curPage+1&"'>"&p_next&"</a></td>"
end if

if pageEnd<totalPage and curPage<totalPage  then
response.write"<td class=page_td><a href='?"&canshu&"page="&rs.pagecount&"'>.."&totalpage&"</a></td>"
end if

response.write"<form action=?"&canshu&">"
response.write"<td class=page_td><input name=page type=text value="&page&" class=inputpage /></td>"
response.write"</form>"

response.write "</tr></table>"
end sub
%>