<%
function titleb(str,strlen)
	dim l,t,c, i
	l=len(str)
	t=0
	for i=1 to l
	c=Abs(Asc(Mid(str,i,1)))
	if c>255 then
	t=t+2
	else
	t=t+1
	end if
	if t>=strlen then
	titleb=left(str,i)&"…"
	exit for
	else
	titleb=str&""
	end if
	next
end function

function newslist(ll,tt,lmnameid,openwindow,icon)

lmid=trim(request("lm"))
lm2=trim(request("lm2"))
if lm="" then lm=lm2
if lm2="" then lm2=lm
n=trim(request("n"))
list=trim(request("list"))
hot=trim(request("hot"))
tj=trim(request("tj"))
soso=trim(chkhtm(request("soso")))
dot=trim(chkhtm(request("dot")))
more=trim(request("more"))
'if lmname="" then lmname=0
if n="" then n=20
if list="" then list=10
if more="" then more=1
if openwindow="1" then
   openwindow=" target=_blank "
else
   openwindow=" target=_top  "
end if
if (not isNumeric(dot)) then dot=0
%>

<%
lm=trim(request("lm"))
lm2=trim(request("lm2"))

if lm="" then lm=lm2
if lm2="" then lm2=lm

if (not isNumeric(lm)) then
	lm=0
end if

word=trim(request("word"))

sql= "select * from news where title<>'' and sh=1 "

if lm<>"0" then
  sql=sql&" and (lm='"&lm&"' or lm2='"&lm&"' or lm3='"&lm&"') "  
end if
if XsUser<>"" then sql=sql&" and adduser='"&XsUser&"' "

if soso<>"" then sql=sql&" and title like '%"&soso&"%' "
if lryname<>"" then sql=sql&" and adduser='"&lryname&"' "
if tj="1" then
   sql= sql & " and tj='推荐' "
end if
if hot="1" then
  sql=sql & " order by hit desc , [TIME] desc  , id desc"
else
  sql=sql & " order by ontop desc , [TIME] desc , id desc"
end if
%>
<div>

		
<%

Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open sql,conn,1,1
if rs.recordcount<>0 then 

	page=int(request.QueryString ("page"))
	rs.PageSize=ll
	pagecount=rs.pagesize
	if page<=0 then page=1
	if request.QueryString("page")="" then page=1
	rs.AbsolutePage=page
	
	if ListTD=1 then
	    for i=1 to pagecount
	    
	    %>
	    
				
	    <%
	    lm2=rs("lm3")
	     if lm2="0" or lm2="" then lm2=rs("lm2")
	        if lm2="0" or lm2="" then lm2=rs("lm")
	         sql2 = "select * from lm where id="&lm2
	         Set rs2 = Server.CreateObject("ADODB.RecordSet")
	         rs2.Open sql2,conn,1,1
	         if rs2.recordcount<>0 then
	         	lmid=rs2("id")
		         lm=rs2("lm")&rs2("lm2")&rs2("lm3")
		         pic=rs2("pic")
	         end if
	         
	         bold=rs("bold")
	  		 italic=rs("italic")
	         
				   if rs("titlecolor")="默认颜色" or trim(rs("titlecolor"))="" then
				     fontcolor=rs2("fontcolor")
				   else
				     fontcolor=rs("titlecolor")
				   end if
			rs2.close:set rs2=nothing
	    %>
	    <div id=list>
	      <Div style='height:<%=ListTitleHJ%>px;float:left;width:20px'><%=icon%></Div>
	      <%if newstime="1" then response.write "<div style='float:right'><font color="&NewsTimeColor&" style='font-size:"&ListTitleSize&"pt;'>("&datetime2(rs("Time"),2)&")</font></div>"%>
	      <div style="height:<%=ListTitleHJ%>px;text-align:left"><%if lmnameid="1" then response.write "[<a href=news_more.asp?lm2="&lmid&" style='font-size:"&ListTitleSize&"pt;'>"&lm&"</a>]&nbsp;"%><a href="<%=hrefID(rs("ID"),rs("filename"))%>" <%=openwindow%>><font style='color:<%=trim(fontcolor)%>; <% if bold="1" then Response.Write "font-weight:700;"%> <%if italic="1" then Response.Write " font-style: italic; "%> font-size:<%=ListTitleSize%>pt;'><%=titleb(rs("title"),tt)%></font></a>
	      <%
			if newshit="1" then response.write "阅读:"&rs("hit")
	        if trim(rs("pic"))<>"" and pic="1" then Response.Write "[图]"
	      %>
	      </div>
	      
	      
	      
	      
	      <%if dot="1" then%>
	      
	      <div style="width:100%;height:2px;margin-bottom:10px;" ><div style='border-top:1px dashed #cccccc;height: 1px;overflow:hidden;'></div></div>
	    <%
	      end if
	     %>
	     </div>
	     <%
	    rs.movenext
	    if rs.eof then exit for
	    next
	    
	elseif ListTD>1 then 
		%>
		<div><table width=100% border=0 cellpadding=0 cellspacing=0 >
		<%
	    for i=1 to pagecount
	    
	    %>
	    	<tr id=list>
	    	<%
	    	for j = 1  to ListTD
	    	%>
				<td>
					<%
					lm2=rs("lm3")
					if lm2="0" or lm2="" then lm2=rs("lm2")
					if lm2="0" or lm2="" then lm2=rs("lm")
					sql2 = "select * from lm where id="&lm2
					Set rs2 = Server.CreateObject("ADODB.RecordSet")
					rs2.Open sql2,conn,1,1
					if rs2.recordcount<>0 then
						lmid=rs2("id")
						lm=rs2("lm")&rs2("lm2")&rs2("lm3")
						pic=rs2("pic")
					end if
					
					bold=rs("bold")
					italic=rs("italic")
					
					   if rs("titlecolor")="默认颜色" or trim(rs("titlecolor"))="" then
					     fontcolor=rs2("fontcolor")
					   else
					     fontcolor=rs("titlecolor")
					   end if
					rs2.close:set rs2=nothing
					%>
					<div align=center style='height:<%=ListTitleHJ%>px;float:left;width:20px'><%=icon%></div>
					<div align=left style="height:<%=ListTitleHJ%>px;" ><%if lmnameid="1" then response.write "[<a href=news_more.asp?lm2="&lmid&" style='font-size:"&ListTitleSize&"pt;'>"&lm&"</a>]&nbsp;"%><a href="<%=hrefID(rs("ID"),rs("filename"))%>" <%=openwindow%>><font style='color:<%=trim(fontcolor)%>; <% if bold="1" then Response.Write "font-weight:700;"%> <%if italic="1" then Response.Write " font-style: italic; "%> font-size:<%=ListTitleSize%>pt;'><%=titleb(rs("title"),tt)%></font></a>
					<%
					if newshit="1" then response.write "阅读:"&rs("hit")
					if trim(rs("pic"))<>"" and pic="1" then Response.Write "[图]"
					if newstime="1" then response.write "<font color="&NewsTimeColor&" style='font-size:"&ListTitleSize&"pt;'>("&datetime2(rs("Time"),2)&")</font>"
					%>
		      </div></td>
		    <%
		    rs.movenext
		    if rs.eof then exit for
		    next
	    	%>
	      <%if dot="1" then%>
	      
	      <div style="background-image:url('images/dot.jpg');width:100%;height:10px;" ></div>
	    <%
	      end if
	      %>
	      </tr>
	      <%
	    if rs.eof then exit for
	    next
		%>
		</table></div>
		<%
	end if
else
  response.write "<center><BR><BR><BR>无记录<BR><BR><BR><BR>"
end if
%>
<div style="text-align:center;">
<%
if NewsListPageLanguage="中文" then
	if rs.recordcount<>0 then
	  if page>1 then%>
	     <a href='<%=request.servervariables("URL")%>?page=1&word=<%=word%>&lm=<%=trim(request("lm"))%>&lm2=<%=trim(request("lm2"))%>&lmname=<%=trim(request("lmname"))%>&open=<%=trim(request("open"))%>&n=<%=trim(request("n"))%>&hot=<%=trim(request("hot"))%>&tj=<%=trim(request("tj"))%>&soso=<%=soso%>&dot=<%=dot%>&lryname=<%=lryname%>&XsUser=<%=XsUser%>'>首页</a>
	     <a href='<%=request.servervariables("URL")%>?page=<%=page-1%>&word=<%=word%>&lm=<%=trim(request("lm"))%>&lm2=<%=trim(request("lm2"))%>&lmname=<%=trim(request("lmname"))%>&open=<%=trim(request("open"))%>&n=<%=trim(request("n"))%>&hot=<%=trim(request("hot"))%>&tj=<%=trim(request("tj"))%>&soso=<%=soso%>&dot=<%=dot%>&lryname=<%=lryname%>&XsUser=<%=XsUser%>'>上一页</a>
	  <%end if%>
	  <%if page<rs.pagecount then%>
	     <a href='<%=request.servervariables("URL")%>?page=<%=page+1%>&word=<%=word%>&lm=<%=trim(request("lm"))%>&lm2=<%=trim(request("lm2"))%>&lmname=<%=trim(request("lmname"))%>&open=<%=trim(request("open"))%>&n=<%=trim(request("n"))%>&hot=<%=trim(request("hot"))%>&tj=<%=trim(request("tj"))%>&soso=<%=soso%>&dot=<%=dot%>&lryname=<%=lryname%>&XsUser=<%=XsUser%>'>下一页</a>
	     <a href='<%=request.servervariables("URL")%>?page=<%=rs.pagecount%>&word=<%=word%>&lm=<%=trim(request("lm"))%>&lm2=<%=trim(request("lm2"))%>&lmname=<%=trim(request("lmname"))%>&open=<%=trim(request("open"))%>&n=<%=trim(request("n"))%>&hot=<%=trim(request("hot"))%>&tj=<%=trim(request("tj"))%>&soso=<%=soso%>&dot=<%=dot%>&lryname=<%=lryname%>&XsUser=<%=XsUser%>'>尾页</a>
	  <%end if%>
	　共<%=rs.recordcount%>条　每页显示<%=pagecount%>条　　第<%=page%>页　共<%=rs.pagecount%>页				
	    <script language="JavaScript">
	      <!--
	       function FP_jumpMenu(el,frm,sel) {//v1.0
	       var href=el.options[el.selectedIndex].value; if(sel) el.selectedIndex=0;
	       if('_new'==frm) open(href); else eval(frm+".location='"+href+"'");
	        }
	       // -->
	     </script>
	
	   <select size="1" onchange="FP_jumpMenu(this,'window',false)" id="id1" name="D1" style="font-size: 9pt; border-style: solid; border-width: 1px">
	        <%for i=1 to rs.pagecount%>
	          <option value="<%=request.servervariables("URL")%>?page=<%=i%>&word=<%=word%>&lm=<%=trim(request("lm"))%>&lm2=<%=trim(request("lm2"))%>&lmname=<%=trim(request("lmname"))%>&open=<%=trim(request("open"))%>&n=<%=trim(request("n"))%>&hot=<%=trim(request("hot"))%>&tj=<%=trim(request("tj"))%>&soso=<%=soso%>&dot=<%=dot%>&lryname=<%=lryname%>&XsUser=<%=XsUser%>" <%if page=i then response.write "selected"%>>第<%=i%>页</option>
	        <%next%>
	    </select>
	</p>
	<%end if
elseif NewsListPageLanguage="英文" then


	if rs.recordcount<>0 then
	  if page>1 then%>
	     <a href='<%=request.servervariables("URL")%>?page=1&word=<%=word%>&lm=<%=trim(request("lm"))%>&lm2=<%=trim(request("lm2"))%>&lmname=<%=trim(request("lmname"))%>&open=<%=trim(request("open"))%>&n=<%=trim(request("n"))%>&hot=<%=trim(request("hot"))%>&tj=<%=trim(request("tj"))%>&soso=<%=soso%>&dot=<%=dot%>&lryname=<%=lryname%>&XsUser=<%=XsUser%>'>FIRST</a>
	     <a href='<%=request.servervariables("URL")%>?page=<%=page-1%>&word=<%=word%>&lm=<%=trim(request("lm"))%>&lm2=<%=trim(request("lm2"))%>&lmname=<%=trim(request("lmname"))%>&open=<%=trim(request("open"))%>&n=<%=trim(request("n"))%>&hot=<%=trim(request("hot"))%>&tj=<%=trim(request("tj"))%>&soso=<%=soso%>&dot=<%=dot%>&lryname=<%=lryname%>&XsUser=<%=XsUser%>'>PREVIOUS</a>
	  <%end if%>
	  <%if page<rs.pagecount then%>
	     <a href='<%=request.servervariables("URL")%>?page=<%=page+1%>&word=<%=word%>&lm=<%=trim(request("lm"))%>&lm2=<%=trim(request("lm2"))%>&lmname=<%=trim(request("lmname"))%>&open=<%=trim(request("open"))%>&n=<%=trim(request("n"))%>&hot=<%=trim(request("hot"))%>&tj=<%=trim(request("tj"))%>&soso=<%=soso%>&dot=<%=dot%>&lryname=<%=lryname%>&XsUser=<%=XsUser%>'>NEXT</a>
	     <a href='<%=request.servervariables("URL")%>?page=<%=rs.pagecount%>&word=<%=word%>&lm=<%=trim(request("lm"))%>&lm2=<%=trim(request("lm2"))%>&lmname=<%=trim(request("lmname"))%>&open=<%=trim(request("open"))%>&n=<%=trim(request("n"))%>&hot=<%=trim(request("hot"))%>&tj=<%=trim(request("tj"))%>&soso=<%=soso%>&dot=<%=dot%>&lryname=<%=lryname%>&XsUser=<%=XsUser%>'>LAST</a>
	  <%end if%>
	　ALL NEWS:<%=rs.recordcount%>　SINGLE PAGE:<%=pagecount%>　　PAGE:<%=page%>　ALL PAGE:<%=rs.pagecount%>				
	    <script language="JavaScript">
	      <!--
	       function FP_jumpMenu(el,frm,sel) {//v1.0
	       var href=el.options[el.selectedIndex].value; if(sel) el.selectedIndex=0;
	       if('_new'==frm) open(href); else eval(frm+".location='"+href+"'");
	        }
	       // -->
	     </script>
	
	   <select size="1" onchange="FP_jumpMenu(this,'window',false)" id="id1" name="D1" style="font-size: 9pt; border-style: solid; border-width: 1px">
	        <%for i=1 to rs.pagecount%>
	          <option value="<%=request.servervariables("URL")%>?page=<%=i%>&word=<%=word%>&lm=<%=trim(request("lm"))%>&lm2=<%=trim(request("lm2"))%>&lmname=<%=trim(request("lmname"))%>&open=<%=trim(request("open"))%>&n=<%=trim(request("n"))%>&hot=<%=trim(request("hot"))%>&tj=<%=trim(request("tj"))%>&soso=<%=soso%>&dot=<%=dot%>&lryname=<%=lryname%>&XsUser=<%=XsUser%>" <%if page=i then response.write "selected"%>>Go To Page:<%=i%></option>
	        <%next%>
	    </select>
	<%end if
	
elseif NewsListPageLanguage="字符" then


	if rs.recordcount<>0 then
	  if page>1 then%>
	     <a href='<%=request.servervariables("URL")%>?page=1&word=<%=word%>&lm=<%=trim(request("lm"))%>&lm2=<%=trim(request("lm2"))%>&lmname=<%=trim(request("lmname"))%>&open=<%=trim(request("open"))%>&n=<%=trim(request("n"))%>&hot=<%=trim(request("hot"))%>&tj=<%=trim(request("tj"))%>&soso=<%=soso%>&dot=<%=dot%>&lryname=<%=lryname%>&XsUser=<%=XsUser%>'>&lt;&lt;</a>
	     <a href='<%=request.servervariables("URL")%>?page=<%=page-1%>&word=<%=word%>&lm=<%=trim(request("lm"))%>&lm2=<%=trim(request("lm2"))%>&lmname=<%=trim(request("lmname"))%>&open=<%=trim(request("open"))%>&n=<%=trim(request("n"))%>&hot=<%=trim(request("hot"))%>&tj=<%=trim(request("tj"))%>&soso=<%=soso%>&dot=<%=dot%>&lryname=<%=lryname%>&XsUser=<%=XsUser%>'>&lt;</a>
	  <%end if%>
	  <%if page<rs.pagecount then%>
	     <a href='<%=request.servervariables("URL")%>?page=<%=page+1%>&word=<%=word%>&lm=<%=trim(request("lm"))%>&lm2=<%=trim(request("lm2"))%>&lmname=<%=trim(request("lmname"))%>&open=<%=trim(request("open"))%>&n=<%=trim(request("n"))%>&hot=<%=trim(request("hot"))%>&tj=<%=trim(request("tj"))%>&soso=<%=soso%>&dot=<%=dot%>&lryname=<%=lryname%>&XsUser=<%=XsUser%>'>&gt;</a>
	     <a href='<%=request.servervariables("URL")%>?page=<%=rs.pagecount%>&word=<%=word%>&lm=<%=trim(request("lm"))%>&lm2=<%=trim(request("lm2"))%>&lmname=<%=trim(request("lmname"))%>&open=<%=trim(request("open"))%>&n=<%=trim(request("n"))%>&hot=<%=trim(request("hot"))%>&tj=<%=trim(request("tj"))%>&soso=<%=soso%>&dot=<%=dot%>&lryname=<%=lryname%>&XsUser=<%=XsUser%>'>&gt;&gt;</a>
	  <%end if%>
	　<%=pagecount%>/<%=rs.recordcount%>　<%=page%>/<%=rs.pagecount%>				
	    <script language="JavaScript">
	      <!--
	       function FP_jumpMenu(el,frm,sel) {//v1.0
	       var href=el.options[el.selectedIndex].value; if(sel) el.selectedIndex=0;
	       if('_new'==frm) open(href); else eval(frm+".location='"+href+"'");
	        }
	       // -->
	     </script>
	
	   <select size="1" onchange="FP_jumpMenu(this,'window',false)" id="id1" name="D1" style="font-size: 9pt; border-style: solid; border-width: 1px">
	        <%for i=1 to rs.pagecount%>
	          <option value="<%=request.servervariables("URL")%>?page=<%=i%>&word=<%=word%>&lm=<%=trim(request("lm"))%>&lm2=<%=trim(request("lm2"))%>&lmname=<%=trim(request("lmname"))%>&open=<%=trim(request("open"))%>&n=<%=trim(request("n"))%>&hot=<%=trim(request("hot"))%>&tj=<%=trim(request("tj"))%>&soso=<%=soso%>&dot=<%=dot%>&lryname=<%=lryname%>&XsUser=<%=XsUser%>" <%if page=i then response.write "selected"%>>Go To Page:<%=i%></option>
	        <%next%>
	    </select>
	<%end if	
	
end if	
%></div></div><%
end function
%>