<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@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>
    <title>Slide Show</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="stylesheet" href="images/styleslideshow.css" type="text/css">
    <script type="text/javascript" src="js/jquery.nivo.slider.pack.js"></script>
    <script type="text/javascript">
    $(window).load(function() {
        $('#slider').nivoSlider({});
    });
    </script>
</head>
<body>
<% if (sanpham.size() == 0){ %><div align="Center"><b>Chưa Đủ Sản Phẩm Để Hiển Thị</b></div><%} else { %>
<% if (records==0){ %> Chưa có sản phẩm <% } else { %>



 <div id="wrapper">
        <div id="slider-wrapper">
            <div id="slider" class="nivoSlider">
<% for(int i  = sanpham.size() - 1; i >= 0; i--) {  %>

     <a href="ProductId?id=<%= sanpham.get(i).getId()%>"><img border="0" src="<%= sanpham.get(i).getImage() %>"  title="#1<%= sanpham.get(i).getId() %>" ></a>
<% } %>
            </div>
            <% for(int i  = sanpham.size() - 1; i >= 0; i--) {  %>
          <div id="1<%= sanpham.get(i).getId() %>" class="nivo-html-caption">
                <b><%= sanpham.get(i).getName() %></b><br>Giá: <%= Math.round(sanpham.get(i).getPrice()) %> đ
            </div>
        <% } %>
        </div>

    </div>
   <% }} %>
</body>
</html>