<!--#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="css/c.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {
	font-size: 20px;
	font-weight: bold;
	color:#0000FF;
}
.style2 {color: #0000FF}
.style12 {color: #000000}
-->
</style>
<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);
}</script>
</head>
<%
const recpage=20
dim i
if not isempty(request("page")) then 
currentpage=Clng(trim(request("page")))
else currentpage=1
end if
%>
<body>

<table width="780" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td height="30"><br><div align="center" class="style1">
	  
	    <%
		dim newst
	set rs=server.CreateObject("adodb.recordset") 
	rs.open "select top 1 * from news where id="&id&" order by id desc",conn,3,1
	if not rs.eof then
	response.Write("<a href="""&SiteUrl&"/"&rs("pagepath")&""">"&rs("title")&"</a>")
	newst="<a href="""&SiteUrl&"/"&rs("pagepath")&""">"&rs("title")&"</a>"
	end if
	rs.close
	set rs=nothing
	%>
</div>
    <div align="center" class="style2"> （以下留言仅表达网友个人观点，不代表<%=SiteName%>立场和观点。） 	    </div>    </td>
  </tr>
</table>
<table width="780" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td height="20" bgcolor="#A2EAFF"><div align="center"></div></td>
  </tr>
  <%
  		set rs=server.createobject("adodb.recordset")
  		rs.open "select count(*) AS co from commen where articleid="&id,conn,3,1
		allrec=rs("co")
		totalpage=int((allrec+recpage-1)/recpage)
		rs.close
		set rs=nothing
		set rs=server.createobject("adodb.recordset")
		if(currentpage=1) then
			sql="select top "&recpage&" * from commen where articleid="&id&" order by id desc"
		else
			sql="select top "&recpage&" * from commen where id not in (select top "&(recpage*(currentpage-1))&" id from commen where articleid="&id&" order by id desc) and articleid="&id&" order by id desc "
		end if
		rs.open sql,conn,3,1		
		do while not rs.eof
		'classname=conn.execute("select title from catalogs where id="&rs("classid"))(0)
	%>
  <tr>
    <td style="padding:5px; "><table width="100%"  border="0" cellspacing="0" cellpadding="0" style="border:1px solid #EDECE9; ">
      <tr>
        <td height="18" bgcolor="#EDECE9"> 网友<%=rs("username")%>于<%=rs("moditime")%> 就


 <%=newst%>发表评论


 </td>
      </tr>
      <tr>
        <td> <%=rs("content")%></td>
      </tr>
    </table>
	
    </td>
  </tr>
  <%
    rs.movenext
	  i=i+1
	   if i>=recpage then 
		exit do
	   end if
	  loop
	 ' end sub
	  rs.close
	  set rs=nothing
  %>
  <!--end -->
  <tr>
    <td height="20" bgcolor="#A2EAFF"><div align="center">
      <div align="center">
        <form name="form1" method="post" action="" style="margin:0 0 0 0">
          <%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>
</body>
</html>
<%
call connclose()
%>
