<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="java.util.List"%>
<%@page import="model.ConnectDb"%>
<%@page import="model.SanPham"%>
<%@page import="model.ThongTinSanPham"%>
<% 

int records = new SanPham().recordsnumber();
List<ThongTinSanPham> sanpham = null;

if (records < 9 && records >= 0){
	sanpham = new SanPham().getAll(9,0);} else {
	sanpham = new SanPham().getAll(9,records-9); }
%>
<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</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 Mới Nhất";
</script>
</head>
<body>
<% if (records==0){ %><B>Chưa Có Sản Phẩm</B> <% } else { %>
<br><p>
<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  = sanpham.size() - 1; i >= 0; i--) { k++; %>
       <td width="10%">&nbsp;</td>      
       <td width="81%"  >
       <div class="img">
    <a href="<%= sanpham.get(i).getImage() %>" class="highslide" onclick="return hs.expand(this)"> <img src="<%= sanpham.get(i).getImage() %>" width="135" height="141" title="<%= sanpham.get(i).getName() %>"></a>
<div class="desc">   <b><%= sanpham.get(i).getName() %><Br>Giá</b>: <font color="red"><u><%= Math.round(sanpham.get(i).getPrice()) %></u></font> vnđ</div><br>
<a href="Cart?rep=buy&qtt=1&id=<%= sanpham.get(i).getId()%>"><img style="border:0;" src="images/cart.gif" width="60" height="17"></a>&nbsp;&nbsp;<a href="ProductId?id=<%= sanpham.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>
       <%}%> 
       </Center>
</body>
</html>