<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
     <%@page import="java.util.List"%>
    <%@page import="model.CommentInfo"%>
    <%@page import="model.Emoticon"%>
<%
List<CommentInfo> cminfo = (List<CommentInfo>) request.getAttribute("cminfo");
String id = request.getParameter("id");
	int TrangHienTai = Integer.parseInt(request.getParameter("cmpage"));
	int TongSoTrang = (Integer)request.getAttribute("cmrecord");
	String usercm = (String) session.getAttribute("user") ;
%>    
<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 type="text/javascript" src="js/PostComment.js"></script>
<title>Comment</title>
<style>

.comment_ui
{
background-color: #F5F5FF; border-bottom:1px ;clear:left;float:none;
overflow:hidden;margin-bottom:2px;padding:6px 4px 3px 6px;width:410px;
scrollbar-base-color: #FFFFFF;
scrollbar-arrow-color: #FFFFFF;
scrollbar-shadow-color: #C0C0C0;
scrollbar-darkshadow-color: #FFFFFF;
scrollbar-3dlight-color: #FFFFFF; 
}
</style>
<script>
function showsubmit(){
var a = document.getElementById("user");

a.innerHTML= "<input class='submit' type='submit' id='showcme' value='Gửi'/> ";
document.getElementById("emotion").style.display="block";

}
function hidesubmit(){
var a = document.getElementById("user");
document.getElementById("emotion").style.display="none";
a.innerHTML= "";
}
function checklogincm(){
	var usercm = document.getElementById("checkloginc").value;
	if (usercm == "null") { alert("Bạn Chưa Đăng Nhập Khách Hàng !"); return false;}
	else {return true;}
	}
	
	
</script>
</head>
<body>
<div align="center" id="emotion" class="comment_ui" style="display: none">
<img style="cursor: pointer;" onmousedown="if (formcm.content.value=='Viết bình luận...'){formcm.content.value=formcm.content.value;} else{formcm.content.value=formcm.content.value+' :-bd';}" border="0" src="img/113.gif"></img>
<img style="cursor: pointer;" onmousedown="if (formcm.content.value=='Viết bình luận...'){formcm.content.value=formcm.content.value;} else{formcm.content.value=formcm.content.value+' =P~';}" border="0" src="img/38.gif"></img>
<img style="cursor: pointer;" onmousedown="if (formcm.content.value=='Viết bình luận...'){formcm.content.value=formcm.content.value;} else{formcm.content.value=formcm.content.value+' =D>';}" border="0" src="img/41.gif"></img>
<img style="cursor: pointer;" onmousedown="if (formcm.content.value=='Viết bình luận...'){formcm.content.value=formcm.content.value;} else{formcm.content.value=formcm.content.value+' :X';}" border="0" src="img/8.gif"></img>
<img style="cursor: pointer;" onmousedown="if (formcm.content.value=='Viết bình luận...'){formcm.content.value=formcm.content.value;} else{formcm.content.value=formcm.content.value+' X>';}" border="0" src="img/14.gif"></img>
<img style="cursor: pointer;" onmousedown="if (formcm.content.value=='Viết bình luận...'){formcm.content.value=formcm.content.value;} else{formcm.content.value=formcm.content.value+' :-q';}" border="0" src="img/112.gif"></img>
<img style="cursor: pointer;" onmousedown="if (formcm.content.value=='Viết bình luận...'){formcm.content.value=formcm.content.value;} else{formcm.content.value=formcm.content.value+' X_X';}" border="0" src="img/109.gif"></img>
<img style="cursor: pointer;" onmousedown="if (formcm.content.value=='Viết bình luận...'){formcm.content.value=formcm.content.value;} else{formcm.content.value=formcm.content.value+' :D';}" border="0" src="img/4.gif"></img>
<img style="cursor: pointer;" onmousedown="if (formcm.content.value=='Viết bình luận...'){formcm.content.value=formcm.content.value;} else{formcm.content.value=formcm.content.value+' :>>';}" border="0" src="img/21.gif"></img>
<img style="cursor: pointer;" onmousedown="if (formcm.content.value=='Viết bình luận...'){formcm.content.value=formcm.content.value;} else{formcm.content.value=formcm.content.value+' :]>';}" border="0" src="img/100.gif"></img>
<img style="cursor: pointer;" onmousedown="if (formcm.content.value=='Viết bình luận...'){formcm.content.value=formcm.content.value;} else{formcm.content.value=formcm.content.value+' :-c';}" border="0" src="img/101.gif"></img>
</div>

<form name="formcm" method="post" action="Comment" onsubmit="return ajaxlog();">
<input type="hidden" value="<%= usercm %>" id="checkloginc"/>
<input type="hidden" name="rep" value="post"/>
<input type="hidden" name="idpd" value="<%= id %>"/>
<div align="left" class="comment_ui">
<textarea class="UniXT" name="content"  style="color: #828282"
onfocus="if (this.value == 'Viết bình luận...'){this.value=''; this.cols='76'; this.rows='5'; this.style.color='Black';} return showsubmit();" 
onblur="if (this.value == '') {this.value='Viết bình luận...'; this.cols='76'; this.rows='1'; this.style.color='#828282'; return hidesubmit();} "
cols="76" rows="1">Viết bình luận...</textarea><br>
<span id="user"></span></div>
</form><br>
<% if (TongSoTrang <1){ %>
<div align="left" class="comment_ui"> <i><font color="#828282">Chưa có bình luận nào !</font></i></div>
<%} %>
<%for(int i  = cminfo.size()-1; i >=0 ; i--) { %>
<div align="left" class="comment_ui"> <i><font color="#828282">(<%= cminfo.get(i).getDate() %>) </font></i><b>&nbsp;<%= cminfo.get(i).getUser() %>:</b> <%= new Emoticon().EmoticonRe(cminfo.get(i).getContent()) %></div>
<%} %>
<% if (TongSoTrang >0){ %><Br>
<center>
<B>Trang</B> <% for (int t = 1; t <= TongSoTrang; t++){%>
       <a href="ProductId?id=<%= id %>&cmpage=<%= t %>"><% if(TrangHienTai==t){ %></a><span style="background: #F5F5FF; border:0px ; font-size: 14px"><% } %> <%= t %></span><%} %>
       </center>
       <%} %>
       
</body>
</html>