<%@ 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"%>
<% 
ThongTinSanPham product = (ThongTinSanPham) request.getAttribute("sanpham");
if (product ==null){
%><% }else { %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel=stylesheet href='images/style.css' type=text/css>
<link rel="stylesheet" type="text/css" href="images/AjaxForm.css" />
<script src="js/qtt.js"> type="text/javascript" </script>
<script src="js/SharingFb.js"> type="text/javascript" </script>
<title>Danh Sach San Pham Theo ID</title>
<script>document.title="Sản Phẩm > <%= product.getName() %>";
function numberonly(event) {
	 var chCode = (event.charCode === undefined) ? event.keyCode : event.charCode;
	 if (chCode > 31 && (chCode < 48 || chCode > 57))
	 {return false;}
	 else { return true;}
	  }
	  
function BlinkSoldOut(){
	document.getElementById("blinkso").innerHTML = "Đã hết hàng";
	setTimeout("HideBlinkSO()",500);
	}

	function HideBlinkSO(){
	document.getElementById("blinkso").innerHTML = "";
	setTimeout("BlinkSoldOut()",100);
	}	  
	document.getElementById("titleProduct").innerHTML = "Chi Tiết Sản Phẩm";  
</script>
</head>
<br>
<body>
<table width="48%" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <td align="center">
<table width="441" cellpadding="0" cellspacing="0" height="450">
             
              <tr> 
                <td align="center" valign="top" height="227">
				<table width="440" border="0" cellspacing="0" cellpadding="0" height="216">
                    <tr> 
                    
                      <td width="440" align="center" valign="middle">
						<table width="440" border="0" cellpadding="0" cellspacing="0" height="148">
                          <tr> 
                            <td class="bordercart" valign="middle">
							<table width="97%" border="0" cellspacing="0" cellpadding="0" height="89">
        
                                  <tr>
                                    <td width="220" align="center" valign="bottom">
									  <img src="<%= product.getImage() %>" align="middle" width="209" height="205"><br>&nbsp;</td>
                                    <td width="70%">
									<table width="106%" border="0" cellpadding="0" cellspacing="0" height="126">
                                        <tr>
                                          <td width="90%" align="right"  colspan="2">
											<p align="center"><b><%= product.getName() %></b></td>
                                          </tr>
                                        <tr>
                                          <td width="90%" align="right"  class="detailcart" colspan="2" height="2">
											&nbsp;</td>
                                          </tr>
                                        <tr> 
                                          <td width="32%" align="right"  class="detailcart" height="27">
											<strong>
											&nbsp;Giá: &nbsp;&nbsp; </strong></td>
                                          <td width="58%"  class="detailcart" height="27"> 
                                            <%= Math.round(product.getPrice()) %> vnđ</td>
                                        </tr>
                                        <tr> 
                                          <td align="right"  class="detailcart">
											<strong>Thể loại: &nbsp;&nbsp;</strong></td>
                                          <td class="detailcart"> 
                                            <%= product.getCategory() %></td>
                                        </tr>
                                          <tr> 
                                          <td align="right"  class="detailcart">
											<strong>Trạng thái: &nbsp;&nbsp;</strong></td>
                                          <td class="detailcart"> 
                                        <% String TrangThai = product.getStatus(); if (TrangThai == null){ TrangThai = "HetHang";}                                      		
                                        		if (TrangThai.equals("ConHang")) { %><font color="green"><B>Còn hàng</B></font><% } else { %><font color="red"><B><span id="blinkso">Đã Bán Hết</span></B></font><script>BlinkSoldOut();</script><% } %>                          
                                            <input type="hidden" id="TrangThaiMonHang" value="<%= TrangThai %>"/>
                                            </td>
                                        </tr>
                                        <tr>                                         
                                         <td colspan="2" align="left"  class="detailcart" height="48">
                                        
											<strong>Số lượng</strong> <input name="qtt" id="qtt" style="text-align: center" type="text" value="1" size="1" maxlength="1" onkeypress="return numberonly(event);"> 
                                             <img style="cursor: pointer;" onclick="return validate(<%= product.getId()%>)" src="images/muahang.gif" border="0" align="middle" title="Mua Hàng">
                                                                                                                                   
                                          </td>
                                        </tr>

                                      </table></td>
                                  </tr>
                            </table></td>
                          </tr>
                        </table></td>
                    </tr>
                  </table></td>
              </tr>
               <tr valign="top"> 
                <td align="center" height="9"> 
                  
                  <table width="440" border="0" cellpadding="0" cellspacing="0" height="67">
                    <tr align="center"> 
                      <td background="images/nav_background.gif" height="20">
						<p style="padding-left:10px" align="left"><b>Chia Sẻ Sản Phẩm</b></td>
                    </tr>
					
                    <tr> 
                      <td style="padding-right:10px;padding-left:10px;" class="bordercart" height="46">					
						<br><span id ="toShowFbPosting"></span>
						<br><br><span id ="toShowFbLike"></span>
							<Script>toShowFbLike(); toShowFbPosting();</script>		
							<script src='http://static.ak.fbcdn.net/connect.php/js/FB.Share' type='text/javascript'></script>											
						</td>
                    </tr>
                  </table>                 
                </td>
              </tr>
              <tr>
                <td height="9"></td>
              </tr>
              <tr valign="top"> 
                <td align="center" height="9"> 
                  
                  <table width="440" border="0" cellpadding="0" cellspacing="0" height="67">
                    <tr align="center"> 
                      <td background="images/nav_background.gif" height="20">
						<p style="padding-left:10px" align="left"><b>Mô Tả Sản 
						Phẩm</b></td>
                    </tr>
					
                    <tr> 
                      <td style="padding-right:10px;padding-left:10px;" class="bordercart" height="46">
						<%= product.getDescription() %></td>
                    </tr>
                  </table>
                  
                </td>
              </tr>           
              <tr>
                <td height="9"></td>
              </tr>
              
              <tr valign="top"> 
                <td align="center">
				<table width="440" border="0" cellpadding="0" cellspacing="0" height="63">
				  <tr align="center"> 
                      <td background="images/nav_background.gif" height="20">
						<p style="padding-left:10px" align="left"><b>Bình Luận 
						Sản Phẩm</b></td>
                    </tr>
                    <tr> 
                      <td class="bordercart" style="padding-left:10px;">                    
                        <p>
<jsp:include page="comment.jsp"></jsp:include> 

</p>
                        
                        </td>
                    </tr>
                  </table></td>
              </tr>
              
            </table>

</td>
</tr>
</table>

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