<%@ Page Language="C#" AutoEventWireup="true" CodeFile="WZPingLun_S.aspx.cs" Inherits="WZPingLun_S" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<style>
body 
{
    text-align:center;
    font-size: 14.7px;
    margin:0px;
    color:#666666;
	font-family:"微软雅黑";
}
.button
{
	padding:4px 4px 2px;
	border:1px solid #4f74c0;
	background:#7595d3;
	color:#fff;
	cursor:pointer;
}
.text
{
	border:1px;
	border-color:#000000;
	border-style:solid;
	background-color:#F9F9F9;
	width:160px;
	height:18px;
}
.Mtext
{
	border:1px;
	border-color:#000000;
	border-style:solid;
	background-color:#F9F9F9;
}
#Layer1 {
	position:absolute;
	width:97px;
	height:51px;
	z-index:1;
}
a{
    font-size:14.7px;
    color:#000000;
    TEXT-DECORATION: none;
}
a:hover {
	COLOR:blue; TEXT-DECORATION: none;
}
#table2
{
    border:1px solid #EBE9ED;
}
#table2 td
{
    border-top:1px;
    border-top-color:#EBE9ED;
    border-top-style:solid;
    background-color:#F9FDFF;
    height:21px;
    vertical-align:middle;
    color:#243D88;
	font-size:9pt;
}
#table2 td a
{
    font-size:9pt;
}
table tr {
	border:none !important;
}
#GridView2 {
	border:1px solid #ece9d8
}
#GridView2 table td {
	border-bottom:1px solid #ece9d8
}
#GridView2 { color:#4963b6; }
#GridView2 a { color:#4963b6; }

/* 回复 start */
	.wyhf-btn {
		margin-left:10px;
		padding:3px 6px 2px;
		border-radius:5px;
		background:#243d88;
		color:#fff !important;
		font-size:12px;
		white-space:nowrap;
	}
	.plhf { background:#f9fdff; }
	.plhf table { background:#eee; color:#000; line-height:22px; }
	.plhf table td { padding-left:30px; text-align:left; }
	.plhf span { color:#666; }
/* 回复 end */
</style>
</head>
<script src="/ajax/domainSession.asp?format=js"></script>
<script src="js/jquery-1.4.2.min.js"></script>
<script>
function goto(url,delay)
{
    setTimeout("self.location.href='"+url+"'",delay);
}

var setParentHeight = function(){
	;(function(d){
		var htmlName = 'WZPingLun_S.aspx'.toLowerCase();
		var list;
		if( parent ){
			list = parent.document.getElementsByTagName('iframe');
			for(var i = 0, len = list.length; i < len; i++){
				if( list[i].src.toLowerCase().indexOf( htmlName ) > -1 ){
					list[i].height = Math.max(d.body.offsetHeight, d.body.scrollHeight);
				}
			}
		}			
	})(document);
};


;jQuery(function($){
	// 回复 start
	if( DOMAINSESSION.g_user_id ){
		$('#userid').val( DOMAINSESSION.g_user_id );
		$('#TextBox1').val( DOMAINSESSION.g_user_nick );
	}
	
	$('#GridView1 .plhf').each(function(){
		var t = this, $t = $(t), id = $t.attr('data-id');
		if( !id ) return;

		$.ajax({
			url: 'ajax/qrpinglun-hf.asp?act=list',
			data: {
				ran: Math.random(),
				id: id
			},
			success: function(d){
				if( !d ) return;
				$t.html( '<td colspan="12"><table align="left">'+ d +'</table><div style="clear:both;"></div></td>' );
				
				setParentHeight();
			}
		})
	})
	$('#GridView1 .wyhf-btn').click(function(){
		var t = $(this).parent().parent().next(),
			l = t.next().find('tr').length;
			
		if( DOMAINSESSION.g_user_id ){
			t.find(':input[name=username]').val( DOMAINSESSION.g_user_nick );
		}else{
			t.find(':input[name=username]').val('沙发'+ (l ? l+1 : 1));
		}

		t[ t.is(':hidden') ? 'show' : 'hide' ]();
		return false;
	})
	$('#GridView1 .wyhf-form-btn').click(function(){
		var t = this, $t = $(t), s = t.innerHTML,
			td = $t.parent(),
			id = td.find(':input[name=id]').val(),
			infoid = td.find(':input[name=infoid]').val(),
			username = td.find(':input[name=username]').val(),
			content = td.find(':input[name=content]').val();
	if( s == '我要回复' ){
		if( !username.length ){
			alert('昵称不能为空');
			return !1;
		}
		if( !content.length ){
			alert('回复不能为空');
			return !1;
		}
		t.innerHTML = '提交中...';
		$.ajax({
			type: 'post',
			url: 'ajax/qrpinglun-hf.asp?act=do',
			data: {
				ran: Math.random(),
				id: id,
				infoid: infoid,
				username: username,
				content: content
			},
			success: function(d){
				if( d == '0' ){
					alert('信息有误');
				}
				if( d == '-1' ){
					alert('回复需含中文');
				}
				t.innerHTML = '我要回复';
				if( d == '1' ){
					$t.before('<span style="color:green;">回复成功</span>').prev().delay(2000).fadeOut(function(){
						$(this).remove();
						$.ajax({
							url: 'ajax/qrpinglun-hf.asp?act=list',
							data: {
								ran: Math.random(),
								id: id
							},
							success: function(d){
								if( !d ) return;
								$('#GridView1 .plhf[data-id='+ id +']').html( '<td colspan="12"><table align="left">'+ d +'</table><div style="clear:both;"></div></td>' );
								
								$t.parent().parent().hide();
							}
						})
					});
					td.find(':input[name=username]').val('');
					td.find(':input[name=content]').val('');
				}
			}
		})
	}
	})
	// 回复 end
	
	$('#GridView1 > tbody > tr').each(function(i){
		if( i % 2 ){
			$(this).addClass('backfafad2');
		}
	})
	
	$('#GridView1 td.showCity').each(function(){
		var that = this;
		var s = this.innerHTML;
		var isBianJi = $(that).parent().html().indexOf('编辑') > -1;
		if( isBianJi ){
			that.innerHTML = '来自: 北京 海淀';
			return;
		}
		$.get('inc/pinglunCity.asp?ip='+s+'&ran='+Math.random(), function(d){	
			that.innerHTML = '来自: ' + d;
		})
	})
	
	var imycnum = $('#GridView1 span.mycnum').length;
	$('#GridView1 span.mycnum').each(function(){
		$(this).find('span').html( imycnum-- );
	})
	
	// 替换前台显示
	rDomain = /(www\.[\w.]+)|([\w.]{4,}\.((com)|(cn)|(net)))/g;
	rQQ = /(qq)\s*\d+/ig;
	rHM = /(\d{3})\d{4}(\d{4})/ig;  //替换前台手机号码显示后4位为*
	$('#GridView1 td.showContent').each(function(){
		var s = this.innerHTML;
		s = s.replace(rDomain, function(){
			return 'alwindoor.com';
		})
		s = s.replace(rQQ, function($, $1){
			return $1 + '***';
		})
		s = s.replace(rHM, function($, $1, $2){    //替换前台手机号码显示后4位为*
			return $1 + $2 + '****';
		})
		this.innerHTML = s;
	})

});
</script>
<script type="text/javascript">
 function   changeIframeHeight()     //自动改变   Iframe   的高度   
  {   
        if(top   !=   self)   
        {   
              window.parent.document.getElementById(self.name).height   =   document.body.scrollHeight;   
        }     
  }   
  function   window.onload()   
  {   
        changeIframeHeight();   //改变   Iframe   高   
  }
  </script>
<body>
    <form id="form1" runat="server">
    <div id="Layer1">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager></div>
        <div>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
            

                <table align="center" bgcolor="#FFFFFF" border="0" cellspacing="3" height="370" style="width: 606px">
                
                    <tr>
                        <td style="width: 606px;" valign="top" align="center">
                            &nbsp;<table bgcolor="#ffffff" style="border-right: #B0CDEB 1px solid; border-top: #B0CDEB 1px solid;
                                border-left: #B0CDEB 1px solid; border-bottom: #B0CDEB 1px solid; width: 606px;" align="center" id="TABLE1" runat="server">
                                <tr>
                                    <td  valign="top" style="height: 105px; width: 674px;">
                                        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BorderStyle="solid"
                                            BorderWidth="0px" DataKeyNames="id" OnRowCommand="GridView1_RowCommand" Width="482px" ShowFooter="True" GridLines="None">
                                            <Columns>
                                                <asp:TemplateField>
                                                    <HeaderTemplate>
                                                        以下读者评论只代表网友个人观点，不代表本站观点
                                                    </HeaderTemplate>
                                                    <ItemTemplate>
                                                        <table border="0" cellpadding="3" cellspacing="0" style="width: 606px">
                                                            <tr>
                                                                <td width="194"  align="left" bgcolor="#f9fdff" height="21" style="font-size: 14px; width: 194px;
                                                                    color: #243d88; table-layout:fixed;word-break:break-all;word-wrap:break-word">
                                                                    <span class="mycnum" style="color:#666666; font-size:13px">&lt;第<span></span>楼&gt;</span> &nbsp;&nbsp;昵称：<%# Eval("username") %></td>
                                                                <td width="204" align="left" bgcolor="#f9fdff" style="font-size: 13px; width: 204px; color: #243d88">
                                                                    发表时间：<%# Eval("date") %></td>
                                                                <td class="showCity" align="right" bgcolor="#f9fdff" colspan="4" style="font-size: 13px; color: #243d88"
                                                                    width="80">IP:<%#  Eval("ip").ToString().Remove(Eval("ip").ToString().LastIndexOf('.') + 1) + "*"%></td>
                                                            </tr>
                                                            <tr>
                                                                <td align="left" bgcolor="#f9fdff" colspan="6" style="font-size: 14px; color: black;
                                                                    table-layout:fixed;word-break:break-all;word-wrap:break-word; height: 24px; width:539px" valign="top">
                                                                    <%# Eval("content") %>
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td align="left" bgcolor="#f9fdff" style="font-size: 14px; width: 190px; color: black;
                                                                    table-layout:fixed;word-break:break-all;word-wrap:break-word; height: 4px" valign="top">&nbsp;
                                                                    </td>
                                                                <td align="right" bgcolor="#f9fdff" style="font-size: 12px; width: 200px; color: black;
                                                                    table-layout:fixed;word-break:break-all;word-wrap:break-word; height: 4px" valign="top">
                                                                    &nbsp;<asp:Label ID="tip" runat="server" Text="Label" Visible="false"></asp:Label></td>
                                                                
																<td style="width:190px; height:22px; background:#f9fdff; color:#a0a0a0; font-size:12px;">
																	支持：<%# Eval("zhichi") %>
																	反对：<%# Eval("fandui") %>
																	<a href="javascript:;" class="wyhf-btn">回复</a>
																</td>
                                                            </tr>
<tr style="display:none;">
	<td colspan="12" align="right" style="background:#f9fdff; color:#a0a0a0; font-size:12px;">
		<input type="hidden" name="id" value="<%# Eval("id") %>" />
		<input type="hidden" name="infoid" value="<%# Eval("infoid") %>" />
		<span style="position:relative; left:-100px;">昵称：<input name="username" style="width:100px;" /></span>
		<div style="margin:6px 0;">
		<span style="position:relative; top:-30px;">回复：</span><textarea name="content" style="width:200px; height:40px; line-height:20px; overflow:auto; resize:none;"></textarea>
		</div>
		<button type="button" class="wyhf-form-btn">我要回复</button>
	</td>
</tr>
<tr data-id="<%# Eval("id") %>" class="plhf">
</tr>															
                                                        </table>
                                                    </ItemTemplate>
                                                    <FooterTemplate>
                                                        
                                                    </FooterTemplate>
                                                </asp:TemplateField>
                                                <asp:ButtonField ButtonType="Image" CommandName="zhichi" ImageUrl="~/Image/zhichi.gif"
                                                    Text="称赞">
                                                    <ItemStyle BackColor="#F9FDFF" VerticalAlign="Top" />
                                                </asp:ButtonField>
                                                <asp:ButtonField ButtonType="Image" CommandName="fandui" ImageUrl="~/Image/fandui.gif"
                                                    Text="鄙视">
                                                    <ItemStyle BackColor="#F9FDFF" VerticalAlign="Top" />
                                                </asp:ButtonField>
                                            </Columns>
                                            <RowStyle BorderStyle="solid" />
                                            <SelectedRowStyle BorderStyle="solid" />
                                            <PagerStyle BackColor="#CFE0F0" BorderColor="#804040" BorderStyle="solid" ForeColor="Navy"
                                                HorizontalAlign="Center" />
                                            <HeaderStyle BorderColor="Red" Font-Bold="True" Font-Size="14px" ForeColor="Black"
                                                HorizontalAlign="Left" />
                                            <FooterStyle HorizontalAlign="Right" />
                                        </asp:GridView>
                                        &nbsp;</td>
                                </tr>
                                <tr><td align="right" style="height: 1px; width: 674px;"><a href="PingLun.aspx?id=<%=Request.QueryString["id"]%>" target="_blank">&gt;&gt;查看完整评论</a></td></tr>
                                <tr><td align="center" style="height: 7px; width: 674px;"><webdiyer:aspnetpager id="AspNetPager1" runat="server" onpagechanged="AspNetPager1_PageChanged"
                                            pageindexboxtype="TextBox" showfirstlast="False" showpageindexbox="Never"></webdiyer:aspnetpager>  </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    
                    <tr>
                        <td align="center" valign="top" width="100%" style="">
                        <table  align="center" bgcolor="#ffffff" cellspacing="0" style="border-right: #B0CDEB 1px solid;
                                border-top: #B0CDEB 1px solid; border-left: #B0CDEB 1px solid; border-bottom: #B0CDEB 1px solid; height: 258px; width: 518px;">
  <tr>
    <td width="655" valign="top" style="height: 141px" align="center">
	<table width="655">
      <tr>
        <td colspan="4" align="left">
			<div style="padding:2px 0; width:130px; background:#656363; color:#fff; font-weight:700; font-size:16px; text-align:center;">立即发表评论:</div>
		</td>
      </tr>
      <tr>
        <td style="width: 113px; height: 16px;" align="right">&nbsp;昵称：</td>
        <td align="left" style="width: 290px; height: 16px;">
			<input type="hidden" id="userid" runat="server" />
            <asp:TextBox ID="TextBox1" runat="server" CssClass="text">读者</asp:TextBox><asp:Label
                ID="Label2" runat="server" Visible="False"></asp:Label>&nbsp;</td>
        <td rowspan="2"><asp:UpdateProgress ID="UpdateProgress1" runat="server">
            <ProgressTemplate>
                <table bgcolor="#f9fdff" style="border:1px; border-color:White; border-style:double" align="left" border="2" bordercolor="#cfe0f0" height="30" width="210">
                    <tr>
                        <td height="30" align="left" style="width: 100px; height: 26px" rowspan="2"><img src="image/loading.gif" />
                            <font color="seagreen" size="2"><span style="color: #666666">请稍后...</span></font></td>
                    </tr>
                </table>
            </ProgressTemplate>
        </asp:UpdateProgress>
            &nbsp;</td>
      </tr>
      <tr>
        <td style="width: 113px; height: 95px" align="right" valign="top">&nbsp;评论：</td>
        <td style="height: 95px; width: 290px;" align="left">
            <asp:TextBox ID="TextBox2" runat="server" CssClass="Mtext" Height="101px" TextMode="MultiLine"
                Width="296px"></asp:TextBox>&nbsp;</td>
        </tr>
      <tr>
        <td style="width: 113px; height: 15px;">&nbsp;</td>
        <td style="width: 290px; height: 15px;"><asp:Button ID="Button1" runat="server" Text="发表评论" CssClass="button" OnClick="Button1_Click" OnClientClick="goto('#now',3500)"/>
            &nbsp;&nbsp;
            <asp:Button ID="Button2" runat="server" Text="重新填写"  CssClass="button" OnClick="Button2_Click"/>&nbsp;</td>
        <td style="height: 15px">&nbsp;</td>
      </tr>
    </table>
	<table height="126" style="width: 606px">
      <tr>
        <td style="height: 38px;" colspan="3" align="center">&nbsp;<strong>您觉得文章内容如何：
            已经有<font color="red"><%=yumen+nanguo+shangque+qidai+bucuo+guanzhu %></font>位读者对文章发表个人观点</strong>&nbsp;</td>
      </tr>
      <tr>
        
        <td style="height: 99px" align="center"><table border="0" style="width: 450px">
          <tbody>
            <tr>
              <td valign="bottom" align="center"><% =yumen%>
                  <br />
                <img height="<%=50*yumen/(yumen+nanguo+shangque+qidai+bucuo+guanzhu+1)%>" src="Image/zhuzi.gif" width="20" /></td>
              <td valign="bottom" align="center"><% =nanguo%>
                  <br />
                <img height="<% =50*nanguo/(yumen+nanguo+shangque+qidai+bucuo+guanzhu+1)  %>" src="Image/zhuzi.gif" width="20" /></td>
              <td valign="bottom" align="center"><% =shangque%>
                  <br />
                <img height="<% =50*shangque/(yumen+nanguo+shangque+qidai+bucuo+guanzhu+1)  %>" src="Image/zhuzi.gif" width="20" /></td>
              <td valign="bottom" align="center"><% =qidai%>
                  <br />
                <img height="<% =50*qidai/(yumen+nanguo+shangque+qidai+bucuo+guanzhu+1)  %>" src="Image/zhuzi.gif" width="20" /></td>
              <td valign="bottom" align="center"><% =bucuo%>
                  <br />
                <img height="<% =50*bucuo/(yumen+nanguo+shangque+qidai+bucuo+guanzhu+1)  %>" src="Image/zhuzi.gif" width="20" /></td>
              <td valign="bottom" align="center"><% =guanzhu%>
                  <br />
                <img height="<% =50*guanzhu/(yumen+nanguo+shangque+qidai+bucuo+guanzhu+1)  %>" src="Image/zhuzi.gif" width="20" /></td>
            </tr>
            <tr>
              <td align="center"><img src="Image/yumen.gif" /></td>
              <td align="center"><img src="Image/nanguo.gif" /></td>
              <td align="center"><img src="Image/shangque.gif" /></td>
              <td align="center"><img src="Image/qidai.gif" /></td>
              <td align="center"><img src="Image/bucuo.gif" /></td>
              <td align="center"><img src="Image/guanzhu.gif" align="middle" /></td>
            </tr>
            <tr>
              <td height="44" colspan="6" align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:RadioButtonList id="RadioButtonList1" runat="server" Font-Size="14.7px" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged" AutoPostBack="True" Width="508px" RepeatDirection="Horizontal">
                    <asp:ListItem Value="5">郁闷</asp:ListItem>
                    <asp:ListItem Value="6">难过</asp:ListItem>
                    <asp:ListItem Value="7">商榷</asp:ListItem>
                    <asp:ListItem Value="8">期待</asp:ListItem>
                    <asp:ListItem Value="9">不错</asp:ListItem>
                    <asp:ListItem Value="10">关注</asp:ListItem>
                  </asp:RadioButtonList>
                  <asp:Label id="TouPiaoMS" runat="server" Font-Size="Smaller"></asp:Label></td>
            </tr>
          </tbody>
        </table>
        </td>
      </tr>
      <tr>
	  <td style="height: 182px" align="center">
		<iframe marginwidth="0" marginheight="0" height="186" width="582" scrolling="no" align="center" border="0" frameborder="0" src="/ajax/readerHot.html"></iframe>
	  </td>
	  </tr>
    </table>
	</td>
  </tr>
 <td align="center" style="border-top:1px; border-top-color:#B0CDEB; border-top-style:solid">
                                        <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" GridLines="None" BorderStyle="solid" Width="412px">
                                            <Columns>
                                                <asp:TemplateField>
                                                    <ItemTemplate>
                                                        <table border="0" cellpadding="3" cellspacing="0" style="width: 584px">
                                                            <tr>
                                                                
                                                                <td bgcolor="#f9fdff" style="color:#243D88;font-size:14.7px; width: 83%; height: 22px;word-break:break-all" align="left">
                                                                    <li style="margin:0; list-style:none;"><a href="info/<%# Eval("path")%>/<%# Eval("id")%>-1.htm" target="_blank"><span style="font-family:'宋体';">·</span><%# Eval("title") %></a>(<%# Eval("totalcount") %>)</li></td>
                                                                <td bgcolor="#f9fdff" style="font-size:14px; width: 17%; height: 22px;" align="right">
                                                                <%# Eval("date").ToString().Remove(Eval("date").ToString().LastIndexOf(' ') )%>
                                                                </td>
                                                                
                                                            </tr>
                                                            
                                                        </table>
                                                    </ItemTemplate>
                                                    <HeaderTemplate>
														<div style="margin-left:4px; padding:2px 0; width:130px; background:#0000ff; color:#fff; font-weight:700; font-size:16px; text-align:center;">热门评论文章:</div>
                                                    </HeaderTemplate>
                                                </asp:TemplateField>
                                            </Columns>
                                            <HeaderStyle BorderColor="Red" ForeColor="Black" HorizontalAlign="Left"  Font-Size="14px" Font-Bold="True"/>
                                            <RowStyle BorderStyle="solid" />
                                            <SelectedRowStyle BorderStyle="solid" />
                                            <PagerStyle BackColor="#ECECEC" BorderColor="#804040" BorderStyle="solid" ForeColor="Navy"
                                                HorizontalAlign="Center" />
                                        </asp:GridView>
                                       </td>
                            
                        </td>
                    </tr>
                </table>
  </tr>
</table>
            </ContentTemplate>
            
        </asp:UpdatePanel>
        </div>
        
        </form>

</body>
</html>





