<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

    <%@page import="model.ThongTinSanPham"%>
    <%@page import="java.util.List"%>
    <%@page import="model.ConnectDb"%>
<%@page import="model.SanPham"%>
<% 
List<ThongTinSanPham> product = (List<ThongTinSanPham>) request.getAttribute("sanpham");
if(product==null) { %><% } else { 
int TrangHienTai = Integer.parseInt(request.getParameter("page"));
String category = (String)request.getParameter("category");
int TongSoTrang = (Integer)request.getAttribute("recordbycategory");
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel=stylesheet href='highslide/highslide.css' type=text/css>
<script type="text/javascript" src="highslide/highslide.js"></script>
<title>Danh Sach San Pham Theo Loai</title>
<script type="text/javascript">
//<![CDATA[
hs.registerOverlay({
	html: '<div class="closebutton" onclick="return hs.close(this)" title="Close"></div>',
	position: 'top right',
	fade: 2 // fading the semi-transparent overlay looks bad in IE
});


hs.graphicsDir = 'highslide/graphics/';
hs.wrapperClassName = 'borderless';
//]]>
document.getElementById("titleProduct").innerHTML = "Sản Phẩm Theo Loại";
</script>
</head>
<body>
<% if (product.size() < 1){ %><div align="Center" style="border:1px solid #cfcfcf;padding:20px 10px 20px 10px;background-color:#f3f3f3; width:320px ">Chưa Có Sản Phẩm Trong Danh Mục Này </div><p><br><br><%} else { %>
<br>
<Center>
<table border="0" cellpadding="1" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1" height="234">

<tr>

   <td width="100%" height="230">

   <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="28%"  height="100%" id="AutoNumber2">

<tr>
            <% int k = 0; for(int i  = product.size()-1; i >=0 ; i--) { k++;
            %>
            <td width="10%">&nbsp;</td>
            
            <td width="81%"  >
            
<div class="img">
    <a href="<%= product.get(i).getImage() %>" class="highslide" onclick="return hs.expand(this)"> <img src="<%= product.get(i).getImage() %>" width="135" height="141" title="<%= product.get(i).getName() %>"></a>
<div class="desc">   <b><%= product.get(i).getName() %><Br>Giá</b>: <font color="red"><u><%= Math.round(product.get(i).getPrice())%></u></font> vnđ</div><br>
<a href="Cart?rep=buy&qtt=1&id=<%= product.get(i).getId()%>"><img style="border:0;" src="images/cart.gif" width="60" height="17"></a>&nbsp;&nbsp;<a href="ProductId?id=<%= product.get(i).getId()%>"><img style="border:0;" src="images/detail.gif" width="60" height="17"></a>
  </div>
           
            <p> &nbsp;</td>
            <td width="40%" >&nbsp;</td>
              <% if (k % 3==0){ %>
       <Tr>
        <%} }%>
          
          </table>
         
        </td>
      </tr>
     </table>
<B>Trang</B> <% for (int t = 1; t <= TongSoTrang; t++){%>
       <a href="ProductByCategory?category=<%= category %>&page=<%= t %>"><% if(TrangHienTai==t){ %></a><span style="background:pink; border:2px groove pink; font-size: 13px"><% } %> <%= t %></span>
       <%}}}%> 
<br>
</Center>
<br>
</body></html>