<%
'////-----------------------------------------------
'////城市模版654函数（开始）
'////-----------------------------------------------
function CityMingZhan(classid)
	dim TempHTM,rs,i:i=1
	if classid = "" or len(classid) = 0 or not isnumeric(classid) then
       TempHTM = ""
	else
	    set rs = conn.execute("select id,classid,Orders,title,titlecolor,url,filename,elite,created from CT654_URL where classid in(" & classid & allchildclass(classid,"CT654_Class") & ") and elite=1 order by Orders desc,id desc") '按点击数
        do while not rs.eof 
			TempHTM = TempHTM & "<li><a href=""" & root_html & getclasspath(rs("classid"),"CT654_Class") & "/" & rs("filename")&site_extname & """>" & TitleColor(rs("title"),rs("titlecolor"))& "</a></li>"&vbcrlf
  		    rs.movenext
			if i>=24 then exit do  '只显示24条
	        i=i+1
		loop
		rs.close:set rs = nothing
		if classid = 0 then
		   TempHTM = TempHTM & ""
		end if
	end if
	CityMingZhan = TempHTM
end function

function CityKuZhan(classid)
	dim TempHTM,rs,rss,j,i:i=1
	if classid = "" or len(classid) = 0 or not isnumeric(classid) then
       TempHTM = ""
	else
	    set rs = conn.execute("select id,parent,Orders,cname,titlecolor,ename,elite from CT654_Class where parent="&classid&" and elite=1 order by Orders,id desc") '按点击数
		do while not rs.eof 
	  	    if i=1 then
  	            TempHTM=TempHTM&"<dl class=""bg0"">"&vbcrlf
                TempHTM=TempHTM&"<dt class=""sortName"">[<a href="""&rs("ename")&"/index" & site_extname&""" >"&rs("cname")&"</a>]</dt>"&vbcrlf
            else
		   	   if i mod 2=0 then
			    TempHTM=TempHTM&"<dl class=""bg1"">"&vbcrlf
                TempHTM=TempHTM&"<dt>[<a href="""&rs("ename")&"/index" & site_extname&""" >"&rs("cname")&"</a>]</dt>"&vbcrlf
		       else
			    TempHTM=TempHTM&"<dl class=""bg0"">"&vbcrlf
                TempHTM=TempHTM&"<dt>[<a href="""&rs("ename")&"/index" & site_extname&""" >"&rs("cname")&"</a>]</dt>"&vbcrlf
			   end if
	        end if
		    set rss = conn.execute("select id,classid,Orders,title,titlecolor,url,filename from CT654_URL where classid="&rs("id")&" order by Orders desc,id desc") '按点击数
		    j=0
			do while not rss.eof 
			   TempHTM = TempHTM & "<dd><a href=""" & root_html & getclasspath(rss("classid"),"CT654_Class") & "/" & rss("filename")&site_extname & """ target=""_blank"">" & TitleColor(rss("title"),rss("titlecolor"))& "</a></dd>"&vbcrlf
		       j=j+strlen(rss("title"))+4 
			   if j>=60 then exit do  '总长度不要超过60
			   rss.movenext
		    loop
		    rss.close:set rss = nothing
			
            TempHTM=TempHTM&"<dd class=""more""><a href="""&rs("ename")&"/index" & site_extname&""" >更多&gt;&gt;</a></dd>"&vbcrlf
            TempHTM=TempHTM&"</dl>"&vbcrlf
  		    rs.movenext
			if i>=24 then exit do  '只显示24条
	        i=i+1
		loop
		
		rs.close:set rs = nothing
		if classid = 0 then
		   TempHTM = TempHTM & ""
		end if
	end if
	CityKuZhan = TempHTM
end function

'//以下暂且不使用
function CityLeftList(Control)
   dim TempHTM,rs,Max,Min,j,i:i=0
   Max=Split(Control,"$$$")
   for j=0 to UBound(Max)
       Min=Split(Max(j),"|")
       TempHTM = TempHTM & "<div class=""CS"" id=""CS3"">"&vbcrlf 
       TempHTM = TempHTM & "<div class=""tit""><h2>"&Min(0)&"</h2></div>"&vbcrlf 
       TempHTM = TempHTM & "<div class=""txt"">"&vbcrlf 
	   set rs = conn.execute("select id,classid,Orders,title,titlecolor,url,filename,elite,created from CT654_URL where classid="&Min(1)&" order by id desc") '按点击数
       do while not rs.eof 
		  Select Case i mod 4
                 Case 0:TempHTM=TempHTM&"<ul class=""bg0"">"&vbcrlf    '奇数是bg0 偶数是bg1
		         Case 2:TempHTM=TempHTM&"<ul class=""bg1"">"&vbcrlf    '奇数是bg0 偶数是bg1
          End Select
	      TempHTM = TempHTM & "<li><a href=""" & root_html & getclasspath(rs("classid"),"CT654_Class") & "/" & rs("filename")&site_extname & """>" & TitleColor(rs("title"),rs("titlecolor"))& "</a></li>"&vbcrlf
          if i mod 2=1 then TempHTM=TempHTM&"</ul>"&vbcrlf 
		  if i>Min(2) then exit do  '只显示24条
	      i=i+1	   
		  rs.movenext
	   loop
	   rs.close:set rs = nothing	   
       TempHTM = TempHTM & "</div>"&vbcrlf 
       TempHTM = TempHTM & "</div><!--CS-->"&vbcrlf 
   next   
   CityLeftList = TempHTM
end function


function CityGuide(id)
	dim TempHTM
	if id = "" or len(id) = 0 or not isnumeric(id) then
		TempHTM = ""
	else
		dim rs
		set rs = conn.execute("select top 1 id,parent,cname,ename from CT654_class where id=" & id)
		if not rs.eof then
			TempHTM = TempHTM & Cityguide(rs("parent"))
			TempHTM = TempHTM & "＞<a href=""" & root_html & getclasspath(id,"CT654_Class") & "/index" & site_extname & """>" & rs("cname") & "</a>"
		end if
		rs.close:set rs = nothing
		if id = 0 then
			TempHTM = TempHTM & ""
		end if
	end if
	Cityguide = TempHTM
end function

function CitySiteMore(id) '获得分类中前5条网址
    dim rs,TempHTM,n:n=0
	set rs = conn.execute("select id,classid,title,url,elite,hide,created,filename from CT654_URL where classid="&id&" order by orders desc")
	do while not rs.eof
	   TempHTM=TempHTM&"&nbsp;<a href=""" & root_html & getclasspath(rs("classid"),"CT654_Class") &"/"& rs("filename") & site_extname & """ target=""_blank""><font color=0>"&rs("title")&"</font></a>&nbsp;"&vbcrlf
	   rs.movenext
	   if n>=3 then exit do
	   n=n+1	
	loop
	rs.close:set rs = nothing
    CitySiteMore=TempHTM
end function

function CityTree(id) 
  dim TempHTM
  if id = "" or len(id) = 0 or not isnumeric(id) then
      TempHTM = ""
  else
      dim TopClassID:TopClassID=GetTopClassID(id,"CT654_Class")
	  dim rs
	  set rs = conn.execute("select id,parent,cname,ename,URLNum from CT654_class where parent=" & TopClassID) 
	  do while not rs.eof
		 TempHTM = TempHTM & "<li><a href=""../" & rs("ename")  & "/index" & site_extname & "#"&rs("id")&""">{$citycname$}" & rs("cname") & "</a>&nbsp;<span class=""unum"">("&rs("URLNum")&")</span></li>"&vbcrlf
		 rs.movenext
	  loop
	  rs.close:set rs = nothing
  end if
  CityTree=TempHTM
end function

function CityWebList(id) 
  dim TempHTM,rs
  TempHTM = TempHTM & "<div class=""UrlSort"">"&vbcrlf
  TempHTM = TempHTM & "<div class=""UrlTit"">"&vbcrlf
  TempHTM = TempHTM & "<h2>{$citycname$}{$cname$}</h2><a name=""{$id$}""></a>"&vbcrlf
  TempHTM = TempHTM & "<p class=""back""><a href=""#"" target=""_self"">返回页首↑</a></p>"&vbcrlf
  TempHTM = TempHTM & "</div>"&vbcrlf
  TempHTM = TempHTM & "<div class=""UrlTxt"">"&vbcrlf
  TempHTM = TempHTM & "<ul>"&vbcrlf
  set rs = conn.execute("select id,classid,Orders,title,titlecolor,url,filename from CT654_URL where classid=" & id) 
  do while not rs.eof
	 'TempHTM = TempHTM & "<li><a href=""" & rs("filename")  & site_extname & """ target=""_blank"">" & rs("title") & "</a></li>"&vbcrlf
	 TempHTM = TempHTM & "<li><a href=""" & rs("url")  & """ target=""_blank"">" & rs("title") & "</a></li>"&vbcrlf
	 rs.movenext
  loop
  rs.close:set rs = nothing
  TempHTM = TempHTM & "</ul>"&vbcrlf
  TempHTM = TempHTM & "</div>"&vbcrlf
  TempHTM = TempHTM & "</div><!-- UrlSort -->"&vbcrlf
  CityWebList=TempHTM
end function
'////-----------------------------------------------
'////城市模版654函数（结束）
'////-----------------------------------------------





Function Readrss(xmlseed)  '远程读取XML文件的函数
  'On Error Resume Next
  dim TempHTM,i,j:j=0
  if 0 then
  dim xmlDoc,http
  Set http=Server.CreateObject("Microsoft.XMLHTTP") 
  http.Open "GET",xmlseed,False
  'http.Open "GET",xmlseed,true
  http.send 
  Set xmlDoc=Server.CreateObject("Microsoft.XMLDOM") 
  xmlDoc.Async=False 
  xmlDoc.ValidateOnParse=False 
  xmlDoc.Load(http.ResponseXML)
  dim item,title,link
  
  Set item=xmlDoc.getElementsByTagName("item")
  if item.Length<=5 then  %>
    <script language="JavaScript">
    //alert("对不起,该新闻条数已经少于5条新闻条数!");
    </script><%
  else
	For i=1 To (item.length-1)
        Set title=item.Item(i).getElementsByTagName("title")
        Set link=item.Item(i).getElementsByTagName("link")
        TempHTM=TempHTM&"<li><a href="""& link.Item(0).Text &""" target='_blank'>"& strvalue(title.Item(0).Text,42) &"</a></li>"&vbcrlf
        j=j+1
		if j>15 then exit for
	Next
  end if
  else
   TempHTM="<iframe src=""/go/Rss.asp?xml="&xmlseed&""" width=""250"" height=""500"" frameborder=""0"" marginwidth=""0"" marginheight=""0"" scrolling=""no""></iframe>"
  end if
  Readrss=TempHTM
End Function

%>