<%@ Page Language="C#" AutoEventWireup="true" CodeFile="comment.aspx.cs" Inherits="comment" %>

<%@ Register Src="controls/FormPaging_Rep.ascx" TagName="FormPaging_Rep" TagPrefix="uc2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
  
    <link href="/templates/default/images/style.css" rel=Stylesheet type="text/css" />
    <script language=javascript src="js/ajax.js"></script>
    <script language=javascript>
    //提交新评论
   function SaveComment()
   {
        if(Return_sumbit())
        {
            var docid=document.getElementById("Hiddendocid").value;
            var user= document.getElementById("username").value;
             var cont=document.getElementById("comment_cont").value;
            // var docid=document.getElementById("docid").value;
             PostPage("type=0&username="+user+"&content="+cont+"&docid="+docid,"/comment.aspx");
            alert(GetValue());
            window.location.href="/comment.aspx?docid="+docid;
         }
         else
         {
            return false;
         }
    }
    //提交支持或者反对
    function SaveSa(comid,sa)
    {
        PostPage("comid="+comid+"&sa="+sa,"/comment.aspx");
        if(sa=="s")
        {
            document.getElementById("support"+comid).innerHTML="("+GetValue()+")";
        }
        else
        {
            document.getElementById("against"+comid).innerHTML="("+GetValue()+")";
        }
    }
    //引用其他用户的留言
    function yinyong(comid)
    {
        //为了方便把用户名 内容 分开来
        var cont="!------------引用自[网友:";
        cont=cont+document.getElementById("username_"+comid).innerHTML;
        cont=cont+"]的评论[";
        cont=cont+document.getElementById("content_"+comid).innerHTML+"]";
        cont=cont+"------------!";
        document.getElementById("comment_cont").value=cont;
        
    }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <input id="Hiddendocid" type="hidden" runat=server />
    
    <div>
<div id="navsub">
<div class="l"></div>
<div class="r"></div>
<div class="m">
<div align=center><span class="tt" style="width:6em"><strong>话题:<asp:HyperLink ID="cont_title" runat="server">HyperLink</asp:HyperLink></strong></span></div>
</div>
</div>

<table id="middle" width="100%" cellspacing="0" cellpadding="0" style="table-layout:fixed">
<tr><td valign="top">
	<div class="mframe mR">
	<div class="tl"></div>
	<div class="tr"></div>
	<div class="tm">
		<span class="tt" style="width:6em"><strong>评论列表</strong></span>
	</div>
	<div class="wrapper">
	<div class="ml"></div>
	<div class="mr"></div>
	<div class="mm">
        <asp:Repeater ID="Rep_Comment" runat="server">
        <ItemTemplate>
        <div class="reCont" id="reContainer">
				
					<div class="reHead">		
					<div class="reLayer">第 <%#Eval("lou") %> 楼</div>
					
					<span class="reName" id="username_<%#Eval("comid") %>"><%#Eval("username") %></span> 
					发表于
					<span class="reDate"><%#Eval("writetime") %></span>
					</div>
					<div class="reBody" id="content_<%#Eval("comid") %>">
					<%#Eval("content") %>
					</div>
          
					<div class="reFun"><a href="#" onclick="yinyong(<%#Eval("comid") %>)">引用</a> <a href="###" onclick="SaveSa('<%#Eval("comid") %>','s')">支持</a><span id="support<%#Eval("comid") %>"> (<%#Eval("support") %>)</span> <a href="###" onclick="SaveSa('<%#Eval("comid") %>','a')">反对</a><span id="against<%#Eval("comid") %>"> (<%#Eval("against") %>)</span></div>
				
		</div>	
			</ItemTemplate>
        </asp:Repeater>
		
		
<div class="pager"> <uc2:FormPaging_Rep ID="FormPaging_Rep1" runat="server" /></div>

	</div>
	</div>
	<div class="bl"></div>
	<div class="br"></div>
	<div class="bm"></div>
	</div>

</td></tr>
</table>
      <table style="width: 1024px;">
            <tr>
                <td>
                   <table width="100%">
        <tr><td>用户名:</td><td><input type=text style="width:300px;" value="匿名网友" id=username />&nbsp;&nbsp;&nbsp;字符长度:<span id=bodyLen style="color:Red"></span></td></tr>
        <tr><td>内  容:</td><td><textarea style="width:500px;height:120px;" onkeyup="OnBodyLen(this)" onkeydown=OnBodyLen(this) id=comment_cont></textarea></td></tr>
        <tr><td>验证码:</td><td><input type=text id=checkcode style="width:50px;" /><span id=code><script language=javascript src="/js/Comments.js"></script></span><input type=button onclick="SaveComment()" value="提交" />
            </td></tr>
        </table>
                   
                    </td>
            </tr>
        
        </table>
    </div>
  
    </form>
</body>
</html>
