<!--Ʒ-->
<%
dim rs,sql
dim strSort 'ѡ
dim page
dim maxPerPage 'ÿҳʾĲƷ
dim num_row 'ÿʾĲƷ
dim rows 'ʾĲƷ
imagewidth=200 'СͼĿ
imageheight=150 'Сͼĸ߶
num_row=3 'ÿзõĲƷ
rows=5 'õĲƷ
maxperpage=num_row*rows
myKeyword=Request("myKeyword")
productSort=cint(Request("productSort"))

function getSort(i) 'úȡµ࣬һϰ
	dim rs,sql
	set rs=server.createObject("adodb.recordset")
	sql="select * from productSort where fatherID="&i
	rs.open sql,conn,1,1
	do while not rs.eof 
		strSort=strSort&","&rs("id") '&rs("name")
		call getSort(rs("id"))
		rs.movenext
	loop
end function

strSort=productSort
CALL getSort(productSort) 'õڸ
'response.write strSort
'response.End
page=Request("page")
if (page="" or isempty(page)) then page=1
thisUrl="products.asp?productSort="&productSort&"&myKeyword="&myKeyword
session("oldUrl")=thisUrl&"&page="&page
set rs=server.createobject("adodb.recordset")
sql="select * from product where 1=1"
if not (myKeyword="" or isempty(myKeyword) ) then
	sql=sql&" and name like '%"&myKeyword&"%'"
end if
if productSort>0 then
	sql=sql&" and productSort in ("&strSort&")"
end if
sql=sql&" order by id desc"
'response.write sql
'response.End
rs.open sql,conn,1,1
rs.pagesize=MaxPerPage
%>
<!--Ʒ-->




<!--Ʒչʾҳʼ--><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td><!--Ʒѭʼ--><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <%
			j=1
			if not (rs.eof or err) then rs.move (page-1)*maxPerPage
			do while not (rs.eof or err)
				if (j mod num_row)=1 then
%><tr><td colspan="<%=(num_row*2-1)%>">
      <TABLE align=center background="images/global.gif" border=0 cellPadding=0 cellSpacing=0 width="100%">
        <TBODY>
        <TR>
                <TD><IMG height=1 src="images/spacer.gif" width=1></TD>
              </TR></TBODY></TABLE>
	</td></tr>
<%				
					response.write "<tr>"
				end if
%>
          <td width="<%=(100/num_row)%>%" align=center>
            <table width="98%" border="0" cellspacing="0" cellpadding="5" align="center">
              <tr>
                <td><table width="220" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><img src="images/p1.gif" width="220" height="10" /></td>
  </tr>
  <tr>
    <td background="images/p2.gif"><div align="center"><a href="productShow.asp?id=<%=rs("id")%>" title="<%=rs("name")%>" alt="<%=rs("name")%>"><img src="<%
		if rs("smallImg")="nothing" then
			response.write "images/noSmallImg.gif"
		else
			response.write "smallImg/"&rs("smallImg")
		end if
%>" width=<%=(imagewidth)%> border=0 height="<%=(imageheight)%>" /></a></div></td>
  </tr>
  <tr>
    <td><img src="images/p3.gif" width="220" height="11" /></td>
  </tr>
</table></td>
                </tr>
              <tr>
                <td><div align="center"><a href="productShow.asp?id=<%=rs("id")%>" title="<%=rs("name")%>" alt="<%=rs("name")%>"><%=rs("name")%></a></div></td>
              </tr>
</table>            </td>
<%
				if (j mod num_row)=0 then
					response.write "</tr>" 
				else %>
				<TD background="images/point.gif" width=1><IMG 
            height=1 src="images/spacer.gif" width=1></TD>				
<%
				end if
				j=j+1
				if j>maxperpage then exit do
				rs.moveNext
			loop
			dim k
			k=(j-1) mod num_row
'			response.write j
'			response.write "k="&k
			if not (k=0) then
				response.write "<td colspan="&(num_row-k)&" width="&(cint(100/num_row)*(num_row-k))&">&nbsp;</td>"
				response.write "</tr>"
			end if
%>
<tr><td colspan="<%=(num_row*2-1)%>">
      <TABLE align=center background="images/global.gif" border=0 cellPadding=0 cellSpacing=0 width="100%">
        <TBODY>
        <TR>
                <TD><IMG height=1 src="images/spacer.gif" width=1></TD>
              </TR></TBODY></TABLE>
	</td></tr>
       </table><!--Ʒѭ--></td>
          </tr>
          <tr>
            <td height="10"><hr WIDTH=95% style="border:1px dashed #CCCCCC; height:1px"></td>
          </tr>
          <tr>
            <td><table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td><!--ҳ-->
                  <div align="center">
<div align="center"> <%=rs.pageCount%> ҳ <%=rs.recordCount%> ݡǰ<%=page%>/<%=rs.pageCount%> 
         ҳ
         <%if page>1 then%>
         <a href="<%=thisUrl%>">ҳ</a> | <a href="<%=thisUrl%>&page=<%=page-1%>">һҳ</a> |
         <%else%>
         <font color="#999999">ҳ | һҳ |</font>
         <%end if
if rs.recordCount>page*maxPerPage then%>
         <a href="<%=thisUrl%>&page=<%=page+1%>">һҳ</a> | <a href="<%=thisUrl%>&page=<%=rs.pageCount%>">βҳ</a>
         <%else%>
         <font color="#999999">һҳ | βҳ</font>
         
         <%end if%>
       </div>
                  </div>
                  <!--ҳ--></td>
              </tr>
            </table></td>
          </tr>
        </table><!--Ʒչʾҳ-->	




<%
rs.close
set rs=nothing
 %>