<!--#include file="inc/config.asp"-->
<!--#include file="inc/conn.asp"-->
<%
dim id
id=Clng(trim(request.QueryString("id")))
%>
<html>
<head>
<title>查看留言</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="style/global.css" rel="stylesheet" type="text/css" />
<script language="javascript">
function goto(frm)
{
	var gourl ="view.asp?id=<%=id%>&";
	gourl += "page=" + (frm.page.value);
     var hid=parseInt(frm.hid.value);
	 if(parseInt(frm.page.value)>hid||frm.page.value<=0){
	 alert("错误！请确定你输入的数字在1-"+hid+"之间");
	 return false;
	 }
	window.location.href(gourl);
}
function check(obj){
	with(obj){
		if(author.value==""){
			alert("用户名不能为空!")
			author.focus();
			return false;
		}
		if(content.value==""){
			alert("评论内容不能为空!")
			content.focus();
			return false;
		}
		if(vertcode.value==""){
			alert("验证码不能为空!")
			vertcode.focus();
			return false;
		}
		return true;
	}
}
</script>
</head>
<!--#include file="templet/head.htm"-->
<%
const recpage=20
dim i
if not isempty(request("page")) then 
currentpage=Clng(trim(request("page")))
else currentpage=1
end if
%>
<body>

<table width="960" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td height="30"><br><div align="center" class="style1">	  
	<%
	dim newst,classid
	set rs=server.CreateObject("adodb.recordset") 
	rs.open "select top 1 linkurl,title,classid from news where id="&id&" order by id desc",conn,3,1
	if not rs.eof then
		response.Write("<a style=""font-size:18px; font-weight:bold;"" href="""&rs(0)&""">"&rs(1)&"</a>")
		newst="<a href="""&rs(0)&""">"&rs(1)&"</a>"
		classid=rs(2)
	end if
	rs.close
	set rs=nothing
	%>
</div>
    <div align="center" class="style2"> （以下留言仅表达网友个人观点，不代表<%=SiteName%>立场和观点。） 	    </div>    </td>
  </tr>
</table>
<div align="center">
<table width="960" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td height="20" bgcolor="#D8F3FE"><div align="center"></div></td>
  </tr>
  <%
  		dim resultArr
		set rs=server.createobject("adodb.recordset")
  		rs.open "select count(*) AS co from commen where ischeck=1 and articleid="&id,conn,3,1
		if not rs.eof then
			allrec=rs("co")
			totalpage=int((allrec+recpage-1)/recpage)
		end if
		rs.close
		set rs=nothing
		set rs=server.createobject("adodb.recordset")
		sql="select top "&recpage&" username,moditime,content,face from commen where id <=(select min(id) from(select top "&(recpage*(currentpage-1)+1)&" id from commen where articleid="&id&" and ischeck=1 order by id desc) as t1) and ischeck=1 and articleid="&id&" order by id desc "
		rs.open sql,conn,3,1
		if not rs.eof then
			resultArr=rs.GetRows()
		end if
		rs.close
	  	set rs=nothing
		if(isarray(resultArr)) then
			for i=0 to ubound(resultArr,2)	
		'classname=conn.execute("select title from catalogs where id="&rs("classid"))(0)
	%>
  <tr>
    <td><table width="100%"  border="0" cellspacing="0" cellpadding="0" style="border:1px solid #EDECE9; ">
      <tr>
        <td height="25" bgcolor="#EDECE9"> <img src="/images/face/<%=resultArr(3,i)%>.gif" align="absmiddle">[<strong><%=resultArr(0,i)%></strong>]于<%=resultArr(1,i)%> 就<%=newst%>发表评论</td>
      </tr>
      <tr>
        <td style="padding:10px; line-height:20px;"><%=resultArr(2,i)%></td>
      </tr>
    </table>	
    </td>
  </tr>
  <%
    	next
	end if
	 ' end sub	  
  %>
  <!--end -->
  <tr>
    <td height="20" bgcolor="#FFFFEC"><div align="center">
      <div align="center">
        <form name="form1" method="post" action="" style="margin:0 0 0 0">
<%
dim n,p
n=currentpage+1
p=currentpage-1
if p>0then
response.write("["&"<a href='view.asp?id="&id&"&page="&cstr(p)&"'>上一页</a>]&nbsp;&nbsp;&nbsp;")
else response.write("上一页&nbsp;&nbsp;&nbsp;")
end if 
if (n-1)*recpage>=allrec then 
response.write("下一页" )
else
response.Write("["&"<a href='view.asp?id="&id&"&page="&cstr(n)&"'>下一页</a>]")
end if
response.write("&nbsp;共"&allrec&"条&nbsp;")
response.Write("&nbsp;共"&totalpage&"页&nbsp;")
response.Write("&nbsp;第"&currentpage&"页&nbsp;")
%>
          <input type="hidden" name="hid" value="<%=totalpage%>">
&nbsp;&nbsp;跳至
    <input name="page" type="text" size="5" onChange="goto(this.form)" style="border:1px solid #000000;height:18px ">
    页
    <input type="button" name="Button22" value="Go->" style="font-size:12px ;border:1px solid #000000;height:18px ">
        </form>
      </div>
    </div></td>
  </tr>
</table>
</div>
<div align="center">
<table width="960" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border:1px solid #eee;">
  <tr>
    <td align="center" valign="middle"><table width="100%" height="22" border="0" cellpadding="0" cellspacing="0" bgcolor="#F0F0F0">
      <tr>
        <td width="500" height="28"><div align="center" class="style17">我要说两句</div></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td height="86" align="center" valign="top" background="images/pl3.gif">
	<FORM name="form1" action="commen.asp" method="post" onSubmit="return check(this)">
      <table width="100%" height="163" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
        <tr>
          <td width="54" height="31" align="center" valign="middle"><div align="right">用 户：</div></td>
          <td width="706" align="left" valign="middle"><input name="author" type="text" id="author" size="40"></td>
        </tr>
        <tr>
          <td height="87" align="center" valign="middle"><div align="right">内 容：</div></td>
          <td align="left" valign="middle"><textarea name="content" cols="55" rows="5" id="content"></textarea></td>
        </tr>
		    <tr>
		      <td align="center" valign="middle">表情：</td>
		      <td height="22" align="left" valign="middle">
          <input name="face" type="radio" value="1" checked><img src="/images/face/1.gif" />
          <%
						for i=2 to 10
							response.Write("<input type=""radio"" name=""face"" value="""&i&""" /><img src=""/images/face/"&i&".gif"" />")
						next
					%>
          </td>
		      </tr>
		    <tr>
           <td align="center" valign="middle"><div align="right">验证码：</div></td>
           <td align="left" valign="middle"><input name="vertcode" type="text" id="vertcode" size="6"><img src="image.asp" /></td>
       </tr>
        <tr>
          <td height="45" align="center" valign="middle"></td>
          <td align="left" valign="middle"><table width="350" border="0" cellspacing="0" cellpadding="0">
            <tr align="center" valign="middle">
              <td><a href="#">
                <INPUT type=hidden value=<%=id%> name="id">
                <INPUT name="mode" type=hidden id="mode" value=<%=classid%>>
                <input name="image" type="image" src="images/pl1.gif" width="74" height="22" border="0">
              </a></td>
              <td><a href="#"><img src="images/pl0.gif" width="74" height="22" border="0"></a></td>
            </tr>
          </table></td>
        </tr>
      </table>
    </form></td>
  </tr>
  <tr>
    <td></td>
  </tr>
</table>
</div>
<!--#include file="templet/root.htm"-->
</body>
</html>
<%
call connclose()
%>