<!--#include file="include/nowshop.asp" -->
<LINK href="images/css.css" type=text/css rel=stylesheet>
<LINK href="images/newhead.css" type=text/css rel=stylesheet>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<%
	  Set rsprod=Server.CreateObject("ADODB.RecordSet") 
rsprod.open sqlprod,conn,1,1
n=0
if rsprod.bof and rsprod.eof then
		  response.write "<center><br><font color=red>对不起，暂无新品！</font>"
		  'response.End
		  else
		  %>
<%
	  		rsprod.PageSize =20 '每页记录条数
			iCount=rsprod.RecordCount '记录总数
			iPageSize=rsprod.PageSize
    		maxpage=rsprod.PageCount 
    		page=request("page")
    
    if Not IsNumeric(page) or page="" then
        page=1
    else
        page=cint(page)
    end if
    
    if page<1 then
        page=1
    elseif  page>maxpage then
        page=maxpage
    end if
    
    rsprod.AbsolutePage=Page

	if page=maxpage then
		x=iCount-(maxpage-1)*iPageSize
	else
		x=iPageSize
	end if
	
			For i=1 To x
		%>
<br>
<TABLE cellSpacing=0 cellPadding=0 width=584 border=0>
  <TBODY>
    <TR> 
      <TD width=9><IMG height=23 src="images/search_left.gif" 
            width=9></TD>
      <TD background=images/search_bg.gif><font color="#FF0000">目前位置：<a href=main.asp><font color="#FF0000">首页</font></a> 
        > <% if sublar<>"" then%> <a href='class.asp?LarCode=<%=server.URLEncode(sublar)%>'><font color="#FF0000"><%=sublar%></font></a> <%if submid<>"" then%> > <a href="class.asp?LarCode=<%=server.URLEncode(sublar)%>&MidCode=<%=server.URLEncode(submid)%>"><font color="#FF0000"><%=submid%></font></a> <%
end if
else
response.write title
end if
%> </font></TD>
      <TD width=18 background=images/search_bg.gif>&nbsp;</TD>
      <TD width=11><IMG height=23 src="images/search_right.gif" 
            width=9></TD>
    </TR>
  </TBODY>
</TABLE>
<%
		call PageControl(iCount,maxpage,page,"border=0 align=center","<p align=center>")
%>
<table width="584" valign="top"   border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td> <!--#include file="fenleichanpin.asp"--></td>
          </tr>
        </table>
<%rsprod.movenext
		next
		call PageControl(iCount,maxpage,page,"border=0 align=center","<p align=center>")
		end if
		rsprod.close
		set rsprod=nothing
Sub PageControl(iCount,pagecount,page,table_style,font_style)
'生成上一页下一页链接
    Dim query, a, x, temp
    action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")

    query = Split(Request.ServerVariables("QUERY_STRING"), "&")
    For Each x In query
        a = Split(x, "=")
        If StrComp(a(0), "page", vbTextCompare) <> 0 Then
            temp = temp & a(0) & "=" & a(1) & "&"
        End If
    Next

    Response.Write("<table  width=584" & Table_style & ">" & vbCrLf )        
    Response.Write("<form method=get onsubmit=""document.location = '" & action & "?" & temp & "Page='+ this.page.value;return false;""><TR>" & vbCrLf )
    Response.Write("<TD align=left width=250>" & vbCrLf )
    Response.Write(font_style & vbCrLf ) 
	
    Response.Write ("<IMG height=16 src=images/search_dot_01.gif width=14> " & vbCrLf) 
	Response.Write ("&nbsp;&nbsp;&nbsp;&nbsp;" & vbCrLf)        
    Response.Write(" 共有" & iCount & "种商品" &  vbCrLf)
	Response.Write ("&nbsp;&nbsp;&nbsp;&nbsp;" & vbCrLf)        
    Response.Write(" 页次：" & page & "/" & pageCount & "页" &  vbCrLf)
    Response.Write("</TD>" & vbCrLf )
    Response.Write("<TD align=right width=334>" & vbCrLf )


    if page<=1 then
        Response.Write ("首页 " & vbCrLf)        
        Response.Write ("上页 " & vbCrLf)
    else       
        Response.Write("<A HREF=" & action & "?" & temp & "Page=1>首页</A> " & vbCrLf)
        Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page-1) & ">上页</A> " & vbCrLf)
    end if

    if page>=pagecount then
        Response.Write ("下页 " & vbCrLf)
        Response.Write ("末页 " & vbCrLf)            
    else
        Response.Write("<A HREF=" & action & "?" & temp & "Page=" & (Page+1) & ">下页</A> " & vbCrLf)
        Response.Write("<A HREF=" & action & "?" & temp & "Page=" & pagecount & ">末页</A> " & vbCrLf)            
    end if

    Response.Write(" 转到" & "<INPUT TYEP=TEXT NAME=page SIZE=1 Maxlength=5 VALUE=" & page & ">" & "页"  & vbCrLf & "<INPUT type=image src=images/go.gif style=""font-size: 9pt"" value=GO>")
    Response.Write("</TD>" & vbCrLf )                
    Response.Write("</TR></form>" & vbCrLf )        
    Response.Write("</table>" & vbCrLf )        
End Sub
%>
