<%
'**************************************************
'函数名：gotTopic
'作  用：截字符串，汉字一个算两个字符，英文算一个字符
'参  数：str   ----原字符串
'       strlen ----截取长度
'返回值：截取后的字符串
'**************************************************
function gotTopic(str,strlen)
	if str="" then
		gotTopic=""
		exit function
	end if
	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*2 then
			gotTopic=left(str,i)+".."
			exit for		
		end if
	next
	if(t<strlen*2) then
		gotTopic=str
	end if
end function
'========================================================================
'字符编码函数
'========================================================================
Function BytesToBstr(body,code) 
        dim objstream 
        set objstream = Server.CreateObject("adodb.stream") 
        objstream.Type = 1 
        objstream.Mode =3 
        objstream.Open 
        objstream.Write body 
        objstream.Position = 0 
        objstream.Type = 2 
        objstream.Charset =code
        BytesToBstr = objstream.ReadText  
        objstream.Close 
        set objstream = nothing 
End Function

'===========================================================================
'函数：RemoveHTML(strHTML)
'功能：去除HTML标记
'参数：strHTML		--要去除HTML标记的字符串
'==========================================================================
Function RemoveHTML(strHTML) 
Dim objRegExp, Match, Matches 
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True 
objRegExp.Global = True 
'取闭合的<> 
objRegExp.Pattern = "<.+?>" 
'进行匹配 
if(strHTML<>"") then
	Set Matches = objRegExp.Execute(strHTML)
	' 遍历匹配集合，并替换掉匹配的项目 
	For Each Match in Matches 
		strHtml=Replace(strHTML,Match.Value,"") 
	Next 
else
	exit function
end if
if(strHtml<>"") then
	strHtml=replace(strHtml,VbCrLf,"")
 	strHtml=replace(strHtml,vbNewLine,"")
 	strHtml=replace(strHtml," ","")
	strHtml=replace(strHtml," ","")
 	strHtml=replace(strHtml,"&nbsp;","") 
 	strHtml=replace(strHtml,"\n","") 
 	strHtml=replace(strHtml,chr(10),"")
 	strHtml=replace(strHtml,chr(13),"")
end if
RemoveHTML=strHTML
Set objRegExp = Nothing 
End Function 

Sub	SaveTextFile(f_savepath,f_content)   
	Dim st   
  Set st=Server.CreateObject("ADODB.Stream")   
  st.Type=2   
  st.Mode=3   
  st.Charset=FileCharSet   
  st.Open()   
  st.WriteText   f_content
  st.SaveToFile  f_savepath,2   
  st.Close()   
  Set   st=Nothing   
End   Sub
 
function ReadFromTextFile (f_savepath)
 dim str
 'response.Write(f_savepath)
 set stm=server.CreateObject("adodb.stream")
 stm.Type=2 '以本模式读取
 stm.mode=3 
 stm.charset=FileCharSet
 stm.open
 stm.loadfromfile f_savepath
 str=stm.readtext
 stm.Close
 set stm=nothing
 ReadFromTextFile=str
end function

sub MakeDir(f_path)
	Set fs=Server.CreateObject("Scripting.FileSystemObject")
	If (fs.FolderExists(f_path)) Then		'目录是否存在
		Else
		fs.CreateFolder(f_path)		'创建目录
	End If
	set fs=nothing
end sub
'=======================================================================
'函数：DeleInfo(colume,values,tablename,types)
'作用：删除指定表中某个字段指定值的信息
'参数：colume      ---字段
'      values     ---值
'      tablename  ---表名称
'      type  ---类型，1为字符型，2为数字型
'=====================================================================

Function DeleInfo(colume,values,tablename,types)
on error resume next
dim rs
if(types=1) then
	sql="delete from "&tablename&" where "&colume&"='"&values&"'"
else
	sql="delete from "&tablename&" where "&colume&"="&values
end if
conn.execute(sql)
if Err.Number = 0 then
	DeleInfo=true
end if
end Function

'=======================================================================
'函数：alert(str)
'作用：弹出对话框信息
'参数：str      ---要弹出的信息
'参数：nexti    ---弹出后的动作0=无,1=返回,2=关闭
'=====================================================================

Function alertstr(str,nexti)
	select case(nexti)
			case(0)
				response.Write("<script>alert("""&str&""");</script>")
				response.End()
			case(1)
				response.Write("<script>alert("""&str&""");history.back();</script>")
				response.End()
			case(2)
				response.Write("<script>alert("""&str&""");window.close();</script>")
				response.End()
	end select	
end Function

function tohtml(from)
	dim s
	s=from
	if s<>"" then
    s = Replace(s,"&","&amp;")
    s = Replace(s,"<","&lt;")
    s = Replace(s,">","&gt;")
    s = Replace(s,"\t","    ")
    s = Replace(s,"\r\n","\n")
    s = Replace(s,"\n","<br>")
    s = Replace(s,"  "," &nbsp;")
    s = Replace(s,"'","&#39;")
    s = Replace(s,"\\","&#92;")
	s=replace(s," ","&nbsp;")
    s=replace(s,chr(13)&chr(10),"<br>")
	end if
	tohtml=s
end function
'
function htmlto(from)
	dim ss
	ss=from
	if ss<>"" then
    ss=Replace(ss,"<br>",chr(10))
    ss=Replace(ss,"<Br>",chr(10))
	ss=replace(ss,"&nbsp;"," ")
	end if
	htmlto=ss
end function

'===================================================================
'                           时间转换函数
'===================================================================
function chan_file(shijian)
	dim s_year,s_month,s_day,s_hour,s_minute,s_ss
	s_year=year(shijian)
	if len(s_year)=2 then s_year="20"&s_year end if
	s_month=month(shijian)
	if s_month<10 then s_month="0"&s_month end if
	s_day=day(shijian)
	if s_day<10 then s_day="0"&s_day end if
	s_hour=hour(shijian)
	if s_hour<10 then s_hour="0"&s_hour end if
	s_minute=minute(shijian)
	if s_minute<10 then s_minute="0"&s_minute end if
	s_ss=second(shijian)
	if s_ss<10 then s_ss="0"&s_ss end if
	chan_file =s_year & s_month & s_day & s_hour & s_minute & s_ss	
end function
'===================================================================
'                           时间转换函数2
'===================================================================
function chan_data(shijian)
	dim s_year,s_month,s_day
	s_year=year(shijian)
	if len(s_year)=2 then s_year="20"&s_year end if
	s_month=month(shijian)
	if s_month<10 then s_month="0"&s_month end if
	s_day=day(shijian)
	if s_day<10 then s_day="0"&s_day end if
	s_hour=hour(shijian)
	chan_data =s_year & s_month 
	
end function
''''''''''''''''''''''''''''''
'格式化日期函数
'''''''''''''''''''''''''''''
function FormatDate(shijian,localtype)
	dim s_year,s_month,s_day,s_hour,s_minute,s_second
	s_year=year(shijian)
	if len(s_year)=2 then s_year="20"&s_year end if
	s_month=month(shijian)
	if s_month<10 then s_month="0"&s_month end if
	s_day=day(shijian)
	if s_day<10 then s_day="0"&s_day end if
	s_hour=hour(shijian)
	if s_hour<10 then s_hour="0"&s_hour end if
	s_minute=minute(shijian)
	if s_minute<10 then s_minute="0"&s_minute end if
	s_second=second(shijian)
	if s_second<10 then s_second="0"&s_second end if
	select case(localtype)
		case 1
			FormatDate =s_year&"-"&s_month&"-"&s_day
		case 2
			FormatDate =s_year&"/"&s_month&"/"&s_day
		case 3
			FormatDate =s_year&"-"&s_month
		case 4
			FormatDate =s_month&"-"&s_day
		case 5
			FormatDate =s_hour&":"&s_minute&":"&s_second
	end select	
end function
'===================================================================
'                           时间转换函数3
'===================================================================
function chan_day(shijian)	
	dim s_day
	s_day=day(shijian)	
	chan_day=s_day 
	
end function

Function getRndNum
 	dim rndStr,ranNum1,ranNum2
 	randomize
 	ranNum1=int((9000*rnd)+1000)
	ranNum2=int((9000*rnd)+1000)
	getRndNum=ranNum1&ranNum2
end Function

function getSourceOption(currentid,tablename)
dim ifselect,rs,sql
sql="select id,Title from "&tablename&" order by id asc"
Set rs = conn.Execute(sql)
if rs.eof or rs.bof then
	getSourceOption="<option value=""0"">暂时没有</option>"&Chr(13)
else
	'getSourceOption="<option value=""0"">不限</option>"&Chr(13)
end if
while not rs.eof
	if(Clng(rs(0))=Clng(currentid)) then
		ifselect=" selected"
	else
		ifselect=""
	end if
	getSourceOption=getSourceOption&"<option value="""&rs(0)&""" "&ifselect&">"&rs(1)&"</option>"&Chr(13)
	rs.movenext
wend
rs.close
set rs=nothing
end function

function getDownloadServerOptions(sid)
	dim ifselect,rs,sql
	sql="select id,Title from t_download_server order by id asc"
	Set rs = conn.Execute(sql)
	if rs.eof or rs.bof then
		getDownloadServerOptions="<option value=""0"">暂时没有记录</option>"
	else
		'getSpecialSelect="<option value=""0"">不属任何专题</option>"&Chr(13)
		while not rs.eof
			if(rs(0)=sid) then
				ifselect=" selected"
			else
				ifselect=""
			end if
			getDownloadServerOptions=getDownloadServerOptions&"<option value="""&rs(0)&""" "&ifselect&">"&rs(1)&"</option>"
			rs.movenext
		wend
	end if
	rs.close
	set rs=nothing
end function
function getDownloadServerOptionsJS()
	dim restr,rs,sql
	sql="select id,Title from t_download_server order by id asc"
	Set rs = conn.Execute(sql)
	restr="["	
	while not rs.eof
		restr=restr&"["&rs(0)&",'"&rs(1)&"'],"
		rs.movenext
	wend
	restr=restr&"];"&chr(13)
	rs.close
	set rs=nothing	
	getDownloadServerOptionsJS=restr
end function
'=============================================================
'getResource
'=============================================================
function getResourceOption(tbl,id)
	dim retStr,rs,sql,sele
	set rs=server.CreateObject("adodb.recordset")
	sql="select id,title from "&tbl&" order by id asc"
	rs.open sql,conn,3,1
	while not rs.eof
		if(rs(0)=id) then
			sele=" selected=""selected"""
		else
			sele=""
		end if
		retStr=retStr&"<option value="""&rs(0)&""""&sele&">"&rs(1)&"</option>"&Chr(10)
		rs.movenext
	wend
	rs.close
	set rs=nothing
	getResourceOption=retStr
end function
function getResourceTitle(tbl,id)
	dim retStr,rs,sql
	set rs=server.CreateObject("adodb.recordset")
	sql="select title from "&tbl&" where id="&id
	rs.open sql,conn,3,1
	if not rs.eof then
		retStr=rs(0)
		rs.movenext
	else
		retStr=""
	end if
	rs.close
	set rs=nothing
	getResourceTitle=retStr
end function

'======================================================================
'getNewsByPrimaryKey
'=====================================================================
function getNewsByPrimaryKey(id)
	dim rs,sql,newsHref
	set rs=server.CreateObject("adodb.recordset")
	sql="select title,linkurl,title_color,isoutlink from news where id="&id
	rs.open sql,conn,3,1
	if not rs.eof then
		newsHref=rs(1)
		getNewsByPrimaryKey=getNewsByPrimaryKey&"<a title="""&rs(0)&""" href="&""""&newsHref&""""&">"	
		getNewsByPrimaryKey=getNewsByPrimaryKey&"<span style=""color: "&rs(2)&""">"&rs(0)
		getNewsByPrimaryKey=getNewsByPrimaryKey&"</a>"
	else
		getNewsByPrimaryKey="没有了"
	end if
	rs.close
	set rs=nothing
end function
'======================================================================
'getSoftByPrimaryKey
'=====================================================================
function getSoftByPrimaryKey(id)
	dim rs,sql,newsHref,ret
	set rs=server.CreateObject("adodb.recordset")
	sql="select id,SoftName from t_download_soft where id="&id
	rs.open sql,conn,3,1
	if not rs.eof then
			ret=ret&"<li><a title="""&rs(1)&""" href="&""""&SiteUrl&"/soft/"&rs(0)&".htm"""&">"	
			ret=ret&rs(1)
			ret=ret&"</a></li>"&Chr(10)
			rs.movenext
		getSoftByPrimaryKey=ret
	else
		getSoftByPrimaryKey="<li>没有了</li>"
	end if
	rs.close
	set rs=nothing
end function
'=======================================================================
'函数：GetNews(tablewidth,lineheight,tdStyle,n,tablename,classid,orders,key,titlePrefix,max,linkStyle)
'作用：据条件获得N条新闻
'参数：tablewidth    ---表格宽度
'	   tdStyle		 ---行样式
'      lineheight    ---行高
'      n  	         ---取记录数
'      tablename     ---表名
'      classid       ---类别ID
'      orders        ---按排序
'      key           ---类型，top1<=>头条，totop<=>置顶,tohot<=>热点,recommend<=>推荐,imgnews<=>图文
'	   titlePrefix   ---标题前辍
'      max           ---最大字数
'      linkStyle     ---链接样式
'事例：getnews("99%",20,10,"news",79,"id","top1",50,"wlink")
'=====================================================================
function GetNews(classid,tablewidth,lineheight,tdStyle,n,tablename,orders,key,titlePrefix,max,linkStyle,isTime)
	dim getNewsReturnStr,newsii,newsHref,rs,sql,TempArr	
	getNewsReturnStr=""
	set rs=server.CreateObject("adodb.recordset")  
  	sql="select top "&n&" title,linkurl,moditime,title_color,isoutlink from "&tablename&" where checked=1"	
	if(classid>0) then
		sql=sql&" and classid="&classid
	end if
	Select Case LCase(key)
		Case "top1"
			sql=sql&" and top1=1"
		Case "totop"
			sql=sql&" and totop=1"
		Case "tohot"
			sql=sql&" and tohot=1"
		Case "recommend"
			sql=sql&" and recommend=1"
		Case "imgnews"
			sql=sql&" and imgnews=1"
		Case Else				
	End Select
	sql=sql&" order by "&orders&" desc"
  	set rs=conn.execute(sql)
	if not rs.eof and not rs.bof then
  	TempArr=rs.GetRows()  
  	rs.close
	set rs=nothing
	getNewsReturnStr=getNewsReturnStr&"<table width="&""""&tablewidth&""""&"  border="&""""&"0"&""""&" align="&""""&"center"&""""&" cellpadding="&""""&"0"&""""&" cellspacing="&""""&"0"&""""&">"&chr(13)
	for newsii=0 to ubound(TempArr,2)
		newsHref=TempArr(1,newsii)
		getNewsReturnStr=getNewsReturnStr&"<tr>"&chr(13)
    		getNewsReturnStr=getNewsReturnStr&"<td class="""&tdStyle&""" height="&""""&lineheight&""""&"><div align=""left"">"&titlePrefix&"<a href="&""""&newsHref&""""&" title="""&TempArr(0,newsii)&""" class="""&linkStyle&""" target="&""""&"_blank"&""""&"><span style=""color: "&TempArr(3,newsii)&""">"&gotTopic(TempArr(0,newsii),max)&"</span></a></div></td>"&chr(13)
    		if(Cint(isTime=1)) then
				getNewsReturnStr=getNewsReturnStr&"<td class="""&tdStyle&""" width=""17%""><div align=""center"" style=""color: #999999""><div align=""center"">"&month(TempArr(2,newsii))&"-"&day(TempArr(2,newsii))&"</div></div></td>"
			end if
		getNewsReturnStr=getNewsReturnStr&"</tr>"&chr(13)
	next
	getNewsReturnStr=getNewsReturnStr&"</table>"&chr(13)
	else
		getNewsReturnStr="暂时没有记录"
		'response.Write(getNewsReturnStr)
		rs.close
		set rs=nothing
	end if	
	GetNews=getNewsReturnStr
end function

'=======================================================================
'函数：GetRelateNews(relateKeys)
'作用：据条件获得N条新闻
'参数：relateKeys	--相关新闻关键字
'=======================================================================
Function GetRelateNews(relateKeys,tablewidth,lineheight,n,tablename,orders,key,max,linkStyle,isTime)
	dim tempkeyArr,tempsqlStr,j,newsii,rs,sql,TempArr
	tempkeyArr=split(relateKeys,"|")
	tempsqlStr="select top "&n&" title,linkurl,moditime,title_color,isoutlink from "&tablename&" where checked=1"
	if(ubound(tempkeyArr)>=0) then
		tempsqlStr=tempsqlStr&" and "
		for j=0 to ubound(tempkeyArr)
			tempsqlStr=tempsqlStr&" title like '%"&tempkeyArr(j)&"%'"
			if(ubound(tempkeyArr)>j) then
				tempsqlStr=tempsqlStr&" or "
			end if
		next
	end if
	tempsqlStr=tempsqlStr&" order by id desc"
	'response.Write(tempsqlStr)
	set rs=conn.execute(tempsqlStr)
	if not rs.eof and not rs.bof then
  	TempArr=rs.GetRows()  
  	rs.close
	set rs=nothing
	GetRelateNews=GetRelateNews&"<table width="&""""&tablewidth&""""&"  border="&""""&"0"&""""&" align="&""""&"center"&""""&" cellpadding="&""""&"0"&""""&" cellspacing="&""""&"0"&""""&">"&chr(13)
	for newsii=0 to ubound(TempArr,2)
		newsHref=TempArr(1,newsii)
		GetRelateNews=GetRelateNews&"<tr>"&chr(13)
    		GetRelateNews=GetRelateNews&"<td style=""line-height:20px;"" height="&""""&lineheight&""""&"><div align=""left"">·<a href="&""""&newsHref&""""&" title="""&TempArr(0,newsii)&""" class="""&linkStyle&""" target="&""""&"_blank"&""""&"><span style=""color: "&TempArr(3,newsii)&""">"&gotTopic(TempArr(0,newsii),max)&"</span></a></div></td>"&chr(13)
    		if(Cint(isTime=1)) then
				GetRelateNews=GetRelateNews&"<td width=""17%""><div align=""center"" style=""color: #999999""><div align=""center"">"&month(TempArr(2,newsii))&"-"&day(TempArr(2,newsii))&"</div></div></td>"
			end if
		GetRelateNews=GetRelateNews&"</tr>"&chr(13)
	next
	GetRelateNews=GetRelateNews&"</table>"&chr(13)
	else
		GetRelateNews="暂时没有记录"
		rs.close
		set rs=nothing
	end if
	
end Function
'=======================================================================
'函数：GetNewsAll(classid,tablewidth,lineheight,tdStyle,n,tablename,classid,orders,key,max,linkStyle)
'作用：据条件获得N条新闻
'参数：tablewidth    ---表格宽度
'      lineheight    ---行高
'	   tdStyle       ---行样式
'      n  	         ---取记录数
'      tablename     ---表名
'      orders        ---按排序
'      key           ---类型，top1<=>头条，totop<=>置顶,tohot<=>热点,recommend<=>推荐,imgnews<=>图文
'      max           ---最大字数
'      linkStyle     ---链接样式
'事例：GetNewsAll("99%",20,10,"news","id","top1",50,"wlink",1,1,"")
'=====================================================================
function GetNewsAll(classid,tablewidth,lineheight,tdStyle,n,tablename,orders,key,max,linkStyle,isTime,isCatalog,catalogLinkStyle,titlePrefix)
	dim newsHref,childIds,rowCount,rs,sql,TempArr
	if(classid=0) then
  		sql="select top "&n&" news.title as ntitle,news.linkurl,news.moditime AS mtime,catalogs.title as ctitle,catalogs.domainurl,news.title_color,news.isoutlink,catalogs.flag from "&tablename&",catalogs where news.checked=1 and news.classid=catalogs.id"
	else		
		sql="select top "&n&" news.title as ntitle,news.linkurl,news.moditime AS mtime,catalogs.title as ctitle,catalogs.domainurl,news.title_color,news.isoutlink,catalogs.flag from "&tablename&",catalogs where news.checked=1 and news.parentid="&classid&" and news.classid=catalogs.id"
	end if
	set rs=server.CreateObject("adodb.recordset")
	Select Case LCase(key)
		Case "top1"
			sql=sql&" and news.top1=1"
		Case "totop"
			sql=sql&" and news.totop=1"
		Case "tohot"
			sql=sql&" and news.tohot=1"
		Case "recommend"
			sql=sql&" and news.recommend=1"
		Case "imgnews"
			sql=sql&" and news.imgnews=1"
		Case Else				
	End Select
	sql=sql&" order by news."&orders&" desc"
	GetNewsAll="<table width="&""""&tablewidth&""""&"  border="&""""&"0"&""""&" align="&""""&"center"&""""&" cellpadding="&""""&"0"&""""&" cellspacing="&""""&"0"&""""&">"&chr(13)
  	set rs=conn.execute(sql)
	if not rs.eof and not rs.bof then
  	TempArr=rs.GetRows()  
  	rs.close
	set rs=nothing    	
	for i=0 to ubound(TempArr,2)
		newsHref=TempArr(1,i)
		GetNewsAll=GetNewsAll&"<tr>"&chr(13)
    		GetNewsAll=GetNewsAll&"<td class="""&tdStyle&""" height="&""""&lineheight&""""&">"&"<div align=""left"">"&titlePrefix&chr(13)
			if(Cint(isCatalog=1)) then
				GetNewsAll=GetNewsAll&"<a href="&""""&TempArr(4,i)&"/"
					if(Cint(TempArr(7,i))=0) then
						GetNewsAll=GetNewsAll&"index_1.htm"
					end if
				GetNewsAll=GetNewsAll&""""&" class="""&catalogLinkStyle&""" target="&""""&"_blank"&""""&">["&TempArr(3,i)&"]</a>"&chr(13)
			end if
			GetNewsAll=GetNewsAll&" <a href="&""""&newsHref&""""&" title="""&TempArr(0,i)&""" class="""&linkStyle&""" target="&""""&"_blank"&""""&"><span style=""color: "&TempArr(5,i)&""">"&gotTopic(TempArr(0,i),max)&"</span></a>"&chr(13)
			GetNewsAll=GetNewsAll&"</div></td>"&chr(13)
    		if(Cint(isTime=1)) then
				GetNewsAll=GetNewsAll&"<td class="""&tdStyle&""" width=""12%""><div align=""center"" style=""color: #999999"">"&month(TempArr(2,i))&"-"&day(TempArr(2,i))&"</div></td>"
			end if
		GetNewsAll=GetNewsAll&"</tr>"&chr(13)
	next
	GetNewsAll=GetNewsAll&"</table>"&chr(13)
	else
		GetNewsAll="暂时没有记录"
		rs.close
		set rs=nothing
	end if
end function

'=========================
'DIV输出标签
'=========================
'文本列表标签
function GetTextNews_Div(classid,n,tablename,orders,key,max,isTime,isGetChilds,isCatalog,catalogLinkStyle,titlePrefix)
	dim newsHref,childIds,rowCount,rs,sql,TempArr,tpfix
	sql="select top "&n&" news.title as ntitle,news.linkurl,news.moditime AS mtime,catalogs.title as ctitle,catalogs.domainurl,news.title_color,news.isoutlink,catalogs.flag from "&tablename&",catalogs where news.checked=1  and news.classid=catalogs.id"	
	if(classid>0) then
		sql=sql&" and (news.classid="&classid
		if(isGetChilds>0) then
			sql=sql&" or news.parentid="&classid
		end if
		sql=sql&")"
	end if
	
	set rs=server.CreateObject("adodb.recordset")
	Select Case LCase(key)
		Case "top1"
			sql=sql&" and news.top1=1"
		Case "totop"
			sql=sql&" and news.totop=1"
		Case "tohot"
			sql=sql&" and news.tohot=1"
		Case "recommend"
			sql=sql&" and news.recommend=1"
		Case "imgnews"
			sql=sql&" and news.imgnews=1"
		Case Else				
	End Select
	sql=sql&" order by news."&orders&" desc"	
  	set rs=conn.execute(sql)
	if not rs.eof and not rs.bof then
  		TempArr=rs.GetRows()  
  		rs.close
		set rs=nothing    	
		for i=0 to ubound(TempArr,2)
			newsHref=TempArr(1,i)
			GetTextNews_Div=GetTextNews_Div&"<li>"&chr(13)
    		if(Cint(isTime=1)) then
				GetTextNews_Div=GetTextNews_Div&"<span class=""col_right"">"&FormatDate(TempArr(2,i),4)&"</span>"
			end if
			if(Cint(isCatalog=1)) then
				GetTextNews_Div=GetTextNews_Div&"<a href="&""""&TempArr(4,i)&"/"
					if(Cint(TempArr(7,i))=0) then
						GetTextNews_Div=GetTextNews_Div&"index_1.htm"
					end if
				GetTextNews_Div=GetTextNews_Div&""""&" class="""&catalogLinkStyle&""" target="&""""&"_blank"&""""&">["&TempArr(3,i)&"]</a>"&chr(13)
			end if
			if(titlePrefix="auto") then
				tpfix=i+1
			else
				tpfix=titlePrefix
			end if
			GetTextNews_Div=GetTextNews_Div&tpfix&"<a href="&""""&newsHref&""""&" title="""&TempArr(0,i)&""" target="&""""&"_blank"&""""&"><span style=""color: "&TempArr(5,i)&""">"&gotTopic(TempArr(0,i),max)&"</span></a>"&chr(13)    		
			GetTextNews_Div=GetTextNews_Div&"</li>"&chr(13)
		next	
	else
		GetTextNews_Div="暂时没有记录"
		rs.close
		set rs=nothing
	end if
end function

function GetRemoteFile(fileuri,charcode)
	dim retstr,oSend,fu
	fu=fileuri
	if(left(fu,1)="/") then
		fu=SiteUrl&fu
	end if
	set oSend=createobject("Microsoft.XMLHTTP")
	SourceCode = oSend.open ("GET",fu,false) 
	oSend.send()
	On Error Resume Next 
	If oSend.Status<>200 then 
		Set oSend=Nothing 
		Exit function 
	End if	
	retstr=BytesToBstr(oSend.responseBody,charcode)
	Set oSend = nothing
	GetRemoteFile=retstr
end function

function GetLocalFile(fileuri,charcode)
	dim retstr,oSend
	retstr=ReadFromTextFile(server.MapPath(fileuri))
	GetLocalFile=retstr
end function
'=======================================================================
'函数：Get1Title(classid,orders,key,max,linkStyle,isShowTitle2)
'作用：获得头条新闻标题
'参数：classid     ---类别ID
'      orders        ---按排序
'      key           ---类型，top1<=>头条，totop<=>置顶,tohot<=>热点,recommend<=>推荐,imgnews<=>图文
'      max           ---最大字数
'      linkStyle     ---链接样式
'      例：Get1Title(1,"id","top1",50,"wlink",0)
'=====================================================================
function Get1Title(classid,orders,key,max,linkStyle,isShowTitle2,isChilds)
	dim newsHref,rs,sql,TempArr
	set rs=server.CreateObject("adodb.recordset")  
  	sql="select top 1 title,linkurl,title_color,isoutlink,title2 from news where checked=1"
		if(classid>0) then
			sql=sql&" and classid="&classid
		end if
	Select Case LCase(key)
		Case "top1"
			sql=sql&" and top1=1"
		Case "totop"
			sql=sql&" and totop=1"
		Case "tohot"
			sql=sql&" and tohot=1"
		Case "recommend"
			sql=sql&" and recommend=1"
		Case "imgnews"
			sql=sql&" and imgnews=1"
		Case Else				
	End Select
	if(isChilds>0) then
		sql=sql&" or parentid="&classid
	end if
	sql=sql&" order by "&orders&" desc"
  	set rs=conn.execute(sql)
	if not rs.eof and not rs.bof then
  		TempArr=rs.GetRows()  
  		rs.close
		set rs=nothing 
		newsHref=TempArr(1,0)
		Get1Title=Get1Title&"<a class="&""""&linkStyle&""""&" title="""&TempArr(0,0)&""" href="&""""&newsHref&""""&" target="&""""&"_blank"&""""&">"	
		Get1Title=Get1Title&"<span style=""color: "&TempArr(2,0)&""">"&gotTopic(TempArr(0,0),max)
		Get1Title=Get1Title&"</span></a>"  
		if(isShowTitle2=1) then
			Get1Title=Get1Title&"<br />"
			Get1Title=Get1Title&"<a href="&""""&newsHref&""""&" target="&""""&"_blank"&""""&">"
			Get1Title=Get1Title&TempArr(4,0)
			Get1Title=Get1Title&"</a>"
		end if		
	else
		Get1Title="暂时没有记录"
		rs.close
		set rs=nothing
	end if
end function
'=======================================================================
'函数：Get1Content(classid,orders,key,max,linkStyle)
'作用：获得头条新闻内容
'参数：classid     ---类别ID
'      orders        ---按排序
'      key           ---类型，top1<=>头条，totop<=>置顶,tohot<=>热点,recommend<=>推荐,imgnews<=>图文
'      max           ---最大字数
'      linkStyle     ---链接样式
'      例：Get1Content(1,"id","top1",50,"wlink")
'=====================================================================
function Get1Content(classid,orders,key,max,linkStyle)
	dim newsHref,rs,sql,TempArr
	set rs=server.CreateObject("adodb.recordset")  
  	sql="select top 1 content,linkurl from news where checked=1 and classid="&classid
	Select Case LCase(key)
		Case "top1"
			sql=sql&" and top1=1"
		Case "totop"
			sql=sql&" and totop=1"
		Case "tohot"
			sql=sql&" and tohot=1"
		Case "recommend"
			sql=sql&" and recommend=1"
		Case Else				
	End Select
	sql=sql&" order by "&orders&" desc"
  	set rs=conn.execute(sql)
	if not rs.eof and not rs.bof then
  	TempArr=rs.GetRows()  
  	rs.close
	set rs=nothing   
	Get1Content=Get1Content&"<a class="&""""&linkStyle&""""&" href="&""""&TempArr(1,0)&""""&" target="&""""&"_blank"&""""&">"	
	Get1Content=Get1Content&gotTopic(RemoveHTML(TempArr(0,0)),max)
	Get1Content=Get1Content&"</a>"  
	else
		Get1Content="暂时没有记录"
		rs.close
		set rs=nothing
	end if
end function
'=======================================================================
'函数：Get1Image(classid,orders,key,linkStyle,imgW,imgH)
'作用：获得头条新闻图片
'参数：classid     ---类别ID
'      orders      ---按排序
'      key         ---类型，top1<=>头条，totop<=>置顶,tohot<=>热点,recommend<=>推荐,imgnews<=>图文
'      linkStyle   ---链接样式
'      imgw        ---图片宽度
'      imgh        ---图片高度
'      例：Get1Image(234,"id","","",205,200)注：当imgW或imgH也就是图片的长度或宽度之一被设置为0时刚显示图片自有的长度和高度。
'=====================================================================
function Get1Image(classid,orders,key,linkStyle,imgW,imgH)
	dim newsHref,rs,sql,i,TempArr
	set rs=server.CreateObject("adodb.recordset")  
  	sql="select top 1 photo,linkurl,title_color,isoutlink,title from news where checked=1 and classid="&classid
	Select Case LCase(key)
		Case "top1"
			sql=sql&" and top1=1"
		Case "totop"
			sql=sql&" and totop=1"
		Case "tohot"
			sql=sql&" and tohot=1"
		Case "recommend"
			sql=sql&" and recommend=1"
		Case "imgnews"
			sql=sql&" and imgnews=1"
		Case Else				
	End Select
	sql=sql&" order by "&orders&" desc"
  	set rs=conn.execute(sql)
	if not rs.eof and not rs.bof then
  	TempArr=rs.GetRows()  
  	rs.close
	set rs=nothing 
	dim imginfo
	if(imgW=0 or imgH=0) then
		imginfo=""
	else
		imginfo=" width="&imgW&" height="&imgH
	end if
	newsHref=TempArr(1,0)
	Get1Image=Get1Image&"<a class="&""""&linkStyle&""""&" href="&""""&newsHref&""""&" target="&""""&"_blank"&""""&">"	
	Get1Image=Get1Image&"<img src="&""""&TempArr(0,0)&""""&" ALT="&""""&TempArr(4,0)&""""&imginfo&" border="&""""&"0"&""""&">"
	Get1Image=Get1Image&"</a>"  
	else
		Get1Image="暂时没有记录"
		rs.close
		set rs=nothing
	end if
end function
'=======================================================================
'函数：GetImgNews(tablewidth,lineheight,n,tablename,classid,orders,max,imgW,imgH,linkStyle,key)
'作用：获得N条带图片、标题的新闻，图片在上，文字在下
'参数：tablewidth     ---表格宽度
'      lineheight    ---行高
'      n  	     ---取个数
'      tablename     ---表名
'      classid       ---类别ID
'      orders        ---按排序
'      max           ---最大字数
'      imgH          ---图像高度
'      imgW          ---图像宽度
'      linkStyle     ---链接样式
'	   key		     ---类型，top1<=>头条，totop<=>置顶,tohot<=>热点,recommend<=>推荐,imgnews<=>图文
' 例：GetImgNews(241,"100%",20,2,"news","id",20,100,100,"red","")
'=====================================================================
function GetImgNews(classid,tablewidth,lineheight,n,tablename,orders,max,imgW,imgH,linkStyle,key)
	dim newsHref,rs,sql,TempArr,i
	if(imgW=0 or imgH=0) then
		imgW="100"
		imgH="100"
	end if
	set rs=server.CreateObject("adodb.recordset")
	if(classid=0) then
		sql="select top "&n&" title,linkurl,photo,title_color,isoutlink from "&tablename&" where checked=1"
	else
		sql="select top "&n&" title,linkurl,photo,title_color,isoutlink from "&tablename&" where checked=1 and classid="&classid
	end if  	
	Select Case LCase(key)
		Case "top1"
			sql=sql&" and top1=1"
		Case "totop"
			sql=sql&" and totop=1"
		Case "tohot"
			sql=sql&" and tohot=1"
		Case "recommend"
			sql=sql&" and recommend=1"
		Case "imgnews"
			sql=sql&" and imgnews=1"
		Case Else				
	End Select
	sql=sql&" and photo<>'' order by "&orders&" desc"
  	set rs=conn.execute(sql)
	if not rs.eof and not rs.bof then
  	TempArr=rs.GetRows()  
  	rs.close
	set rs=nothing 
	for i=0 to ubound(TempArr,2)
		newsHref=TempArr(1,i)
		TempLinkTitle=gotTopic(TempArr(0,i),max)
		GetImgNews=GetImgNews&"<table width="""&tablewidth&""" border=""0"" cellspacing=""0"" cellpadding=""0"">"&chr(13)
  GetImgNews=GetImgNews&"<tr>"&chr(13)
    GetImgNews=GetImgNews&"<td><div align=""center"">"&chr(13)
		GetImgNews=GetImgNews&"<a href="&""""&newsHref&""""&" target="&""""&"_blank"&""""&">"
			GetImgNews=GetImgNews&"<img style=""border:1px solid #000000;"" src="""&TempArr(2,i)&""" width="""&imgW&""" height="""&imgH&""" alt="""&TempArr(0,i)&""" border=""0"">"
		GetImgNews=GetImgNews&"</a>"&chr(13)
	GetImgNews=GetImgNews&"</div></td>"&chr(13)
  GetImgNews=GetImgNews&"</tr>"&chr(13)
  GetImgNews=GetImgNews&"<tr>"&chr(13)
    GetImgNews=GetImgNews&"<td height="""&lineheight&"""><div align=""center""><a href="&""""&newsHref&""""&" class="""&linkStyle&""" title="""&TempArr(0,i)&""" target="&""""&"_blank"&""""&"><span style=""color: "&TempArr(3,i)&""">"&TempLinkTitle&"</span></a></div></td>"&chr(13)
  GetImgNews=GetImgNews&"</tr>"&chr(13)
GetImgNews=GetImgNews&"</table>"&chr(13)
	next   
	else
		GetImgNews="暂时没有记录"
		rs.close
		set rs=nothing
	end if
end function
'==============================================================================================================
'函数：GetImgNews2(classid,tablewidth,lineheight,n,tablename,orders,max,imgW,imgH,linkStyle,key)
'作用：获得N条带图片、标题、内容的新闻，图片在左，右上：标题，右下：内容
'参数：tablewidth     ---表格宽度
'      lineheight    ---行高
'      n  	     ---取个数
'      tablename     ---表名
'      classid       ---类别ID
'      orders        ---按排序
'      max           ---最大字数
'      imgH          ---图像高度
'      imgW          ---图像宽度
'      linkStyle     ---链接样式
'	   key		     ---类型，top1<=>头条，totop<=>置顶,tohot<=>热点,recommend<=>推荐,imgnews<=>图文
'	例：GetImgNews2(241,"50%",20,2,"news","id",20,100,100,"red","")
'==============================================================================================================
function GetImgNews2(classid,tablewidth,lineheight,n,tablename,orders,max,imgW,imgH,linkStyle,key)
	dim newsHref,rs,sql,TempArr,i
	if(imgW=0 or imgH=0) then
		imgW="100"
		imgH="100"
	end if
	set rs=server.CreateObject("adodb.recordset")  
  	if(classid=0) then
		sql="select top "&n&" title,linkurl,photo,content,title_color,isoutlink from "&tablename&" where checked=1"
	else
		sql="select top "&n&" title,linkurl,photo,content,title_color,isoutlink from "&tablename&" where checked=1 and classid="&classid
	end if
	Select Case LCase(key)
		Case "top1"
			sql=sql&" and top1=1"
		Case "totop"
			sql=sql&" and totop=1"
		Case "tohot"
			sql=sql&" and tohot=1"
		Case "recommend"
			sql=sql&" and recommend=1"
		Case "imgnews"
			sql=sql&" and imgnews=1"
		Case Else				
	End Select
	sql=sql&" and photo<>'' order by "&orders&" desc"
  	set rs=conn.execute(sql)
	if not rs.eof and not rs.bof then
  	TempArr=rs.GetRows()  
  	rs.close
	set rs=nothing 
	for i=0 to ubound(TempArr,2)
		newsHref=TempArr(1,0)
		GetImgNews2=GetImgNews2&"<table width="""&tablewidth&""" border=""0"" cellpadding=""0"" cellspacing=""0"">"&chr(13)
  GetImgNews2=GetImgNews2&"<tr>"&chr(13)
    GetImgNews2=GetImgNews2&"<td width=""40%""><div align=""center"">"&chr(13)
		GetImgNews2=GetImgNews2&"<a href="&""""&newsHref&""""&" target="&""""&"_blank"&""""&">"
			GetImgNews2=GetImgNews2&"<img src="""&TempArr(2,i)&""" width="""&imgW&""" height="""&imgH&""" border=""0"" alt="""&TempArr(0,i)&""">"
		GetImgNews2=GetImgNews2&"</a>"&chr(13)
	GetImgNews2=GetImgNews2&"</div></td>"&chr(13)
  GetImgNews2=GetImgNews2&"<td align=""left"" valign=""middle"" width=""60%"" height="""&lineheight&""" valign=""top""><strong><a href="&""""&newsHref&""""&" class="""&linkStyel&""" title="""&TempArr(0,i)&""" target="&""""&"_blank"&""""&"><span style=""color: "&TempArr(4,i)&""">"&gotTopic(TempArr(0,i),max)&"</span></a></strong><br>"&chr(13)
  GetImgNews2=GetImgNews2&"<br>"&gotTopic(RemoveHTML(TempArr(3,i)),max*2)&"<br><a href="""&newsHref&""">详细&gt;&gt;</a>"&chr(13)
    GetImgNews2=GetImgNews2&"</td>"&chr(13)
  GetImgNews2=GetImgNews2&"</tr>"&chr(13)
GetImgNews2=GetImgNews2&"</table>"&chr(13)
	next   
	else
		GetImgNews2="暂时没有记录"
		rs.close
		set rs=nothing
	end if
end function

function GetImgNewsDescLi(classid,n,tablename,orders,max,descMax,imgW,imgH,linkStyle,key,isdetail)
	dim newsHref,rs,sql,TempArr,i
	if(imgW=0 or imgH=0) then
		imgW="100"
		imgH="100"
	end if
	set rs=server.CreateObject("adodb.recordset")  
  	if(classid=0) then
		sql="select top "&n&" title,linkurl,photo,content,title_color,isoutlink from "&tablename&" where checked=1"
	else
		sql="select top "&n&" title,linkurl,photo,content,title_color,isoutlink from "&tablename&" where checked=1 and classid="&classid
	end if
	Select Case LCase(key)
		Case "top1"
			sql=sql&" and top1=1"
		Case "totop"
			sql=sql&" and totop=1"
		Case "tohot"
			sql=sql&" and tohot=1"
		Case "recommend"
			sql=sql&" and recommend=1"
		Case "imgnews"
			sql=sql&" and imgnews=1"
		Case Else				
	End Select
	sql=sql&" and photo<>'' order by "&orders&" desc"
  	set rs=conn.execute(sql)
	if not rs.eof and not rs.bof then
  	TempArr=rs.GetRows()  
  	rs.close
	set rs=nothing 
	for i=0 to ubound(TempArr,2)
		newsHref=TempArr(1,i)		
  		GetImgNewsDescLi=GetImgNewsDescLi&"<dl>"&chr(13)
		GetImgNewsDescLi=GetImgNewsDescLi&"<dt><a href="&""""&newsHref&""""&" target="&""""&"_blank"&""""&">"
		GetImgNewsDescLi=GetImgNewsDescLi&"<img src="""&TempArr(2,i)&""" width="""&imgW&""" height="""&imgH&""" border=""0"">"
		GetImgNewsDescLi=GetImgNewsDescLi&"</a></dt>"&chr(13)
  		GetImgNewsDescLi=GetImgNewsDescLi&"<dd><h2><a href="&""""&newsHref&""""&" class="""&linkStyel&""" title="""&TempArr(0,i)&""" target="&""""&"_blank"&""""&"><span style=""color: "&TempArr(4,i)&""">"&gotTopic(TempArr(0,i),max)&"</span></a>"&chr(13)
  		GetImgNewsDescLi=GetImgNewsDescLi&"</h2>"&gotTopic(RemoveHTML(TempArr(3,i)),descMax)
		if(isdetail=1) then
			GetImgNewsDescLi=GetImgNewsDescLi&"<a href="""&newsHref&""">[详细]</a>"
		end if
		GetImgNewsDescLi=GetImgNewsDescLi&"</dd>"&chr(13)    
  		GetImgNewsDescLi=GetImgNewsDescLi&"</dl>"&chr(13)
	next   
	else
		GetImgNewsDescLi="暂时没有记录"
		rs.close
		set rs=nothing
	end if
end function

'=======================================================================
'函数：GetImgNews3(classid,tablewidth,lineheight,n,tablename,orders,max,imgW,imgH,linkStyle,key)
'作用：获得N条带图片、标题的新闻，图片在上，文字在下(repeat by td)
'参数：tablewidth     ---表格宽度
'      lineheight    ---行高
'      n  	     ---取个数
'      tablename     ---表名
'      classid       ---类别ID
'      orders        ---按排序
'      max           ---最大字数
'      imgH          ---图像高度
'      imgW          ---图像宽度
'      linkStyle     ---链接样式
'	   key		     ---类型，top1<=>头条，totop<=>置顶,tohot<=>热点,recommend<=>推荐,imgnews<=>图文
' 例：GetImgNews3(241,"100%",20,2,"news","id",20,100,100,"red","")
'=====================================================================
function GetImgNews3(classid,tablewidth,lineheight,n,tablename,orders,max,imgW,imgH,linkStyle,key)
	dim newsHref,rs,sql,TempArr
	if(imgW=0 or imgH=0) then
		imgW="100"
		imgH="100"
	end if
	set rs=server.CreateObject("adodb.recordset")
	if(classid=0) then
  		sql="select top "&n&" title,linkurl,photo,title_color,isoutlink from "&tablename&" where checked=1"
	else
		sql="select top "&n&" title,linkurl,photo,title_color,isoutlink from "&tablename&" where checked=1 and classid="&classid
	end if
	Select Case LCase(key)
		Case "top1"
			sql=sql&" and top1=1"
		Case "totop"
			sql=sql&" and totop=1"
		Case "tohot"
			sql=sql&" and tohot=1"
		Case "recommend"
			sql=sql&" and recommend=1"
		Case "imgnews"
			sql=sql&" and imgnews=1"
		Case Else				
	End Select
	sql=sql&" and photo<>'' order by "&orders&" desc"
  	set rs=conn.execute(sql)
	if not rs.eof and not rs.bof then
  	TempArr=rs.GetRows()
	
  	rs.close
	set rs=nothing 
	GetImgNews3=GetImgNews3&"<table width="""&tablewidth&""" border=""0"" cellspacing=""0"" cellpadding=""1"">"&chr(13)
	GetImgNews3=GetImgNews3&"<tr>"&chr(13)
	for i=0 to ubound(TempArr,2)
    	newsHref=TempArr(1,i)
		GetImgNews3=GetImgNews3&"<td align=""center""><div align=""center"">"&chr(13)
		GetImgNews3=GetImgNews3&"<a href="&""""&newsHref&""""&" target="&""""&"_blank"&""""&">"
			GetImgNews3=GetImgNews3&"<img src="""&TempArr(2,i)&""" width="""&imgW&""" height="""&imgH&""" border=""0"" alt="""&TempArr(0,i)&""">"
		GetImgNews3=GetImgNews3&"</a>"&chr(13)
	GetImgNews3=GetImgNews3&"</div><div style=""line-height:"&lineheight&"px"">"&chr(13)
  GetImgNews3=GetImgNews3&"<a href="&""""&newsHref&""""&" title="""&TempArr(0,i)&""" class="""&linkStyle&""" target="&""""&"_blank"&""""&"><span style=""color: "&TempArr(3,i)&""">"&gotTopic(TempArr(0,i),max)&"</span></a>"&chr(13)
  GetImgNews3=GetImgNews3&"</div></td>"&chr(13)
 	next 
 	GetImgNews3=GetImgNews3&"</tr>"&chr(13)
	GetImgNews3=GetImgNews3&"</table>"&chr(13)
	else
		GetImgNews3="暂时没有记录"
		rs.close
		set rs=nothing
	end if
end function

function GetImgNewsLi(classid,istitle,n,tablename,orders,max,imgW,imgH,linkStyle,key)
	dim newsHref,rs,sql,TempArr
	if(imgW=0 or imgH=0) then
		imgW="100"
		imgH="100"
	end if
	set rs=server.CreateObject("adodb.recordset")
	sql="select top "&n&" title,linkurl,photo,title_color,isoutlink from "&tablename&" where checked=1"
	if(classid>0) then
  	sql=sql&" and classid="&classid
	end if
	Select Case LCase(key)
		Case "top1"
			sql=sql&" and top1=1"
		Case "totop"
			sql=sql&" and totop=1"
		Case "tohot"
			sql=sql&" and tohot=1"
		Case "recommend"
			sql=sql&" and recommend=1"
		Case "imgnews"
			sql=sql&" and imgnews=1"
		Case Else				
	End Select
	sql=sql&" and photo<>'' order by "&orders&" desc"
  set rs=conn.execute(sql)
	if not rs.eof then
  	TempArr=rs.GetRows()
	end if
  rs.close
	set rs=nothing
	if isarray(TempArr) then
		for i=0 to ubound(TempArr,2)
				newsHref=TempArr(1,i)
			GetImgNewsLi=GetImgNewsLi&"<li>"&chr(13)
			GetImgNewsLi=GetImgNewsLi&"<a href="&""""&newsHref&""""&" target="&""""&"_blank"&""""&">"
				GetImgNewsLi=GetImgNewsLi&"<img src="""&TempArr(2,i)&""" width="""&imgW&""" height="""&imgH&""" border=""0"" alt="""&TempArr(0,i)&""">"
			GetImgNewsLi=GetImgNewsLi&"</a>"&chr(13)
			if(istitle=1) then
					GetImgNewsLi=GetImgNewsLi&"<h6><a href="&""""&newsHref&""""&" class="""&linkStyle&""" title="""&TempArr(0,i)&""" target="&""""&"_blank"&""""&"><span style=""color: "&TempArr(3,i)&""">"&gotTopic(TempArr(0,i),max)&"</span></a></h6>"&chr(13)
			end if
				GetImgNewsLi=GetImgNewsLi&"</li>"&chr(13)
		next	
	else
		GetImgNewsLi="暂时没有记录"
	end if
end function

'=======================================================================
'函数：GetMultiTxtNews(classid,lineheight,n,tablename,orders,max,linkStyle,key)
'作用：获得N条带图片、标题的新闻，图片在上，文字在下(repeat by td)
'参数：containwidth  ---容器宽度
'      lineheight    ---行高
'      n  	     ---取个数
'      tablename     ---表名
'      classid       ---类别ID
'      orders        ---按排序
'      max           ---最大字数
'      imgH          ---图像高度
'      imgW          ---图像宽度
'      linkStyle     ---链接样式
'	   key		     ---类型，top1<=>头条，totop<=>置顶,tohot<=>热点,recommend<=>推荐,imgnews<=>图文
' 例：GetImgNews3(241,"100%",20,2,"news","id",20,100,100,"red","")
'=====================================================================
function GetMultiTxtNews(classid,tablewidth,lineheight,tdStyle,tablename,orders,titlePrefix,max,linkStyle,key,rowsNum,colsNum,isTime,isCatalog,catalogLinkStyle)
	dim newsHref,mulRowsCount,rs,n,sql,TempArr,rows,cols
	set rs=server.CreateObject("adodb.recordset")  
	n=rowsNum*colsNum
	if(classid=0) then
  		sql="select top "&n&" news.title as ntitle,news.linkurl,news.moditime AS mtime,catalogs.title as ctitle,catalogs.domainurl,news.title_color,news.isoutlink,catalogs.flag from "&tablename&",catalogs where news.checked=1 and news.classid=catalogs.id"
	else		
		sql="select top "&n&" news.title as ntitle,news.linkurl,news.moditime AS mtime,catalogs.title as ctitle,catalogs.domainurl,news.title_color,news.isoutlink,catalogs.flag from "&tablename&",catalogs where news.checked=1 and news.classid=catalogs.id and (news.parentid="&classid&" or news.classid="&classid&")"
	end if
  	'sql="select top "&n&" title,linkurl,title_color,isoutlink from "&tablename&" where checked=1 and classid="&classid
	Select Case LCase(key)
		Case "top1"
			sql=sql&" and news.top1=1"
		Case "totop"
			sql=sql&" and news.totop=1"
		Case "tohot"
			sql=sql&" and news.tohot=1"
		Case "recommend"
			sql=sql&" and news.recommend=1"
		Case "imgnews"
			sql=sql&" and news.imgnews=1"
		Case Else				
	End Select
	sql=sql&" order by news."&orders&" desc"	
  	set rs=conn.execute(sql)
	if not rs.eof and not rs.bof then
  		TempArr=rs.GetRows()	
  		rs.close
		set rs=nothing 
		TempImgNesCount=ubound(TempArr,2)	
		mulRowsCount=(ubound(TempArr,2)+colsNum-1)/colsNum
		if(mulRowsCount>rowsNum-1) then
			mulRowsCount=rowsNum-1
		end if
		''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
		GetMultiTxtNews=GetMultiTxtNews&"<table width="&tablewidth&"  border=0 align=center cellpadding=0 cellspacing=0>"&Chr(13)
		for rows=0 to mulRowsCount'rowsNum行
			
			GetMultiTxtNews=GetMultiTxtNews&"<tr>"&Chr(13)
			for cols=0 to colsNum-1'colsNum列
				if (rows*colsNum+cols>TempImgNesCount) then
		  			exit for
		  		end if
				newsHref=TempArr(1,(rows*colsNum)+cols)
				GetMultiTxtNews=GetMultiTxtNews&"<td class="""&tdStyle&""" height="&""""&lineheight&""""&">"&Chr(13)				
        		GetMultiTxtNews=GetMultiTxtNews&"<div align=""left"">"&titlePrefix&Chr(13)
				if(Cint(isCatalog=1)) then
					GetMultiTxtNews=GetMultiTxtNews&"<a href="&""""&TempArr(4,(rows*colsNum)+cols)&"/"
					if(Cint(TempArr(7,(rows*colsNum)+cols))=0) then
						GetMultiTxtNews=GetMultiTxtNews&"index_1.htm"
					end if
					GetMultiTxtNews=GetMultiTxtNews&""""&" class="""&catalogLinkStyle&""" target="&""""&"_blank"&""""&">["&TempArr(3,(rows*colsNum)+cols)&"]</a>"&chr(13)
				end if
				GetMultiTxtNews=GetMultiTxtNews&"<a href="&""""&newsHref&""""&" class="""&linkStyle&""" title="""&TempArr(0,rows*colsNum+cols)&""" target="&""""&"_blank"&""""&">"&Chr(13)
				GetMultiTxtNews=GetMultiTxtNews&"<span style=""color: "&TempArr(5,rows*colsNum+cols)&""">"&gotTopic(TempArr(0,rows*colsNum+cols),max)&"</span>"&Chr(13)
				GetMultiTxtNews=GetMultiTxtNews&"</a></div></td>"&Chr(13)  
				if(Cint(isTime=1)) then
				GetMultiTxtNews=GetMultiTxtNews&"<td class="""&tdStyle&""" width=""10%""><div align=""center"" style=""color: #999999""><div align=""center"">"&month(TempArr(2,rows*colsNum+cols))&"-"&day(TempArr(2,rows*colsNum+cols))&"</div></div></td>"
			end if   			
			next
			GetMultiTxtNews=GetMultiTxtNews&"</tr>"&Chr(13)				
			
		next
		GetMultiTxtNews=GetMultiTxtNews&"</table>"&Chr(13)	
		''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''		
	else
		GetMultiTxtNews="没有记录"
		rs.close
		set rs=nothing
	end if
end function
'=======================================================================
'函数：GetMultiImgNews(classid,containwidth,lineheight,n,tablename,orders,max,imgW,imgH,linkStyle,key)
'作用：获得N条带图片、标题的新闻，图片在上，文字在下(repeat by td)
'参数：containwidth  ---容器宽度
'      lineheight    ---行高
'      n  	     ---取个数
'      tablename     ---表名
'      classid       ---类别ID
'      orders        ---按排序
'      max           ---最大字数
'      imgH          ---图像高度
'      imgW          ---图像宽度
'      linkStyle     ---链接样式
'	   key		     ---类型，top1<=>头条，totop<=>置顶,tohot<=>热点,recommend<=>推荐,imgnews<=>图文
' 例：GetImgNews3(241,"100%",20,2,"news","id",20,100,100,"red","")
'=====================================================================
function GetMultiImgNews(classid,containwidth,lineheight,imgBorderW,imgBorderH,tablename,orders,max,imgW,imgH,linkStyle,key,rowsNum,colsNum,ifChilds)
	dim newsHref,sql,rs,TempArr
	if(imgW=0 or imgH=0) then
		imgW="100"
		imgH="100"
	end if
	set rs=server.CreateObject("adodb.recordset")  
	n=rowsNum*colsNum
	'response.Write(n)
  	sql="select top "&n&" title,linkurl,photo,title_color,isoutlink from "&tablename&" where checked=1 and classid="&classid
	Select Case LCase(key)
		Case "top1"
			sql=sql&" and top1=1"
		Case "totop"
			sql=sql&" and totop=1"
		Case "tohot"
			sql=sql&" and tohot=1"
		Case "recommend"
			sql=sql&" and recommend=1"
		Case "imgnews"
			sql=sql&" and imgnews=1"
		Case Else				
	End Select
	if(ifChilds=1) then
		sql=sql&" or parentid="&classid
	end if
	sql=sql&" and photo<>'' order by "&orders&" desc"
  	set rs=conn.execute(sql)
	if not rs.eof and not rs.bof then
  		TempArr=rs.GetRows()	
  		rs.close
		set rs=nothing 
		TempImgNesCount=ubound(TempArr,2)		
		''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
		GetMultiImgNews=GetMultiImgNews&"<table width="&containwidth&"  border=0 align=center cellpadding=0 cellspacing=0>"&Chr(13)
		for rows=0 to rowsNum-1'rowsNum行
		
			GetMultiImgNews=GetMultiImgNews&"<tr>"&Chr(13)
			for cols=0 to colsNum-1'colsNum列
				if (rows*colsNum+cols>TempImgNesCount) then
		  			exit for
		  		end if
				newsHref=TempArr(1,(rows*colsNum)+cols)
				GetMultiImgNews=GetMultiImgNews&"<td height="&""""&imgBorderW&""""&"><table width="&""""&imgBorderW&""""&" height="&""""&imgBorderH&""""&" border="&""""&"0"&""""&" align="&""""&"center"&""""&" cellpadding="&""""&"0"&""""&" cellspacing="&""""&"0"&""""&" style="&""""&"border:1px solid #BBBBBB; "&""""&">"&Chr(13)
				GetMultiImgNews=GetMultiImgNews&"<tr>"&Chr(13)
          		GetMultiImgNews=GetMultiImgNews&"<td style="&""""&"line-height:"&lineheight&";"&""""&"><div align=center><a href="&""""&newsHref&""""&" target="&""""&"_blank"&""""&"><img width="&""""&imgW&""""&" height="&""""&imgH&""""&" src="&""""&TempArr(2,rows*colsNum+cols)&""""&" alt="""&TempArr(0,rows*colsNum+cols)&""" border="&""""&"0"&""""&"></a></div></td>"&Chr(13)
        		GetMultiImgNews=GetMultiImgNews&"</tr>"&Chr(13)
      			GetMultiImgNews=GetMultiImgNews&"</table>"&Chr(13)
        		GetMultiImgNews=GetMultiImgNews&"<div style="&""""&"padding:5px;"&""""&" align="&""""&"center"&""""&"><a href="&""""&newsHref&""""&" title="""&TempArr(0,rows*colsNum+cols)&""" class="""&linkStyle&""" target="&""""&"_blank"&""""&"><span style=""color: "&TempArr(3,rows*colsNum+cols)&""">"&gotTopic(TempArr(0,rows*colsNum+cols),max)&"</span></a></div></td>"&Chr(13)
     			
			next
			GetMultiImgNews=GetMultiImgNews&"</tr>"&Chr(13)				
			
		next
		GetMultiImgNews=GetMultiImgNews&"</table>"&Chr(13)	
		''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''		
	else
		GetMultiImgNews="没有记录"
		rs.close
		set rs=nothing
	end if
end function

'=======================================================================
'函数：GetSpecialNews(specialid,lineheight,n,tablename,orders,max,linkStyle,key)
'作用：获取专题新闻(多行多列)
'参数：containwidth  ---容器宽度
'      lineheight    ---行高
'      n  	     ---取个数
'      tablename     ---表名
'      specialid       ---专题ID
'      orders        ---按排序
'      max           ---最大字数
'      imgH          ---图像高度
'      imgW          ---图像宽度
'      linkStyle     ---链接样式
'	   key		     ---类型，top1<=>头条，totop<=>置顶,tohot<=>热点,recommend<=>推荐,imgnews<=>图文
' 例：GetImgNews3(241,"100%",20,2,"news","id",20,100,100,"red","")
'=====================================================================
function GetSpecialNews(specialid,tablewidth,lineheight,tdStyle,tablename,orders,titlePrefix,max,linkStyle,key,rowsNum,colsNum,isTime,isCatalog,catalogLinkStyle)
	dim newsHref,mulRowsCount,rs,n,sql,TempArr,rows,cols
	set rs=server.CreateObject("adodb.recordset")  
	n=rowsNum*colsNum
	if(specialid=0) then
  		sql="select top "&n&" news.title as ntitle,news.linkurl,news.moditime AS mtime,catalogs.title s ctitle,catalogs.domainurl,news.title_color,news.isoutlink,catalogs.flag from "&tablename&",catalogs where news.checked=1 and news.classid = catalogs.id"
	else		
		sql="select top "&n&" news.title as ntitle,news.linkurl,news.moditime AS mtime,catalogs.title as ctitle,catalogs.domainurl,news.title_color,news.isoutlink,catalogs.flag from "&tablename&",catalogs where news.checked=1 and news.classid = catalogs.id and news.specialid="&specialid
	end if
  	'sql="select top "&n&" title,linkurl,title_color,isoutlink from "&tablename&" where checked=1 and specialid="&specialid
	Select Case LCase(key)
		Case "top1"
			sql=sql&" and news.top1=1"
		Case "totop"
			sql=sql&" and news.totop=1"
		Case "tohot"
			sql=sql&" and news.tohot=1"
		Case "recommend"
			sql=sql&" and news.recommend=1"
		Case "imgnews"
			sql=sql&" and news.imgnews=1"
		Case Else				
	End Select
	sql=sql&" order by news."&orders&" desc"	
  	set rs=conn.execute(sql)
	if not rs.eof and not rs.bof then
  		TempArr=rs.GetRows()	
  		rs.close
		set rs=nothing 
		TempImgNesCount=ubound(TempArr,2)	
		mulRowsCount=(ubound(TempArr,2)+colsNum-1)/colsNum
		if(mulRowsCount>rowsNum-1) then
			mulRowsCount=rowsNum-1
		end if
		''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
		GetSpecialNews=GetSpecialNews&"<table width="&tablewidth&"  border=0 align=center cellpadding=0 cellspacing=0>"&Chr(13)
		for rows=0 to mulRowsCount'rowsNum行
			
			GetSpecialNews=GetSpecialNews&"<tr>"&Chr(13)
			for cols=0 to colsNum-1'colsNum列
				if (rows*colsNum+cols>TempImgNesCount) then
		  			exit for
		  		end if
				newsHref=TempArr(1,(rows*colsNum)+cols)
				GetSpecialNews=GetSpecialNews&"<td class="""&tdStyle&""" height="&""""&lineheight&""""&">"&Chr(13)				
        		GetSpecialNews=GetSpecialNews&"<div align=""left"">"&titlePrefix&Chr(13)
				if(Cint(isCatalog=1)) then
					GetSpecialNews=GetSpecialNews&"<a href="&""""&TempArr(4,(rows*colsNum)+cols)&"/"
					if(Cint(TempArr(7,(rows*colsNum)+cols))=0) then
						GetSpecialNews=GetSpecialNews&"index_1.htm"
					end if
					GetSpecialNews=GetSpecialNews&""""&" class="""&catalogLinkStyle&""" target="&""""&"_blank"&""""&">["&TempArr(3,(rows*colsNum)+cols)&"]</a>"&chr(13)
				end if
			GetSpecialNews=GetSpecialNews&"<a href="&""""&newsHref&""""&" class="""&linkStyle&""" title="""&TempArr(0,rows*colsNum+cols)&""" target="&""""&"_blank"&""""&">"&Chr(13)
				GetSpecialNews=GetSpecialNews&"<span style=""color: "&TempArr(5,rows*colsNum+cols)&""">"&gotTopic(TempArr(0,rows*colsNum+cols),max)&"</span>"&Chr(13)
				GetSpecialNews=GetSpecialNews&"</a></div></td>"&Chr(13)  
				if(Cint(isTime=1)) then
				GetSpecialNews=GetSpecialNews&"<td class="""&tdStyle&""" width=""10%""><div align=""center"" style=""color: #999999""><div align=""center"">"&month(TempArr(2,rows*colsNum+cols))&"-"&day(TempArr(2,rows*colsNum+cols))&"</div></div></td>"
			end if   			
			next
			GetSpecialNews=GetSpecialNews&"</tr>"&Chr(13)				
			
		next
		GetSpecialNews=GetSpecialNews&"</table>"&Chr(13)	
		''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''		
	else
		GetSpecialNews="没有记录"
		rs.close
		set rs=nothing
	end if
end function

'文本扩展标签
function e_GetMultiTxtNews(classid,tablewidth,lineheight,tdStyle,tablename,orders,titlePrefix,max,linkStyle,rowsNum,colsNum,isTime,isCatalog,catalogLinkStyle,k_top1,k_totop,k_tohot,k_recommend,k_imgnews)
	dim newsHref,mulRowsCount,rs,n,sql,TempArr,rows,cols
	set rs=server.CreateObject("adodb.recordset")  
	n=rowsNum*colsNum
	sql="select top "&n&" news.title as ntitle,news.linkurl,news.moditime AS mtime,catalogs.title as ctitle,catalogs.domainurl,news.title_color,news.isoutlink,catalogs.flag from "&tablename&",catalogs where news.checked=1 and news.classid=catalogs.id"
	if(classid>0) then
  		sql=sql&" and news.classid="&classid
	end if

	if(k_top1="true") then		
		sql=sql&" and news.top1=1"
	end if
	if(k_totop="true") then
		sql=sql&" and news.totop=1"
	end if
	if(k_tohot="true") then
		sql=sql&" and news.tohot=1"
	end if
	if(k_recommend="true") then
		sql=sql&" and news.recommend=1"
	end if
	if(k_imgnews="true") then
		sql=sql&" and news.imgnews=1"
	end if
	sql=sql&" order by news."&orders&" desc"	
  	set rs=conn.execute(sql)
	if not rs.eof and not rs.bof then
  		TempArr=rs.GetRows()	
  		rs.close
		set rs=nothing 
		TempImgNesCount=ubound(TempArr,2)	
		mulRowsCount=(ubound(TempArr,2)+colsNum-1)/colsNum
		if(mulRowsCount>rowsNum-1) then
			mulRowsCount=rowsNum-1
		end if
		''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
		e_GetMultiTxtNews=e_GetMultiTxtNews&"<table width="&tablewidth&"  border=0 align=center cellpadding=0 cellspacing=0>"&Chr(13)
		for rows=0 to mulRowsCount'rowsNum行
			
			e_GetMultiTxtNews=e_GetMultiTxtNews&"<tr>"&Chr(13)
			for cols=0 to colsNum-1'colsNum列
				if (rows*colsNum+cols>TempImgNesCount) then
		  			exit for
		  		end if
				newsHref=TempArr(1,(rows*colsNum)+cols)
				e_GetMultiTxtNews=e_GetMultiTxtNews&"<td class="""&tdStyle&""" height="&""""&lineheight&""""&">"&Chr(13)				
        		e_GetMultiTxtNews=e_GetMultiTxtNews&"<div align=""left"">"&titlePrefix&Chr(13)
				if(Cint(isCatalog=1)) then
					e_GetMultiTxtNews=e_GetMultiTxtNews&"<a href="&""""&TempArr(4,(rows*colsNum)+cols)&"/"
					if(Cint(TempArr(7,(rows*colsNum)+cols))=0) then
						e_GetMultiTxtNews=e_GetMultiTxtNews&"index_1.htm"
					end if
					e_GetMultiTxtNews=e_GetMultiTxtNews&""""&" class="""&catalogLinkStyle&""" target="&""""&"_blank"&""""&">["&TempArr(3,(rows*colsNum)+cols)&"]</a>"&chr(13)
				end if
				e_GetMultiTxtNews=e_GetMultiTxtNews&"<a href="&""""&newsHref&""""&" class="""&linkStyle&""" title="""&TempArr(0,rows*colsNum+cols)&""" target="&""""&"_blank"&""""&">"&Chr(13)
				e_GetMultiTxtNews=e_GetMultiTxtNews&"<span style=""color: "&TempArr(5,rows*colsNum+cols)&""">"&gotTopic(TempArr(0,rows*colsNum+cols),max)&"</span>"&Chr(13)
				e_GetMultiTxtNews=e_GetMultiTxtNews&"</a></div></td>"&Chr(13)  
				if(Cint(isTime=1)) then
				e_GetMultiTxtNews=e_GetMultiTxtNews&"<td class="""&tdStyle&""" width=""10%""><div align=""center"" style=""color: #999999""><div align=""center"">"&month(TempArr(2,rows*colsNum+cols))&"-"&day(TempArr(2,rows*colsNum+cols))&"</div></div></td>"
			end if   			
			next
			e_GetMultiTxtNews=e_GetMultiTxtNews&"</tr>"&Chr(13)				
			
		next
		e_GetMultiTxtNews=e_GetMultiTxtNews&"</table>"&Chr(13)	
		''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''		
	else
		e_GetMultiTxtNews="没有记录"
		rs.close
		set rs=nothing
	end if
end function

'图文扩展标签
function e_GetMultiImgNews(classid,containwidth,lineheight,imgBorderW,imgBorderH,tablename,orders,max,imgW,imgH,linkStyle,rowsNum,colsNum,ifChilds,k_top1,k_totop,k_tohot,k_recommend,k_imgnews)
	dim newsHref,sql,rs,TempArr
	if(imgW=0 or imgH=0) then
		imgW="100"
		imgH="100"
	end if
	set rs=server.CreateObject("adodb.recordset")  
	n=rowsNum*colsNum
	'response.Write(n)
  	sql="select top "&n&" title,linkurl,photo,title_color,isoutlink from "&tablename&" where checked=1"
	if(classid>0) then
		sql=sql&" and (classid="&classid
		if(ifChilds=1) then
			sql=sql&" or parentid="&classid
		end if
		sql=sql&")"
	end if
	if(k_top1="true") then		
		sql=sql&" and news.top1=1"
	end if
	if(k_totop="true") then
		sql=sql&" and news.totop=1"
	end if
	if(k_tohot="true") then
		sql=sql&" and news.tohot=1"
	end if
	if(k_recommend="true") then
		sql=sql&" and news.recommend=1"
	end if
	if(k_imgnews="true") then
		sql=sql&" and news.imgnews=1"
	end if
	
	sql=sql&" and photo<>'' order by "&orders&" desc"	
  	set rs=conn.execute(sql)
	if not rs.eof and not rs.bof then
  		TempArr=rs.GetRows()	
  		rs.close
		set rs=nothing 
		TempImgNesCount=ubound(TempArr,2)		
		''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
		e_GetMultiImgNews=e_GetMultiImgNews&"<table width="&containwidth&"  border=0 align=center cellpadding=0 cellspacing=0>"&Chr(13)
		for rows=0 to rowsNum-1'rowsNum行
		
			e_GetMultiImgNews=e_GetMultiImgNews&"<tr>"&Chr(13)
			for cols=0 to colsNum-1'colsNum列
				if (rows*colsNum+cols>TempImgNesCount) then
		  			exit for
		  		end if
				newsHref=TempArr(1,(rows*colsNum)+cols)
				e_GetMultiImgNews=e_GetMultiImgNews&"<td height="&""""&imgBorderW&""""&"><table width="&""""&imgBorderW&""""&" height="&""""&imgBorderH&""""&" border="&""""&"0"&""""&" align="&""""&"center"&""""&" cellpadding="&""""&"0"&""""&" cellspacing="&""""&"0"&""""&" style="&""""&"border:1px solid #BBBBBB; "&""""&">"&Chr(13)
				e_GetMultiImgNews=e_GetMultiImgNews&"<tr>"&Chr(13)
          		e_GetMultiImgNews=e_GetMultiImgNews&"<td style="&""""&"line-height:"&lineheight&";"&""""&"><div align=center><a href="&""""&newsHref&""""&" target="&""""&"_blank"&""""&"><img width="&""""&imgW&""""&" height="&""""&imgH&""""&" src="&""""&TempArr(2,rows*colsNum+cols)&""""&" alt="""&TempArr(0,rows*colsNum+cols)&""" border="&""""&"0"&""""&"></a></div></td>"&Chr(13)
        		e_GetMultiImgNews=e_GetMultiImgNews&"</tr>"&Chr(13)
      			e_GetMultiImgNews=e_GetMultiImgNews&"</table>"&Chr(13)
        		e_GetMultiImgNews=e_GetMultiImgNews&"<div style="&""""&"padding:5px;"&""""&" align="&""""&"center"&""""&"><a href="&""""&newsHref&""""&" title="""&TempArr(0,rows*colsNum+cols)&""" class="""&linkStyle&""" target="&""""&"_blank"&""""&"><span style=""color: "&TempArr(3,rows*colsNum+cols)&""">"&gotTopic(TempArr(0,rows*colsNum+cols),max)&"</span></a></div></td>"&Chr(13)
     			
			next
			e_GetMultiImgNews=e_GetMultiImgNews&"</tr>"&Chr(13)				
			
		next
		e_GetMultiImgNews=e_GetMultiImgNews&"</table>"&Chr(13)	
		''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''		
	else
		e_GetMultiImgNews="没有记录"
		rs.close
		set rs=nothing
	end if
end function
'====================================================================
'函数：getSpecialSelect(classid)
'作用：获得某个专题的所有子类
'参数：id 	---专题ID
'例：getSpecialSelect(32)
'===================================================================
function getSpecialSelect(classid)
dim ifselect,rs,sql
sql="select id,title from t_special order by id desc"
Set rs = conn.Execute(sql)
if rs.eof or rs.bof then
	getSpecialSelect="<option value=""0"">暂时没有专题</option>"&Chr(13)
else
	'getSpecialSelect="<option value=""0"">不属任何专题</option>"&Chr(13)
	while not rs.eof and not rs.bof
		if(Cint(rs("id"))=Cint(classid)) then
			ifselect=" selected"
		else
			ifselect=""
		end if
		getSpecialSelect=getSpecialSelect&"<option value="""&rs("id")&""" "&ifselect&">"&rs("title")&"</option>"&Chr(13)
		rs.movenext
	wend
end if
rs.close
set rs=nothing
end function
'====================================================================
'函数：getchildlist(id)
'作用：获得某个类的所有子类
'参数：id 	---类别ID
'linkStyle  ---链接样式
'例：arr=getchildlist(32,"|","")
'===================================================================
function getchildlist(id,str,linkStyle)
dim childList,rs,i,sql,sperateStr,retstr
sql="select domainurl,title,flag from catalogs where parentid="&id&" order by sortid asc"
Set rs = conn.Execute(Sql)
while not rs.eof
	if(Cint(rs(2))=1) then
		retstr=retstr&"<li>"&str&"<a  href="""&rs(0)&""">"&rs(1)&"</a></li>"
	else
		retstr=retstr&"<li>"&str&"<a href="""&rs(0)&"/index_1.htm"">"&rs(1)&"</a></li>"
	end if
	rs.movenext
wend
	rs.close
	set rs=nothing
	getchildlist=retstr
end function
function getCategoryChilds(id,str,linkStyle,nums,orderby)
	dim childList,rs,i,sql,sperateStr
	sql="select domainurl,title,flag from catalogs where parentid="&id
	select case orderby
		case 1
			sql=sql&" order by sortid asc"
		case 2
			sql=sql&" order by sortid desc"
		case 3
			sql=sql&" order by id asc"
		case 4
			sql=sql&" order by id desc"
	end select
	Set rs = conn.Execute(Sql)
	if not rs.eof and not rs.bof then
		childList=rs.GetRows()
		for i=0 to ubound(childList,2)
			if(i<>0) then
				sperateStr=str
			end if
			if(Cint(childList(2,i))=1) then
				getCategoryChilds=getCategoryChilds&"<li>"&sperateStr&"<a href="""&childList(0,i)&""">"&childList(1,i)&"</a></li>"
			else
				getCategoryChilds=getCategoryChilds&"<li>"&sperateStr&"<a href="""&childList(0,i)&"/index_1.htm"">"&childList(1,i)&"</a></li>"
			end if
			if(nums<>0 and i=nums-1) then
				exit for
			end if
		next
		rs.close
		set rs=nothing
	else
		rs.close
		set rs=nothing
	end if
end function
'====================================================================
'函数：getbrotherlist(id)
'作用：获得某个类的所有兄弟类
'参数：id 	---类别ID
'linkStyle  ---链接样式
'例：getbrotherlist(8,"-","")
'===================================================================
function getbrotherlist(id,str,linkStyle)
dim cur_parentid,rs,tempList,i,sql,isChannel,sperateStr
cur_parentid=Cint(getparentid(id))
sql="select domainurl,title,flag from catalogs where parentid="&cur_parentid
Set rs = conn.Execute(sql)
if not rs.eof and not rs.bof then
	tempList=rs.GetRows()
	rs.close
	set rs=nothing
	for i=0 to ubound(tempList,2)
		if(i<>0) then
			sperateStr=str
		end if
		if(Cint(tempList(2,i))=1) then
			getbrotherlist=getbrotherlist&sperateStr&"<li><a href="""&tempList(0,i)&""">"&tempList(1,i)&"</a></li>"
		else
			getbrotherlist=getbrotherlist&sperateStr&"<li><a href="""&tempList(0,i)&"/index_1.htm"">"&tempList(1,i)&"</a></li>"
		end if
	next
else
	rs.close
	set rs=nothing
end if
end function
'====================================================================
'函数：getparentlist(id)
'作用：获得某个类的所有父类
'参数：id 	---类别ID
'例：arr=Split(getparentlist(32),"|")
'===================================================================
function getparentlist(id)
dim sql,rs,catalogId,catalogParentId
sql="select id,parentid from catalogs where id="&id
Set rs = conn.Execute(Sql)
if not rs.eof and not rs.bof then
	catalogId=rs(0)
	catalogParentId=rs(1)
	rs.close
	set rs=nothing
	getparentlist=getparentlist&catalogId
	if(catalogParentId<>0) then
		getparentlist=getparentlist&"|"&getparentlist(catalogParentId)
	end if	
else
	rs.close
	set rs=nothing
end if
end function
'====================================================================
'函数：getPosition(id,str)
'作用：获得当前位置
'参数：id 	---栏目ID
'str		---链接之间分隔符
'例：getPosition(8,"-")
'===================================================================
function getPosition(id,str)
	if(id<>"") then
		dim sql,rs,catalogSavedir,catalogTitle,catalogParentid,isChannel
		sql="select domainurl,title,parentid,flag from catalogs where id="&id
		Set rs = conn.Execute(Sql)
		if not rs.eof and not rs.bof then
			catalogSavedir=rs(0)
			catalogTitle=rs(1)
			catalogParentid=rs(2)
			isChannel=rs(3)
			rs.close
			set rs=nothing
			if(Cint(isChannel)=1) then
				getPosition=getPosition&str&"<a href="""&catalogSavedir&""">"&catalogTitle&"</a>"
			else
				getPosition=getPosition&str&"<a href="""&catalogSavedir&"/index_1.htm"">"&catalogTitle&"</a>"
			end if		
			if(Cint(catalogParentid)<>0) then
				getPosition=getPosition(catalogParentid,str)&getPosition
			end if
		else
			rs.close
			set rs=nothing
		end if
	else
		exit function
	end if
end function
'====================================================================
'函数：getparentid(id)
'作用：获得某个类的父类
'参数：id 	---类别ID
'例：pid=getparentid(33)
'===================================================================
function getparentid(id)
dim sql,rs
sql="select parentid from catalogs where id="&id
Set rs = conn.Execute(sql)
if not rs.eof and not rs.bof then
	if(rs(0)<>0) then
		getparentid=Cint(rs(0))
	else
		getparentid=0
	end if
end if
rs.close
set rs=nothing
end function
'====================================================================
'函数：getCatalogName(classid)
'作用：获得某个类的名字
'参数：classid 	---类别ID
'例：getCatalogName(33)
'===================================================================
function getCatalogName(classid)
dim rs,sql
sql="select title from catalogs where id="&classid
Set rs = conn.Execute(Sql)
if not rs.eof and not rs.bof then
	getCatalogName=rs(0)
end if
rs.close
set rs=nothing
end function
'====================================================================
'函数：getCatalogDomain(classid)
'作用：获得某个类的二级域名
'参数：classid 	---类别ID
'例：getCatalogDomain(33)
'===================================================================
function getCatalogDomain(classid)
dim rs,sql
sql="select domainurl from catalogs where id="&classid
Set rs = conn.Execute(Sql)
if not rs.eof and not rs.bof then
	getCatalogDomain=rs(0)
end if
rs.close
set rs=nothing
end function
'====================================================================
'函数：getnewsofcatalog
'====================================================================
function getnewsofcatalog(id)
	dim sql,rs,childList,ret,ischa
	sql="select id,domainurl,title,flag from catalogs where parentid="&id
	Set rs = conn.Execute(Sql)
	if not rs.eof and not rs.bof then
		childList=rs.GetRows()
		rs.close
		set rs=nothing
		for i=0 to ubound(childList,2)
			if(childList(3,i)=1) then
				ischa=""
			else
				ischa="/index_1.htm"
			end if
			ret=ret&"<div class=""categorycontainer""><div class=""categorytitle""><a href="""&childList(1,i)&ischa&""">"&childList(2,i)&"</a></div><div class=""categorylist""><ul>"&GetTextNews_Div(childList(0,i),10,"news","id","",20,1,0,0,"","·")&"</ul></div></div>"&Chr(10)			
		next
	else
		rs.close
		set rs=nothing
		getnewsofcatalog=""
	end if
	getnewsofcatalog=ret
end function
'=======================================================================
'函数：GetFriendLink(rows,cols,linktype,ItColor1,ItColor2)
'作用：获得头条新闻标题
'参数：rows        ---行数
'      cols        ---列数
'      linktype    ---链接类型，0<>=文字链接，1<=>图片链接
'      ItColor1    ---交替的背景颜色一
'      ItColor2    ---交替的背景颜色二
'      例：GetFriendLink(4,8,0,"#0066CC","#FF6600")
'=====================================================================
function GetFriendLink(rows,cols,linktype,ItColor1,ItColor2)
dim rs,sql,TempArr
	set rs=server.CreateObject("adodb.recordset")
	if(Cint(linktype)=0) then
		sql="select Title,LinkUrl from friendlink where Flag="&linktype
	elseif(Cint(linktype=1)) then
		sql="select Title,LinkUrl,Pic from friendlink where Flag="&linktype
	end if
  	set rs=conn.execute(sql)
	if not rs.eof then
  		TempArr=rs.GetRows()  
  		rs.close
		set rs=nothing   
		GetFriendLink=GetFriendLink&"<table class=""line22"" cellspacing=""0"" cellpadding=""0"" width=""100%"" border=""0"">"&Chr(10)
		for i=0 to rows-1' ubound(TempArr,2)按行循环

				if i mod 2=0 then
					GetFriendLink=GetFriendLink&"<tr bgcolor="""&ItColor1&""">"&Chr(10)
				else
					GetFriendLink=GetFriendLink&"<tr bgcolor="""&ItColor2&""">"&Chr(10)
				end if

			for j=0 to cols-1'按列循环
				GetFriendLink=GetFriendLink&"<td><div align=""center"">"&Chr(10)
				if(linktype=0) then
					if(i*cols+j<=ubound(TempArr,2)) then
						GetFriendLink=GetFriendLink&"<a href="""&TempArr(1,i*cols+j)&""" title="""&TempArr(0,i*cols+j)&""" target=""_blank"">"&TempArr(0,i*cols+j)&"</a>"&Chr(10)
					else
						GetFriendLink=GetFriendLink&"<a href="""&SiteUrl&""" target=""_blank"">友情链接</a>"&Chr(10)
					end if
				else
					if(i*cols+j<=ubound(TempArr,2)) then
						GetFriendLink=GetFriendLink&"<a href="""&TempArr(1,i*cols+j)&""" target=""_blank""><img src="""&TempArr(2,i*cols+j)&""" alt="""&TempArr(0,i*cols+j)&""" width=""88"" height=""31"" border=""0"" /></a>"&Chr(10)
					else
						GetFriendLink=GetFriendLink&"<a href="""&SiteUrl&""" target=""_blank"">友情链接</a>"&Chr(10)
					end if
				end if
				GetFriendLink=GetFriendLink&"</div></td>"&Chr(10)
			next
		GetFriendLink=GetFriendLink&"</tr>"&Chr(10)
		next
		GetFriendLink=GetFriendLink&"</table>"&Chr(10)	
	else
		rs.close
		set rs=nothing
	end if
end function


'=========================
'软件列表
'=========================
Function GetRelateSoft(key,num)
	dim sql,rs,ret
	sql="select top "&num&" id,SoftName from t_download_soft where SoftName like '%"&key&"%' order by id desc"
	set rs=server.CreateObject("adodb.recordset")
	rs.open sql,conn,3,1
	while not rs.eof
		ret=ret&"<li><a href="&""""&SiteUrl&"/soft/"&rs(0)&".htm"""&" title="""&rs(1)&""" target="&""""&"_blank"&""""&">"&rs(1)&"</a></li>"&chr(13)    	
		rs.movenext
	wend
	rs.close
	set rs=nothing
	GetRelateSoft=ret
end Function
'文本列表标签
function GetSoftTxt(classid,n,orders,key,max,isTime,isShowHits,isCatalog,catalogLinkStyle,titlePrefix)
	dim newsHref,childIds,rowCount,rs,sql,TempArr,tpfix
	sql="select top "&n&" s.id AS sid, s.SoftName, s.SoftPhoto, s.SoftHits, s.ModifyDate, c.id AS cid, c.title, c.savedir, c.domainurl FROM t_download_soft s INNER JOIN catalogs c ON s.CatalogId = c.id where s.IsCheck=1"	
	if(classid>0) then
		sql=sql&" and c.id="&classid		
	end if	
	set rs=server.CreateObject("adodb.recordset")
	Select Case LCase(key)
		Case "totop"
			sql=sql&" and s.SoftTop=1"
		Case "recommend"
			sql=sql&" and s.SoftRecommend=1"
		Case Else				
	End Select
	sql=sql&" order by s."&orders&" desc"	
  	set rs=conn.execute(sql)
	if not rs.eof and not rs.bof then
  		TempArr=rs.GetRows()  
  		rs.close
		set rs=nothing    	
		for i=0 to ubound(TempArr,2)
			newsHref=SiteUrl&"/soft/"&TempArr(0,i)&".htm"
			GetSoftTxt=GetSoftTxt&"<li>"&chr(13)
    		if(Cint(isTime=1)) then
				GetSoftTxt=GetSoftTxt&"<span class=""col_right"">"&FormatDate(TempArr(4,i),4)&"</span>"
			end if
			if(Cint(isCatalog=1)) then
				GetSoftTxt=GetSoftTxt&"<a href="&""""&TempArr(8,i)&"/index_1.htm"
				GetSoftTxt=GetSoftTxt&""""&" class="""&catalogLinkStyle&""" target="&""""&"_blank"&""""&">["&TempArr(6,i)&"]</a>"&chr(13)
			end if
			if(titlePrefix="auto") then
				tpfix=i+1
			else
				tpfix=titlePrefix
			end if
			GetSoftTxt=GetSoftTxt&tpfix&" <a href="&""""&newsHref&""""&" title="""&TempArr(1,i)&""" target="&""""&"_blank"&""""&">"&gotTopic(TempArr(1,i),max)&"</a>"&chr(13)    		
			GetSoftTxt=GetSoftTxt&"</li>"&chr(13)
		next	
	else
		GetSoftTxt="暂时没有记录"
		rs.close
		set rs=nothing
	end if
end function

'=================================================================================
'                             +-转换所有标签-+
'函数：ReplaceStaticLabel(TempContWrit)
'功能：转换某个类别中模板内容中的所有标签
'参数：
'TempContWrit   ---待转换某个内容
'classid 		---栏目ID
'=================================================================================
function ReplaceStaticLabel(TempContWrit,ClassId)
	dim labelArr,returnStr
	returnStr=TempContWrit		
	if(Instr(TempContWrit,"$SiteUrl$")<>0) then
		returnStr=replace(returnStr,"$SiteUrl$",SiteUrl)
	end if
	if(Instr(TempContWrit,"$SiteName$")<>0) then
		returnStr=replace(returnStr,"$SiteName$",SiteName)
	end if
	if(Instr(TempContWrit,"$SiteTitle$")<>0) then
		returnStr=replace(returnStr,"$SiteTitle$",SiteTitle)
	end if
	if(Instr(TempContWrit,"$Year$")<>0) then
		returnStr=replace(returnStr,"$Year$",Year(now))
	end if
	if(Instr(TempContWrit,"$Month$")<>0) then
		returnStr=replace(returnStr,"$Month$",Month(now))
	end if
	if(Instr(TempContWrit,"$Day$")<>0) then
		returnStr=replace(returnStr,"$Day$",Day(now))
	end if
	if(Instr(TempContWrit,"$Time$")<>0) then
		returnStr=replace(returnStr,"$Time$",Time)
	end if
	if(Instr(TempContWrit,"$Random$")<>0) then
		returnStr=replace(returnStr,"$Random$",getRndNum())
	end if
	if(Instr(TempContWrit,"$classid$")<>0) then
		returnStr=replace(returnStr,"$classid$",ClassId)
	end if
	if(Instr(TempContWrit,"$Head$")<>0) then
		returnStr=replace(returnStr,"$Head$",ReadFromTextFile(server.MapPath("/templet/head.htm")))
	end if
	if(Instr(TempContWrit,"$Root$")<>0) then
		returnStr=replace(returnStr,"$Root$",ReadFromTextFile(server.MapPath("/templet/root.htm")))
	end if
	if(Instr(TempContWrit,"$BbsUrl$")<>0) then
		returnStr=replace(returnStr,"$BbsUrl$",BbsUrl)
	end if
	ReplaceStaticLabel=returnStr
end function

'=================================================================================
'                             +-转换所有标签-+
'函数：ReplaceAllLabel(TempContWrit,classid)
'功能：转换某个类别中模板内容中的所有标签
'参数：
'TempContWrit   ---待转换某个内容
'classid 		---栏目ID
'=================================================================================
function ReplaceAllLabel(TempContWrit,classid)
	dim labelArr,returnStr,repeat_ii
	returnStr=TempContWrit
	returnStr=ReplaceStaticLabel(returnStr,classid)
	if(Instr(TempContWrit,"$position$")<>0) then
		returnStr=replace(returnStr,"$position$","<a href="""&SiteUrl&""">"&SiteTitle&"</a>"&getPosition(classid,"-&gt;"))
	end if
	if(Instr(TempContWrit,"$CurrentChilds$")<>0) then
		returnStr=replace(returnStr,"$CurrentChilds$",getchildlist(classid," ","a2"))
	end if
	
	if(Instr(TempContWrit,"$GetBrotherList$")<>0) then
		returnStr=replace(returnStr,"$GetBrotherList$",getbrotherlist(classid," ","a2"))
	end if
	
	if(Instr(TempContWrit,"$ListName$")<>0) then
		returnStr=replace(returnStr,"$ListName$",getCatalogName(classid))
	end if
	if(Instr(TempContWrit,"$ListTitle$")<>0) then
		returnStr=replace(returnStr,"$ListTitle$",getCatalogName(classid)&"-"&SiteName&"-"&SiteUrl)
	end if
	if(Instr(TempContWrit,"$NewsOfCatalog$")<>0) then
		returnStr=replace(returnStr,"$NewsOfCatalog$",getnewsofcatalog(classid))
	end if
	Set rs = Server.CreateObject("adodb.recordset")
	rs.open "select labelname,content from label where ftype=0 and (classid=0 or classid="&classid&") order by id desc",conn,3,1
	''''''''''''
	if not rs.eof then
  		labelArr=rs.GetRows() 
	else
		ReplaceAllLabel=returnStr
		exit function
	end if
	rs.close
	set rs=nothing
	for repeat_ii=0 to ubound(labelArr,2)
		on error resume next
			TempStr=labelArr(1,repeat_ii)
			if(TempStr="" or len(TempStr)<1) then
				response.Write("标签："&labelArr(0,repeat_ii)&"设置错误.")
			end if
			TempStr = Left(TempStr,Instr(TempStr,"(")-1) & "," & Mid(TempStr,InStr(TempStr,"(")+1)
			TempStr = Left(TempStr,InStrRev(TempStr,")")-1)
			TempStr = Replace(TempStr,"""","")
			if(Instr(TempContWrit,labelArr(0,repeat_ii))<>0) then
				labelname=labelArr(0,repeat_ii)				
				response.Flush()
				labelDataContent=GetLableContent(TempStr,classid)
				returnStr=replace(returnStr,labelname,labelDataContent)
			end if
	next
	''''''''''''''''
	'替换自定义函数
	''''''''''''''''
	dim creg,c_funname,c_funcont,c_newfuncnt,c_sql,j,c_repeat,c_temp,c_ofset,c_max
	Set creg= New RegExp
	creg.ignoreCase = true
	creg.Global = True 
	creg.Pattern = "\$Sub\[([\w]+)\]\$([\s|\S]*?)\$End\$"
	set cmatch=creg.Execute(returnStr)
	returnStr=creg.replace(returnStr,"$1")
	For Each m in cmatch 
		c_funname=m.SubMatches(0)
		c_funcont=m.SubMatches(1)
		c_repeat=""
		set rs=server.createobject("adodb.recordset")
		rs.open "select content from label where labelname='"&c_funname&"'",conn,3,1
		if not rs.eof then
			c_sql=rs(0)
		end if
		rs.close
		set rs=nothing
		'''''''''''''''''
		
		if(c_sql<>"") then
			dim rsarr
			dim fdlist,fdarr
			fdlist=""
			set rs=server.createobject("adodb.recordset")
			rs.open c_sql,conn,3,1
			for i=0 to rs.fields.count-1
				fdlist=fdlist&rs(i).name&","				
			next
			fdlist=left(fdlist,len(fdlist)-1)
			fdarr=split(fdlist,",")
			rs.close
			set rs=nothing
			'''''''''''''''按行循环''''''''''''
			set rs=server.createobject("adodb.recordset")
			rs.open c_sql,conn,3,1
			while not rs.eof
				c_newfuncnt=c_funcont
				for j=0 to ubound(fdarr)
					c_newfuncnt=replace(c_newfuncnt,"$"&fdarr(j)&"$",rs(j))
					''''''''''''''''''''
					Set creg= New RegExp
					creg.ignoreCase = True
					creg.Global = True 
					creg.Pattern = "\$left\("&fdarr(j)&",(\d+)\)\$"
					set cmatch=creg.Execute(c_newfuncnt)
					if(cmatch.count>0) then
						set m=cmatch(0)
						p1=m.value
						p2=m.SubMatches(0)								
						c_newfuncnt=replace(c_newfuncnt,p1,left(rs(j),cint(p2)))
					end if
					Set creg=nothing
					'''''''''''''''''''
					Set creg= New RegExp
					creg.ignoreCase = True
					creg.Global = True 
					creg.Pattern = "\$date\("&fdarr(j)&",(\d+)\)\$"
					set cmatch=creg.Execute(c_newfuncnt)
					if(cmatch.count>0) then
						set m=cmatch(0)
						p1=m.value
						p2=m.SubMatches(0)								
						c_newfuncnt=replace(c_newfuncnt,p1,FormatDate(rs(j),p2))
					end if
					Set creg=nothing					
				next
				c_repeat=c_repeat&c_newfuncnt
				rs.movenext
			wend
			rs.close
			set rs=nothing
		end if
		returnStr=replace(returnStr,c_funname,c_repeat)
	Next
	''''''''''''
	ReplaceAllLabel=returnStr
end function
'===============================================================================
'                        +-获得所有标签内容-+
'===============================================================================
Function GetLableContent(LableStr,classid)
	Dim ParaArray
	ParaArray = Split(LableStr,",")
	if UBound(ParaArray) = 0 then
		GetLableContent = ""
		Exit Function
	else
		Select Case LCase(ParaArray(0))
			Case "getnews"'获得指定类的前N条文字记录
				if UBound(ParaArray) = 12 then
					GetLableContent = GetNews(ParaArray(1),ParaArray(2),ParaArray(3),ParaArray(4),ParaArray(5),ParaArray(6),ParaArray(7),ParaArray(8),ParaArray(9),ParaArray(10),ParaArray(11),ParaArray(12))
					'response.Write(GetLableContent)
				else
					GetLableContent = ""
					Exit Function
				end if
			Case "getnewsall"'获得总新闻表中的前N条文字记录
				if UBound(ParaArray) = 14 then
					GetLableContent = GetNewsAll(ParaArray(1),ParaArray(2),ParaArray(3),ParaArray(4),ParaArray(5),ParaArray(6),ParaArray(7),ParaArray(8),ParaArray(9),ParaArray(10),ParaArray(11),ParaArray(12),ParaArray(13),ParaArray(14))
					'response.Write(GetLableContent)
				else
					GetLableContent = ""
					Exit Function
				end if
			Case "gettextnews_div"'DIV输出样式文本列表
				if UBound(ParaArray) = 11 then
					GetLableContent = GetTextNews_Div(ParaArray(1),ParaArray(2),ParaArray(3),ParaArray(4),ParaArray(5),ParaArray(6),ParaArray(7),ParaArray(8),ParaArray(9),ParaArray(10),ParaArray(11))
					'response.Write(GetLableContent)
				else
					GetLableContent = ""
					Exit Function
				end if
			Case "getimgnews"'获得指定类的前N条图片文字记录(图上文下)
				if UBound(ParaArray) = 11 then
					GetLableContent = GetImgNews(ParaArray(1),ParaArray(2),ParaArray(3),ParaArray(4),ParaArray(5),ParaArray(6),ParaArray(7),ParaArray(8),ParaArray(9),ParaArray(10),ParaArray(11))
					'response.Write(GetLableContent)
				else
					GetLableContent = ""
					Exit Function
				end if
			Case "getimgnews2"'获得指定类的前N条图片文字记录(左图右上标题右下内容)
				if UBound(ParaArray) = 11 then
					GetLableContent = GetImgNews2(ParaArray(1),ParaArray(2),ParaArray(3),ParaArray(4),ParaArray(5),ParaArray(6),ParaArray(7),ParaArray(8),ParaArray(9),ParaArray(10),ParaArray(11))
					'response.Write(GetLableContent)
				else
					GetLableContent = ""
					Exit Function
				end if
			Case "getimgnewsdescli"'获得指定类的前N条图片Li样式(带简介)
				if UBound(ParaArray) = 11 then
					GetLableContent = GetImgNewsDescLi(ParaArray(1),ParaArray(2),ParaArray(3),ParaArray(4),ParaArray(5),ParaArray(6),ParaArray(7),ParaArray(8),ParaArray(9),ParaArray(10),ParaArray(11))
					'response.Write(GetLableContent)
				else
					GetLableContent = ""
					Exit Function
				end if
			Case "getimgnews3"'获得指定类的前N条图片文字记录(repeat by td)
				if UBound(ParaArray) = 11 then
					GetLableContent = GetImgNews3(ParaArray(1),ParaArray(2),ParaArray(3),ParaArray(4),ParaArray(5),ParaArray(6),ParaArray(7),ParaArray(8),ParaArray(9),ParaArray(10),ParaArray(11))
					'response.Write(GetLableContent)
				else
					GetLableContent = ""
					Exit Function
				end if
			Case "getimgnewsli"'获得指定类的前N条图片Li样式
				if UBound(ParaArray) = 10 then
					GetLableContent = GetImgNewsLi(ParaArray(1),ParaArray(2),ParaArray(3),ParaArray(4),ParaArray(5),ParaArray(6),ParaArray(7),ParaArray(8),ParaArray(9),ParaArray(10))
					'response.Write(GetLableContent)
				else
					GetLableContent = ""
					Exit Function
				end if
			Case "getmultitxtnews"'获得指定类的前N条文字记录(repeat by td)
				if UBound(ParaArray) = 15 then
					GetLableContent = GetMultiTxtNews(ParaArray(1),ParaArray(2),ParaArray(3),ParaArray(4),ParaArray(5),ParaArray(6),ParaArray(7),ParaArray(8),ParaArray(9),ParaArray(10),ParaArray(11),ParaArray(12),ParaArray(13),ParaArray(14),ParaArray(15))
					'response.Write(GetLableContent)
				else
					GetLableContent = ""
					Exit Function
				end if
			Case "e_getmultitxtnews"'获得指定类的前N条文字记录(repeat by td)
				if UBound(ParaArray) = 19 then
					GetLableContent = e_GetMultiTxtNews(ParaArray(1),ParaArray(2),ParaArray(3),ParaArray(4),ParaArray(5),ParaArray(6),ParaArray(7),ParaArray(8),ParaArray(9),ParaArray(10),ParaArray(11),ParaArray(12),ParaArray(13),ParaArray(14),ParaArray(15),ParaArray(16),ParaArray(17),ParaArray(18),ParaArray(19))
					'response.Write(GetLableContent)
				else
					GetLableContent = ""
					Exit Function
				end if
			Case "getspecialnews"'获得指定类的前N条文字记录(repeat by td)
				if UBound(ParaArray) = 15 then
					GetLableContent = GetSpecialNews(ParaArray(1),ParaArray(2),ParaArray(3),ParaArray(4),ParaArray(5),ParaArray(6),ParaArray(7),ParaArray(8),ParaArray(9),ParaArray(10),ParaArray(11),ParaArray(12),ParaArray(13),ParaArray(14),ParaArray(15))
					'response.Write(GetLableContent)
				else
					GetLableContent = ""
					Exit Function
				end if
			Case "getmultiimgnews"'获得指定类的前N条图片文字记录(repeat by td)
				if UBound(ParaArray) = 15 then
					GetLableContent = GetMultiImgNews(ParaArray(1),ParaArray(2),ParaArray(3),ParaArray(4),ParaArray(5),ParaArray(6),ParaArray(7),ParaArray(8),ParaArray(9),ParaArray(10),ParaArray(11),ParaArray(12),ParaArray(13),ParaArray(14),ParaArray(15))
					'response.Write(GetLableContent)
				else
					GetLableContent = ""
					Exit Function
				end if
			Case "e_getmultiimgnews"'获得指定类的前N条图片文字记录(repeat by td)
				if UBound(ParaArray) = 19 then
					GetLableContent = e_GetMultiImgNews(ParaArray(1),ParaArray(2),ParaArray(3),ParaArray(4),ParaArray(5),ParaArray(6),ParaArray(7),ParaArray(8),ParaArray(9),ParaArray(10),ParaArray(11),ParaArray(12),ParaArray(13),ParaArray(14),ParaArray(15),ParaArray(16),ParaArray(17),ParaArray(18),ParaArray(19))
					'response.Write(GetLableContent)
				else
					GetLableContent = ""
					Exit Function
				end if
			Case "getcurrentnews"'获得当前类的前N条文字记录
				if UBound(ParaArray) = 12 then					
					GetLableContent = GetNews(classid,ParaArray(2),ParaArray(3),ParaArray(4),ParaArray(5),ParaArray(6),ParaArray(7),ParaArray(8),ParaArray(9),ParaArray(10),ParaArray(11),ParaArray(12))
					'response.Write(GetLableContent)
				else
					GetLableContent = ""
					Exit Function
				end if
			
			Case "get1image"'获得指定类的第一条图片信息
				if UBound(ParaArray) = 6 then
					GetLableContent = Get1Image(ParaArray(1),ParaArray(2),ParaArray(3),ParaArray(4),ParaArray(5),ParaArray(6))
					'response.Write(GetLableContent)
				else
					GetLableContent = ""
					Exit Function
				end if
			Case "getcurrent1image"'获得当前类的第一条图片信息
				if UBound(ParaArray) = 6 then
					GetLableContent = Get1Image(classid,ParaArray(2),ParaArray(3),ParaArray(4),ParaArray(5),ParaArray(6))
					'response.Write(GetLableContent)
				else
					GetLableContent = ""
					Exit Function
				end if
				
			Case "get1title"'获得指定类的第一条标题信息
				if UBound(ParaArray) = 7 then
					GetLableContent = Get1Title(ParaArray(1),ParaArray(2),ParaArray(3),ParaArray(4),ParaArray(5),ParaArray(6),ParaArray(7))
					'response.Write(GetLableContent)
				else
					GetLableContent = ""
					Exit Function
				end if
			Case "getcurrent1title"'获得当前类的第一条标题信息
				if UBound(ParaArray) = 5 then
					GetLableContent = Get1Title(classid,ParaArray(2),ParaArray(3),ParaArray(4),ParaArray(5),0,0)
					'response.Write(GetLableContent)
				else
					GetLableContent = ""
					Exit Function
				end if
			Case "getcurimgnews1"'获得当前类的前N条图片文字记录(图上文下)
				if UBound(ParaArray) = 11 then
					GetLableContent = GetImgNews(classid,ParaArray(2),ParaArray(3),ParaArray(4),ParaArray(5),ParaArray(6),ParaArray(7),ParaArray(8),ParaArray(9),ParaArray(10),ParaArray(11))
					'response.Write(GetLableContent)
				else
					GetLableContent = ""
					Exit Function
				end if
			Case "getcurimgnews2"'获得当前类的前N条图片文字记录(左图右上标题右下内容)
				if UBound(ParaArray) = 11 then
					GetLableContent = GetImgNews2(classid,ParaArray(2),ParaArray(3),ParaArray(4),ParaArray(5),ParaArray(6),ParaArray(7),ParaArray(8),ParaArray(9),ParaArray(10),ParaArray(11))
					'response.Write(GetLableContent)
				else
					GetLableContent = ""
					Exit Function
				end if
			Case "getcurimgnews3"'获得当前类的前N条图片文字记录(repeat by td)
				if UBound(ParaArray) = 11 then
					GetLableContent = GetImgNews3(classid,ParaArray(2),ParaArray(3),ParaArray(4),ParaArray(5),ParaArray(6),ParaArray(7),ParaArray(8),ParaArray(9),ParaArray(10),ParaArray(11))
					'response.Write(GetLableContent)
				else
					GetLableContent = ""
					Exit Function
				end if
			Case "get1content"'获得指定类的第一条内容信息
				if UBound(ParaArray) = 5 then
					GetLableContent = Get1Content(ParaArray(1),ParaArray(2),ParaArray(3),ParaArray(4),ParaArray(5))
					'response.Write(GetLableContent)
				else
					GetLableContent = ""
					Exit Function
				end if
			Case "getcurrent1content"'获得当前类的第一条内容信息
				if UBound(ParaArray) = 5 then
					GetLableContent = Get1Content(classid,ParaArray(2),ParaArray(3),ParaArray(4),ParaArray(5))
					'response.Write(GetLableContent)
				else
					GetLableContent = ""
					Exit Function
				end if
			Case "getchildlist"'获得当前类的第一条内容信息
				if UBound(ParaArray) = 5 then
					GetLableContent = getCategoryChilds(ParaArray(1),ParaArray(2),ParaArray(3),ParaArray(4),ParaArray(5))
					'response.Write("--"&classid)
				else
					GetLableContent = ""
					Exit Function
				end if
			Case "getfriendlink"'获得指定类的第一条标题信息
				if UBound(ParaArray) = 5 then
					GetLableContent = GetFriendLink(ParaArray(1),ParaArray(2),ParaArray(3),ParaArray(4),ParaArray(5))
					'response.Write(GetLableContent)
				else
					GetLableContent = ""
					Exit Function
				end if
			Case "getsofttxt"'软件列表
				if UBound(ParaArray) = 10 then
					if(Cint(ParaArray(1))=-1) then
						ParaArray(1)=classid
					end if
					GetLableContent = GetSoftTxt(ParaArray(1),ParaArray(2),ParaArray(3),ParaArray(4),ParaArray(5),ParaArray(6),ParaArray(7),ParaArray(8),ParaArray(9),ParaArray(10))
					'response.Write(ParaArray(1))
				else
					GetLableContent = ""
					Exit Function
				end if
			Case "getremotefile"'获取远程文件
				if UBound(ParaArray) = 2 then
					GetLableContent = GetRemoteFile(ParaArray(1),ParaArray(2))
					'response.Write(GetLableContent)
				else
					GetLableContent = ""
					Exit Function
				end if
			Case "getlocalfile"'获取远程文件
				if UBound(ParaArray) = 2 then
					GetLableContent = GetLocalFile(ParaArray(1),ParaArray(2))
					'response.Write(GetLableContent)
				else
					GetLableContent = ""
					Exit Function
				end if
			Case Else
				GetLableContent = ""
				Exit Function
		End Select
	end if
End Function

'==============================================================================
'                               显示分页函数
'==============================================================================
function showPage(currentpage,totalnum,pagenum)
if CurrentPage>1then
showPage=showPage&("["&"<a href='index_"&currentpage-1&".htm'>上一页</a>]&nbsp;&nbsp;&nbsp;")
else showPage=showPage&("上一页&nbsp;&nbsp;&nbsp;")
end if 
if CurrentPage>=int(pagenum) then 
showPage=showPage&("下一页" )
else
showPage=showPage&("["&"<a href='index_"&currentpage+1&".htm'>下一页</a>]")
end if
showPage=showPage&("&nbsp;共"&totalnum&"条&nbsp;")
showPage=showPage&("&nbsp;共"&pagenum&"页&nbsp;")
showPage=showPage&("&nbsp;第"&currentpage&"页&nbsp;")  	
end function	
%>