<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--#include file="inc_asp/conn.asp"-->
<!--#include file="inc_asp/comfunc.asp"-->
<!--#include file="inc_asp/function_cache.asp"-->
<%
dim classid,wherestr,currentPage,allpage,allcount
classid=request.QueryString("classid")
if Not isempty(request("page")) then
currentPage=Cint(request("page"))
else
currentPage=1
end if
if currentPage<1 then
	currentPage=1
end if

Const MaxPerPage=15

dim topnum,pagenum
if currentPage>1 then
topnum=" top "&MaxPerPage&" "
pagenum=" where News_Id not in(select  top "&(currentPage-1)*MaxPerPage&" News_Id from News order by News_Time desc )"
else
topnum=" top "&MaxPerPage&" "
pagenum=""
end if

if classid<>"" then
	wherestr=" where t2.NewsClass_Id="&classid&""
else
	wherestr=""
end if
dim newclassarray,newarray
call openadmin()

  Set rs0=Server.CreateObject("ADODB.Recordset")
  dim sql0:sql0=" select Dom_Title,Dom_KeyWords,Dom_Description,Dom_custom from Daemon where Dom_Id=7"
  rs0.open sql0,conn1,1,1
  if not(rs0.eof and rs0.bof) then datatitle=rs0("Dom_Title"):dataKeyWords=rs0("Dom_KeyWords"):dataDescription=rs0("Dom_Description"):custom=rs0("Dom_custom") end if

	datacustom=custom&"|"&cityname&"|"&SceneryName

  Set rs=Server.CreateObject("ADODB.Recordset")
  dim sql:sql=" select * from NewsClass"
  rs.CursorLocation = 3
  rs.open sql,conn1,1,1
  Set rs.ActiveConnection = Nothing
  if not(rs.bof and rs.eof) then
	newclassarray=rs.getrows(-1)
  end if
  rs.close:set rs=nothing
  
  Set rs1=Server.CreateObject("ADODB.Recordset")
  dim sql1:sql1=" select "&topnum&" * from News t1 left join NewsClass t2 on(t1.News_Type = t2.NewsClass_Id) "&wherestr&" "&pagenum&" order by News_Time desc;"
  rs1.CursorLocation = 3
  rs1.open sql1,conn1,1,1
  Set rs1.ActiveConnection = Nothing
  if not(rs1.bof and rs1.eof) then
  	newarray=rs1.getrows(-1)
  end if
  rs1.close:set rs1=nothing
  
  Set rs2=Server.CreateObject("ADODB.Recordset")
  dim sql2:sql2=" select top 150 News_Id from News t1 left join NewsClass t2 on(t1.News_Type = t2.NewsClass_Id) "&wherestr&" "
  rs2.open sql2,conn1,1,1
  allcount=rs2.recordcount
  rs2.close:set rs2=nothing
  
  
  if allcount mod MaxPerPage=0 then
  	allpage=allcount \ MaxPerPage
  else
  	allpage=(allcount \ MaxPerPage) +1
  end if
call closeadmin()
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="inc_css/style.css" type="text/css" rel="stylesheet" />
<link href="inc_css/comm.css" type="text/css" rel="stylesheet" />
<link href="inc_css/news.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="inc_js/jquery-1.3.2.js"></script>
<title><%=titlereplace(datatitle,datacustom)%>_µÚ<%=currentPage%>Ò³</title>
<meta name="description" content="<%=titlereplace(dataDescription,datacustom)%>" />
<meta name="keywords" content="<%=titlereplace(dataKeyWords,datacustom)%>" />
</head>
<body>
<!--#include file="header.asp"-->
<div id="container">
	<!--#include file="leftbar.asp"-->
	<div id="right">
    	<h2>ÂÃÓÎ×ÊÑ¶</h2>
        <div class="lanmu">
        <% if isarray(newclassarray) then 
			for i=0 to ubound(newclassarray,2) %>
        	<% if iniflag=1 then %><a href="newslist-<%=newclassarray(0,i)%>.html"><%=newclassarray(1,i)%></a><% else %><a href="news.asp?classid=<%=newclassarray(0,i)%>"><%=newclassarray(1,i)%></a><% end if %>
        <%  next
		 end if %>
        </div>
        <ul class="list">
        <% if isarray(newarray) then
			for k= 0 to ubound(newarray,2)
		 %>
        	<% if iniflag=1 then %>
            <li><a href="newslist-<%=newarray(8,k)%>.html">¡¾<%=newarray(10,k)%>¡¿</a><a class="tit" href="new-<%=newarray(0,k)%>.html"><%=newarray(1,k)%></a><span><%=formatdateTime(newarray(7,k),2)%></span></li>
            <% else %>
            <li><a href="news.asp?classid=<%=newarray(8,k)%>">¡¾<%=newarray(10,k)%>¡¿</a><a class="tit" href="article.asp?newid=<%=newarray(0,k)%>"><%=newarray(1,k)%></a><span><%=formatdateTime(newarray(7,k),2)%></span></li>
            <% end if %>
		<% next
		end if %>
        </ul>
		<div id="page">
        <ul class="page_ul">
        <% if iniflag=1 then
			 for p = 1 to allpage
				if classid<>"" then %>
			<a href="newslist-<%=classid%>-<%=p%>.html"><li><%=p%></li></a>
			<% else %>
			<a href="newslist<%=p%>.html"><li><%=p%></li></a>
			<% end if
		 	 next
		 else 
		 	for p = 1 to allpage
				if classid<>"" then %>
			<a href="news.asp?classid=<%=classid%>&page=<%=p%>"><li><%=p%></li></a>
			<% else %>
			<a href="news.asp?page=<%=p%>"><li><%=p%></li></a>
			<% end if
		 	 next
		 end if %>
        </ul>
        </div>
	</div>
</div>
<!--#include file="footer.asp"-->
</body>
</html>
