<%
'--是否禁用模板缓存（False=否，True=是）
Const DisabledCache = False
Dim Template,CurrentClass,ParentClass
Dim TPL_Memory, IsNowOutputText,iScanCount
Dim TPL_XmlDom,TPL_Node,OtherHtmlPath
IsNowOutputText = True	'是否立即输出内容
iScanCount = 0
OtherHtmlPath="html/"
Set Template=New Template_Cls

Function CheckURLRewrite(strPath,strFile)
	CheckURLRewrite=strPath&strFile
End Function

Sub TPL_Echo(strText)
	If IsNowOutputText Then
		Response.Write strText&""
	Else
		TPL_Memory=TPL_Memory&strText
	End If
End Sub

Sub TPL_Flush()
	Response.Write TPL_Memory
	TPL_Memory	= ""
	If IsObject(TPL_XmlDom) Then Set TPL_XmlDom=Nothing
End Sub

Sub TPL_Scan(strTemplate)
	Dim iPosLast, iPosCurr
	iPosLast=1
	While True
		iPosCurr=InStr(iPosLast, strTemplate, "{$")
		If iPosCurr>0 Then
			TPL_Echo Mid(strTemplate, iPosLast, iPosCurr-iPosLast)
			iPosLast=TPL_Analysis(strTemplate, iPosCurr+2)
			iScanCount=iScanCount+1
		Else
			TPL_Echo Mid(strTemplate, iPosLast)
			Exit Sub
		End If
	 Wend
End Sub

Function TPL_Analysis(strTemplate, iPosBegin)
	Dim iPosCur, sToken, sValue, sTemp, sAttrib, iPosAtt, sText
	Dim sVariant,iPosVar, iPosVarBegin,iPosVarEnd
	iPosCur		= InStr(iPosBegin, strTemplate, "}")
	If iPosCur=0 Then TPL_Analysis=iPosBegin : Exit Function
	sTemp		= Mid(strTemplate,iPosBegin,iPosCur-iPosBegin)
	iPosBegin	= iPosCur+1
	iPosCur		= InStr(sTemp, ":")
	If iPosCur>1 Then
		sToken			= Left(sTemp, iPosCur-1)
		sValue			= Mid(sTemp, iPosCur+1)
		iPosAtt			= InStr(sValue, Chr(32))
		iPosVarBegin	= InStr(sValue, "(")+1
		iPosVarEnd		= InStr(sValue, ")")
		If iPosAtt=0 And iPosVarEnd=0 Then
			sAttrib=sValue
		Else
			iPosVar = InStr(sValue&"}", ")}")
			If iPosVar=0 Then
				sAttrib=Left(sValue, iPosAtt-1)
			Else
				sAttrib=Trim(Left(sValue, InStr(sValue, "(")-1))
				sVariant=Mid(sValue,iPosVarBegin,iPosVarEnd-iPosVarBegin)
			End If
		End If
		Select Case sAttrib
			Case "begin"
				sTemp			= "{$" & ( sToken & ":end}" )
				iPosCur			= InStr(iPosBegin, strTemplate, sTemp)
				If iPosCur>0 Then
					sText = Mid(strTemplate, iPosBegin, iPosCur-iPosBegin)
					If sToken="xml" Then
						TPL_Echo Template.appendXmlNode(sValue,sToken,sText)
					Else
						TPL_ParseArea	  sToken, sText
					End If
					iPosBegin		= iPosCur+Len(sTemp)
				End If
			Case "end"
		Case Else
			Select Case sToken
				Case "label"	TPL_Echo  sValue
				Case "tag"		TPL_ParseTag sAttrib
				Case "xml"		TPL_Echo  Template.appendXmlNode(sValue,sAttrib,"")
				Case "newasp"	TPL_ParseNode sToken, sAttrib,sVariant
				Case Else		TPL_ParseNode sToken, sValue,sVariant
			End Select
		End Select
	End If
	TPL_Analysis=iPosBegin
End Function

Sub TPL_ParseTag(sToken)
	Select Case sToken
		Case "installdir"		: TPL_Echo NewAsp.MainsiteDir
		Case "sitename"			: TPL_Echo NewAsp.MainSetting(1)
		Case "channeldir"		: TPL_Echo NewAsp.ChannelPath
		Case "channelid"		: TPL_Echo NewAsp.ChannelID
		Case "channelname"		: TPL_Echo NewAsp.ChannelName
		Case "modules"			: TPL_Echo NewAsp.modules
		Case "binddomain"		: TPL_Echo NewAsp.BindDomain
		Case "refreshdate"		: TPL_Echo NewAsp.FormatToDate(Now(), "yyyy-MM-dd hh:mm:ss")
		case "refreshtime"		: TPL_Echo NewAsp.FormatToDate(Now(), "WW,dd MMMM yyyy hh:mm:ss +0800")
		Case "sitedomain"		: TPL_Echo NewAsp.MainDomain
		Case "skinpath"			: TPL_Echo NewAsp.SkinsPath
		Case "sitename"			: TPL_Echo NewAsp.MainSetting(1)
		Case "indexdoc"			: TPL_Echo NewAsp.MainSetting(2)
		Case "email"			: TPL_Echo NewAsp.MainSetting(3)
		Case "keyword"			: TPL_Echo NewAsp.MainSetting(4)
		Case "copyright"		: TPL_Echo NewAsp.MainSetting(5)
		Case "modulename"		: TPL_Echo NewAsp.ModuleName
		Case "pageloadtime"		: TPL_Echo PageLoadTime
		Case "codefile"			: TPL_Echo CodeFilePath
		Case "randomcode"		: TPL_Echo NewAsp.GetRandomCode(16)
		Case "random"			: TPL_Echo NewAsp.GetRandomCode(8)
	End Select
End Sub

Function CurrentPosition(sortid,strParent,spaceChar)
	Dim classXmlDom,classNode,strNodeText,i,iCount
	Dim arrParent,strContent,strLinks,strChannelDir
	Dim cSpaceChar
	CurrentClass = "":cSpaceChar=" - "
	If sortid>0 Then
		If InStr(spaceChar,"###")>0 Then
			strContent=""
			spaceChar=Replace(spaceChar, "###", "")
		Else
			strContent="<a href="""&NewAsp.ChannelPath&""">"&NewAsp.ChannelName&"</a>"&spaceChar
		End If
		If Not IsObject(Application(NewAsp.CacheName&"_classlist_"&NewAsp.ChannelID)) Then NewAsp.LoadClassList(NewAsp.ChannelID)
		Set classXmlDom=Application(NewAsp.CacheName&"_classlist_"&NewAsp.ChannelID)
		If strParent="0" Or ""=strParent Then
			strNodeText="row[@classid='"&sortid&"'"
		Else
			arrParent=Split(strParent&","&sortid, ",")
			iCount=0
			For i=0 To UBound(arrParent)
				If NewAsp.ChkNumeric(arrParent(i))>0 Then
					If iCount=0 Then
						strNodeText="row[@classid="&arrParent(i)&""
					Else
						strNodeText=strNodeText&" or @classid="&arrParent(i)&""
					End If
					iCount=iCount+1
				End If
			Next
		End If
		If NewAsp.BindDomain=0 Then
			strChannelDir=NewAsp.ChannelDir
		End If

		If Len(strNodeText)>10 Then
			strNodeText=strNodeText&"]"
			Set Node=classXmlDom.documentElement.selectNodes(strNodeText)
			iCount=Node.length
			i=0
			Dim Node
			For Each classNode in Node
				i=i+1
				If NewAsp.isCreateHtml=0 Then
					If IsURLRewrite Then
						strLinks=CheckURLRewrite(NewAsp.ChannelPath,"list_1_"&classNode.selectSingleNode("@classid").text&NewAsp.HtmlExtName)
					Else
						strLinks=NewAsp.ChannelPath&"list.asp?classid="&classNode.selectSingleNode("@classid").text
					End If
				Else
					strLinks=NewAsp.HtmlDestination(NewAsp.sortDestination, strChannelDir, "",classNode.selectSingleNode("@htmlfiledir").text,classNode.selectSingleNode("@classid").text,0,1,"")
				End If
				If CLng(classNode.selectSingleNode("@turnlink").text)>0 Then
					strLinks=classNode.selectSingleNode("@turnlinkurl").text
				End If
				If i=>iCount Then
					spaceChar="":cSpaceChar=""
				End If
				strContent=strContent&"<a href="""&strLinks&""">"&classNode.selectSingleNode("@classname").text&"</a>"&spaceChar
				CurrentClass=CurrentClass & classNode.selectSingleNode("@classname").text&cSpaceChar
				If i=1 Then ParentClass=classNode.selectSingleNode("@classname").text
			Next
			Set Node=Nothing:Set classNode=Nothing:Set classXmlDom=Nothing
		End If
	Else
		strContent="<a href="""&NewAsp.ChannelPath&""">"&NewAsp.ChannelName&"</a>"
	End If
	CurrentPosition=strContent
End Function

Function PageLoadTime()
	Dim Endtime
	Endtime = Timer()
	PageLoadTime = "页面执行时间：" & FormatNumber((Endtime - startime)*1000, 5, -1) & " 毫秒"
End Function

Function TPL_Config(id)
	Dim Node
	On Error Resume Next
	Set Node=TPL_XmlDom.documentElement.selectSingleNode("data[@id='"&id&"']")
	If Not Node is Nothing Then
		TPL_Config=Node.text
	Else
		TPL_Config=""
	End If
	Set Node=Nothing
End Function

Sub OutMsgBox(str)
	Response.Write "<script language=""javascript"">" & vbcrlf
	Response.Write "alert('" & Replace(Replace(str, "'", "\'"), vbCrLf, "") & "');"
	Response.Write "history.back();" & vbcrlf
	Response.Write "</script>" & vbcrlf
	Response.End
End Sub

Class Template_Cls
	Private XMLDoc
	Private HandlErr,ErrMsg,BufferTime
	Public IsDispayDomain
	Private Sub Class_Initialize()
		On Error Resume Next
		HandlErr=False
		IsDispayDomain=False
		'自定义标签缓存时间
		BufferTime=300
		Set XMLDoc=NewAsp.CreateXMLDoc("msxml2.FreeThreadedDOMDocument"& MsxmlVersion)
	End Sub

	Private Sub Class_Terminate()
		Set XMLDoc=Nothing
		Set Template=Nothing
	End Sub

	Public Function appendXmlNode(strXML,sAttrib,strXSL)
		Dim Node,strTempData,strFile,strAttrib
		If InStr(strXML, Chr(32))=0 Then
			strAttrib=strXML&"=""newasp.net"""
		Else
			strAttrib=Replace(Mid(strXML, InStr(strXML, Chr(32))+1), "&", "&amp;")
		End If

		If XMLDoc.loadxml("<xml><data " & strAttrib &"/></xml>") Then
			Set Node=XMLDoc.documentElement.selectSingleNode("data")
			If Not Node Is Nothing Then
				strFile = CheckFileName(Node.getAttribute("file"))
				If ""=strFile Then strFile = CheckFileName(sAttrib)
				strTempData = LoadXMLDocument(Node,strXSL,strFile,sAttrib)
				appendXmlNode = strTempData
			End If
			Set Node=Nothing
		Else
			appendXmlNode = "载入自定义标签错误，此标签不符合XML标准。"
		End If
	End Function

	Public Function LoadXMLDocument(xNode,strXSL,strFile,sAttrib)
		Dim iXMLDom,Templist,AttribToken
		Dim Rs,SQL,b,Node
		On Error Resume Next
		Set iXMLDom = NewAsp.CreateXMLDoc("msxml2.FreeThreadedDOMDocument"& MsxmlVersion)
		iXMLDom.appendChild(iXMLDom.createElement("xml"))
		For Each b in xNode.Attributes
			iXMLDom.documentElement.setAttribute b.Name,b.Value
		Next
		Set b=Nothing

		If ""=strXSL And ""=strFile Then Exit Function
		'AttribToken=iXMLDom.documentElement.getAttribute("id")
		'If IsNull(AttribToken) Then AttribToken = sAttrib
		If sAttrib="xml" Then
			AttribToken=NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("id"))
		Else
			AttribToken=sAttrib
		End If
		Select Case AttribToken
			Case "newslist"			Call LoadNewsList(iXMLDom)
			Case "softlist"			Call LoadSoftList(iXMLDom)
			Case "flashlist"		Call LoadFlashList(iXMLDom)
			Case "channelmenu"		Call LoadChannelMenu(iXMLDom)
			Case "classmenu"		Call LoadClassMenu(iXMLDom)
			Case "userlist"			Call LoadUserList(iXMLDom)
			Case "announcements"	Call LoadAnnouncements(iXMLDom)
			Case "friendlink"		Call LoadFriendLink(iXMLDom)
			Case "taglist"			Call LoadTagList(iXMLDom)
			Case "abcsearch"		Call LoadAbcSearch(iXMLDom)
			Case "specialmenu"		Call LoadSpecialMenu(iXMLDom)
			Case "customitem"		Call LoadCustomSQLlist(iXMLDom)
			Case "datalist"			Call LoadDataList(iXMLDom,NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("id")))
			Case "statistic"
				LoadXMLDocument = GetStatistic(iXMLDom)
				Set iXMLDom=Nothing:Exit Function
		Case Else
			LoadCustomSQLlist iXMLDom
		End Select
		If ""=strXSL Then
			LoadXMLDocument = TransformXSLTemplate_1(iXMLDom,strFile)
		Else
			LoadXMLDocument = TransformXSLTemplate_2(iXMLDom,strXSL)
		End If
		Set iXMLDom=Nothing
		NewAsp.Ellipsis="..."
	End Function

	Public Function TransformXSLTemplate_1(iXMLDom,strFile)
		Dim proc,XMLStyle,node,cnode,XSLTemplate
		Dim strXsltFile,strInstallDir
		On Error Resume Next
		If NewAsp.BindDomain=1 Then
			strInstallDir=NewAsp.MainDomain & NewAsp.InstallDir
		Else
			strInstallDir=NewAsp.InstallDir
		End If
		If HandlErr Then TransformXSLTemplate_1=ErrMsg : Exit Function
		If strFile = "" Then TransformXSLTemplate_1="" : Exit Function
		Set XSLTemplate=NewAsp.CreateAXObject("Msxml2.XSLTemplate" & MsxmlVersion )
		Set XMLStyle=NewAsp.CreateXmlDoc("msxml2.FreeThreadedDOMDocument"& MsxmlVersion )
		strXsltFile=NewAsp.TemplatePath &"xslt\"& strFile
		If XMLStyle.load(ChkMapPath(strXsltFile)) Then
			Set Node=XMLStyle.createNode(1,"xsl:variable","http://www.w3.org/1999/XSL/Transform")
			Set CNode=XMLStyle.createNode(2,"name","")
			CNode.text="installdir"
			Node.attributes.setNamedItem(CNode)
			Node.text=strInstallDir
			XMLStyle.documentElement.appendChild(node)
			Set Node=XMLStyle.createNode(1,"xsl:variable","http://www.w3.org/1999/XSL/Transform")
			Set CNode=XMLStyle.createNode(2,"name","")
			CNode.text="skinpath"
			Node.attributes.setNamedItem(CNode)
			Node.text="skins/"&NewAsp.MainSetting(0)&"/"
			XMLStyle.documentElement.appendChild(node)

			XSLTemplate.stylesheet=XMLStyle
			Set proc = XSLTemplate.createProcessor()
			proc.input = iXMLDom
			proc.transform()
			Dim procstr
			procstr = proc.output
			Set proc=Nothing
			TransformXSLTemplate_1 = procstr
		Else
			TransformXSLTemplate_1 = "载入模板错误...请检查模板文件(" & strXsltFile & ")是否存在或者是否符合XSLT标准"
		End If
		Set XMLStyle=Nothing
		Set XSLTemplate=Nothing
	End Function

	Public Function TransformXSLTemplate_2(iXMLDom,strXSL)
		Dim proc,XMLStyle,node,cnode,XSLTemplate
		Dim strXsltFile,strInstallDir
		On Error Resume Next
		If NewAsp.BindDomain=1 Then
			strInstallDir=NewAsp.MainDomain & NewAsp.InstallDir
		Else
			strInstallDir=NewAsp.InstallDir
		End If
		If HandlErr Then TransformXSLTemplate_2=ErrMsg : Exit Function
		If strXSL = "" Then TransformXSLTemplate_2="" : Exit Function
		Set XSLTemplate=NewAsp.CreateAXObject("Msxml2.XSLTemplate" & MsxmlVersion )
		Set XMLStyle=NewAsp.CreateXmlDoc("msxml2.FreeThreadedDOMDocument"& MsxmlVersion )
		If XMLStyle.loadxml(xslstylesheet(strXSL)) Then
			Set Node=XMLStyle.createNode(1,"xsl:variable","http://www.w3.org/1999/XSL/Transform")
			Set CNode=XMLStyle.createNode(2,"name","")
			CNode.text="installdir"
			Node.attributes.setNamedItem(CNode)
			Node.text=strInstallDir
			XMLStyle.documentElement.appendChild(node)
			Set Node=XMLStyle.createNode(1,"xsl:variable","http://www.w3.org/1999/XSL/Transform")
			Set CNode=XMLStyle.createNode(2,"name","")
			CNode.text="skinpath"
			Node.attributes.setNamedItem(CNode)
			Node.text="skins/"&NewAsp.MainSetting(0)&"/"
			XMLStyle.documentElement.appendChild(node)

			XSLTemplate.stylesheet=XMLStyle
			Set proc = XSLTemplate.createProcessor()
			proc.input = iXMLDom
			proc.transform()
			Dim procstr
			procstr = proc.output
			Set proc=Nothing
			TransformXSLTemplate_2 = procstr
		Else
			TransformXSLTemplate_2 = "载入模板错误...请检查模板代码是否符合XSLT规范"
		End If
		Set XMLStyle=Nothing
		Set XSLTemplate=Nothing
	End Function


	Public Function xslstylesheet(strXSL)
		Dim strXML
		If InStr(strXSL,"<xsl:stylesheet ")=0 Then
			strXML="<?xml version=""1.0"" encoding=""gb2312""?>"&vbCrLf
			strXML=strXML&"<xsl:stylesheet version=""1.0"" xmlns:xsl=""http://www.w3.org/1999/XSL/Transform"">"&vbCrLf
			strXML=strXML&"<xsl:output method=""xml"" omit-xml-declaration=""yes"" indent=""yes"" version=""4.0""/>"&vbCrLf
		End If
		If InStr(strXSL,"<xsl:template ")=0 Then strXML=strXML&"<xsl:template match=""/"">"&vbCrLf
		strXML=strXML&strXSL
		If InStr(strXSL,"<xsl:template ")=0 Then strXML=strXML&"</xsl:template>"&vbCrLf
		If InStr(strXSL,"<xsl:stylesheet ")=0 Then strXML=strXML&"</xsl:stylesheet>"
		xslstylesheet=strXML
	End Function

	Public Function xmlencode(ByVal str)
		Dim i
		str = Replace(str,"&","&amp;")
		For i = 0 to 31
			str = Replace(str,Chr(i),"&amp;#"&i&";")
		Next
		For i = 95 to 96
			str = Replace(str,Chr(i),"&amp;#"&i&";")
		Next
		xmlencode = str
	End Function

	Public Function xmldecode(ByVal str)
		Dim i
		str = Replace(str,"&amp;","&")
		For i = 0 to 31
			str = Replace(str,"&#"&i&";",Chr(i))
		Next
		For i = 95 to 96
			str = Replace(str,"&#"&i&";",Chr(i))
		Next
		xmldecode = str
	End Function

	Public Function CheckFileName(ByVal strFile)
		If Not IsNull(strFile) And strFile<>"" Then
			strFile = Replace(strFile, Chr(0), "")
			strFile = Replace(strFile, vbCrLf, "")
			If InStr(strFile,".") > 0 Then
				CheckFileName = strFile
			Else
				CheckFileName = strFile & ".xslt"
			End If
		Else
			CheckFileName = ""
		End If
	End Function

	Sub UpdateCache(sAppID,sBuff)
		Application.Lock
		Application(sAppID&"_lastime")=Now()
		Application(sAppID&"_buffers")=sBuff
		Application.UnLock
	End Sub

	Private Function CacheIsObject(isCache,sAppID)
		CacheIsObject = False
		Dim dLastime
		If DisabledCache Then Exit Function
		If isCache = "0" Then Exit Function
		If isCache = "-1" Then Exit Function
		If isCache = "no" Then Exit Function
		'sAppID = NewAsp.CacheName &"_custom"
		dLastime = Application(sAppID&"_lastime")
		If IsObject(Application(sAppID)) And ""<>dLastime And _
			DateDiff("s", CDate(dLastime), Now()) <= CLng(60*BufferTime) Then
			CacheIsObject = True
		Else
			Application.Lock
			Application(sAppID&"_lastime")=Now()
			Application.UnLock
			CacheIsObject = False
		End If
	End Function

	Private Function EnabledCache(isCache)
		EnabledCache = False
		If DisabledCache Then Exit Function
		If isCache = "0" Then Exit Function
		If isCache = "-1" Then Exit Function
		If isCache = "no" Then Exit Function
		EnabledCache = True
	End Function

	Public Function CheckIDlist(ByVal strList)
		On Error Resume Next
		If Not IsNull(strList) And strList<>"" And strList<>"0" Then
			Dim strArray,i,n,m_strID,CHECK_ID
			Dim TempIDlist()
			strArray=Split(strList, ",")
			n=0
			m_strID = ","
			For i=0 To UBound(strArray)
				CHECK_ID = Trim(strArray(i))
				If CHECK_ID<>"" And IsNumeric(CHECK_ID) And CHECK_ID<>"0" Then
					If InStr(m_strID,","& CHECK_ID &",") = 0 Then
						ReDim Preserve TempIDlist(n)
						TempIDlist(n) = CHECK_ID
						n=n+1
					End If
					m_strID = m_strID & CHECK_ID &","
				End If
			Next
			CheckIDlist=Join(TempIDlist, ",")
		Else
			CheckIDlist=""
		End If
	End Function

	Private Sub setXmlAttribute(iXMLDom)
		If IsNull(iXMLDom.documentElement.getAttribute("channelid")) Then iXMLDom.documentElement.setAttribute "channelid","0"
		If IsNull(iXMLDom.documentElement.getAttribute("classid")) Then iXMLDom.documentElement.setAttribute "classid","0"
		If IsNull(iXMLDom.documentElement.getAttribute("specialid")) Then iXMLDom.documentElement.setAttribute "specialid","0"
		If IsNull(iXMLDom.documentElement.getAttribute("maxnum")) Then iXMLDom.documentElement.setAttribute "maxnum","0"
		If IsNull(iXMLDom.documentElement.getAttribute("type")) Then iXMLDom.documentElement.setAttribute "type","0"
		If IsNull(iXMLDom.documentElement.getAttribute("setcache")) Then iXMLDom.documentElement.setAttribute "setcache","0"
		If IsNull(iXMLDom.documentElement.getAttribute("node")) Then iXMLDom.documentElement.setAttribute "node","datalist"
		If IsNull(iXMLDom.documentElement.getAttribute("width")) Then iXMLDom.documentElement.setAttribute "width","0"
		If IsNull(iXMLDom.documentElement.getAttribute("height")) Then iXMLDom.documentElement.setAttribute "height","0"
		If IsNull(iXMLDom.documentElement.getAttribute("length")) Then iXMLDom.documentElement.setAttribute "length","0"
		If IsNull(iXMLDom.documentElement.getAttribute("datemode")) Then iXMLDom.documentElement.setAttribute "datemode","yyyy-MM-dd"
		If IsNull(iXMLDom.documentElement.getAttribute("showcate")) Then iXMLDom.documentElement.setAttribute "showcate","0"
		If IsNull(iXMLDom.documentElement.getAttribute("showdate")) Then iXMLDom.documentElement.setAttribute "showdate","0"
		If IsNull(iXMLDom.documentElement.getAttribute("image")) Then iXMLDom.documentElement.setAttribute "image","0"
		If IsNull(iXMLDom.documentElement.getAttribute("target")) Then iXMLDom.documentElement.setAttribute "target","0"
		If IsNull(iXMLDom.documentElement.getAttribute("notitle")) Then iXMLDom.documentElement.setAttribute "notitle","0"
		If IsNull(iXMLDom.documentElement.getAttribute("showmin")) Then iXMLDom.documentElement.setAttribute "showmin","0"
		If IsNull(iXMLDom.documentElement.getAttribute("eachline")) Then iXMLDom.documentElement.setAttribute "eachline","0"
		If IsNull(iXMLDom.documentElement.getAttribute("action")) Then iXMLDom.documentElement.setAttribute "action","0"
		If IsNull(iXMLDom.documentElement.getAttribute("select")) Then iXMLDom.documentElement.setAttribute "select","0"
		If IsNull(iXMLDom.documentElement.getAttribute("strlen")) Then iXMLDom.documentElement.setAttribute "strlen","0"
		If IsNull(iXMLDom.documentElement.getAttribute("ellipsis")) Then iXMLDom.documentElement.setAttribute "ellipsis","..."
		If Trim(iXMLDom.documentElement.getAttribute("ellipsis"))="0" Then
			NewAsp.Ellipsis=""
		Else
			NewAsp.Ellipsis=iXMLDom.documentElement.getAttribute("ellipsis")
		End If
	End Sub

	Private Sub setAttributesNode(Node,datalist,listid,strImage,showcate,iXMLDom)
		Dim strLink1,strLink2,strLink3,strImageLink
		If CLng(Node.selectSingleNode("@binddomain").text)=1 Then
			Node.selectSingleNode("@channeldir").text=""
			Node.attributes.setNamedItem(datalist.createNode(2,"url","")).text=Node.selectSingleNode("@domainname").text&"/"
			If CLng(Node.selectSingleNode("@iscreatehtml").text)=0 Then
				Node.selectSingleNode("@domainname").text=Node.selectSingleNode("@domainname").text&"/"
			End If
		Else
			If NewAsp.BindDomain=1 Or IsDispayDomain Then
				Node.attributes.setNamedItem(datalist.createNode(2,"url","")).text=NewAsp.MainDomain&NewAsp.InstallDir&Node.selectSingleNode("@channeldir").text
			Else
				Node.attributes.setNamedItem(datalist.createNode(2,"url","")).text=NewAsp.InstallDir&Node.selectSingleNode("@channeldir").text
			End If
			'-- 如果所在频道绑定域名，转换主域名
			If CLng(Node.selectSingleNode("@iscreatehtml").text)=0 Then
				If NewAsp.BindDomain=1 Or IsDispayDomain Then
					Node.selectSingleNode("@domainname").text=NewAsp.MainDomain&NewAsp.InstallDir&Node.selectSingleNode("@channeldir").text
				Else
					Node.selectSingleNode("@domainname").text=NewAsp.InstallDir&Node.selectSingleNode("@channeldir").text
				End If
			Else
				If NewAsp.BindDomain=1 Or IsDispayDomain Then
					Node.selectSingleNode("@domainname").text=NewAsp.MainDomain
				Else
					Node.selectSingleNode("@domainname").text=""
				End If
			End If
		End If
		strLink3=Node.selectSingleNode("@domainname").text&"comment.asp?id="&listid
		If CLng(Node.selectSingleNode("@iscreatehtml").text)=0 Then
			If IsURLRewrite Then
				strLink1=CheckURLRewrite(Node.selectSingleNode("@domainname").text,listid&Node.selectSingleNode("@htmlextname").text)
				strLink2=CheckURLRewrite(Node.selectSingleNode("@domainname").text,"list_1_"&Node.selectSingleNode("@classid").text&Node.selectSingleNode("@htmlextname").text)
			Else
				strLink1=Node.selectSingleNode("@domainname").text&"show.asp?id="&listid
				strLink2=Node.selectSingleNode("@domainname").text&"list.asp?classid="&Node.selectSingleNode("@classid").text
			End If
		Else
			strLink1=Node.selectSingleNode("@domainname").text&NewAsp.HtmlDestination(Node.selectSingleNode("@infodestination").text, Node.selectSingleNode("@channeldir").text, Node.selectSingleNode("@htmlfiledate").text,Node.selectSingleNode("@htmlfiledir").text,Node.selectSingleNode("@classid").text,listid,1,"")
			If showcate=0 Then
				strLink2=""
			Else
				strLink2=Node.selectSingleNode("@domainname").text&NewAsp.HtmlDestination(Node.selectSingleNode("@sortdestination").text, Node.selectSingleNode("@channeldir").text, Node.selectSingleNode("@htmlfiledate").text,Node.selectSingleNode("@htmlfiledir").text,Node.selectSingleNode("@classid").text,listid,1,"")
			End If
		End If
		If Len(Node.selectSingleNode("@outerlinks").text&"")>8 Then
			strLink1=Node.selectSingleNode("@outerlinks").text
		End If
		If Len(strImage&"")>1 Then
			strImageLink=NewAsp.GetImagePath(strImage,Node.selectSingleNode("@url").text)
			Node.attributes.setNamedItem(datalist.createNode(2,"img","")).text=NewAsp.GetFlashAndPic(strImageLink,NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("height")),NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("width")))
		Else
			strImageLink=""
			Node.attributes.setNamedItem(datalist.createNode(2,"img","")).text=""
		End If
		Node.attributes.setNamedItem(datalist.createNode(2,"link","")).text=strLink1
		Node.attributes.setNamedItem(datalist.createNode(2,"link2","")).text=strLink2
		Node.attributes.setNamedItem(datalist.createNode(2,"link3","")).text=strLink3
		Node.attributes.setNamedItem(datalist.createNode(2,"imglink","")).text=strImageLink
	End Sub

	Private Sub LoadNewsList(iXMLDom)
		Dim Rs,SQL,i,Node,strQuery,sAppID
		Dim datalist,rootNode
		Dim channid,classid,specialid,maxnum,stype
		Dim setcache,imgWidth,imgHeight,strLength,datemode
		Dim showcate,showdate,showimg,strTarget,NoTitle
		Dim cLength,sTitle,Eachline,w,strwidth,strSQL,strlen,strField,strContent

		setXmlAttribute iXMLDom

		channid		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("channelid"))
		classid		= CheckIDlist(iXMLDom.documentElement.getAttribute("classid"))
		specialid	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("specialid"))
		maxnum		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("maxnum"))
		stype		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("type"))
		setcache	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("setcache"))
		rootNode	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("node"))
		imgWidth	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("width"))
		imgHeight	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("height"))
		strLength	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("length"))
		datemode	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("datemode"))
		showcate	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("showcate"))
		showdate	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("showdate"))
		showimg		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("image"))
		strTarget	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("target"))
		NoTitle		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("notitle"))
		Eachline	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("eachline"))
		strlen		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("strlen"))
		strSQL		= iXMLDom.documentElement.getAttribute("sql")&""
		strField	= iXMLDom.documentElement.getAttribute("field")&""
		setLineWidth Eachline,strwidth,w
		If strlen>0 Then
			If InStr(LCase(strField),".content")=0 Then
				strField="A.content,"
			End If
		End If
		If Len(datemode)=0 Then datemode="yyyy-MM-dd"
		If setcache="" Then setcache="0"
		If maxnum=0 Then maxnum=10
		If rootNode = "" Or rootNode = "row" Or rootNode = "xml" Then rootNode = "datalist"
		sAppID		= NewAsp.CacheName &"_newslist_"& setcache
		Select Case stype
			'### 1=最新推荐,2=最新热门,3=热门推荐,4=最新置顶,5=图片新闻
			'### 6=本日热门,7=本周热门,8=本月热门,9=随机显示
			Case 1: strQuery="And A.isBest>0 ORDER BY A.WriteTime DESC ,A.ArticleID DESC"
			Case 2: strQuery="ORDER BY A.AllHits DESC ,A.ArticleID DESC"
			Case 3: strQuery="And A.isBest>0 ORDER BY A.AllHits DESC ,A.ArticleID DESC"
			Case 4: strQuery="And A.isTop>0 ORDER BY A.WriteTime DESC ,A.ArticleID DESC"
			Case 5: strQuery="And (A.BriefTopic=1 Or A.BriefTopic=2) ORDER BY A.WriteTime DESC ,A.ArticleID DESC"
			Case 6: strQuery="ORDER BY A.DayHits DESC ,A.ArticleID DESC"
			Case 7: strQuery="ORDER BY A.WeekHits DESC ,A.ArticleID DESC"
			Case 8: strQuery="ORDER BY A.MonthHits DESC ,A.ArticleID DESC"
			Case 9
				If IsSqlDataBase = 1 Then
					strQuery="ORDER BY newid()"
				Else
					strQuery="ORDER BY rnd(A.ArticleID)"
				End If
			Case 10: strQuery="ORDER BY A.isTop DESC ,A.WriteTime DESC ,A.ArticleID DESC"
			Case 11: strQuery="And A.bad<A.good ORDER BY A.good DESC ,A.WriteTime DESC ,A.ArticleID DESC"
			Case Else
				strQuery="ORDER BY A.WriteTime DESC ,A.ArticleID DESC"
		End Select
		If Len(strSQL)>2 Then strQuery=strSQL
		If showimg>0 Then
			strQuery="And A.ImageUrl<>'' "&strQuery
		End If
		If specialid>0 Then
			strQuery="And A.SpecialID="&specialid&" "&strQuery
		End If

		If Len(classid)>0 And classid<>"0" Then
			If InStr(classid,",")=0 Then
				Dim classXmlDom,classNode,ChildStr,iChannID
				If channid=0 Then
					iChannID=1
				Else
					iChannID=channid
				End If
				If Not IsObject(Application(NewAsp.CacheName&"_classlist_"&iChannID)) Then NewAsp.LoadClassList(iChannID)
				Set classXmlDom=Application(NewAsp.CacheName&"_classlist_"&iChannID)
				Set classNode=classXmlDom.documentElement.selectSingleNode("row[@classid='"&classid&"']")
				If Not classNode is Nothing Then
					ChildStr=classNode.selectSingleNode("@childstr").text
				Else
					ChildStr="0"
				End If
				Set classNode = Nothing
				Set classXmlDom = Nothing
				If ChildStr<>"0" And ChildStr<>"" Then
					If InStr(ChildStr,",")=0 Then
						strQuery="And A.classid="&ChildStr&" "&strQuery
					Else
						strQuery="And A.classid in ("&ChildStr&") "&strQuery
					End If
				End If
			Else
				strQuery="And A.classid in ("&classid&") "&strQuery
			End If
		End If
		If channid>0 Then
			strQuery="And A.ChannelID="&channid&" "&strQuery
		End If
		SQL=" A.ArticleID,A.ClassID,A.ColorMode,A.FontMode,A.title,A.BriefTopic,A.subtitle,A.description,A.OuterLinks,"&strField&"A.Author,A.AllHits,A.WriteTime,A.HtmlFileDate,A.isBest,A.ImageUrl,A.star,A.IsTop,"
		SQL="SELECT TOP " & maxnum & SQL & " C.ClassName,C.ClassDir,C.HtmlFileDir,B.ChannelID,B.ChannelName,B.ChannelDir,B.BindDomain,B.DomainName,B.IsCreateHtml,B.HtmlExtName,B.LeastHotHist,B.SortDestination,B.InfoDestination,B.MoreDestination FROM ([NC_Article] A INNER JOIN [NC_Classify] C ON A.ClassID=C.ClassID) INNER JOIN [NC_Channel] B ON A.ChannelID=B.ChannelID WHERE A.isAccept>0 " & strQuery
		If Not CacheIsObject(setcache,sAppID) Then
			Set Rs=NewAsp.Execute(SQL)
			Set datalist=NewAsp.RecordsetToxml(rs,"row",rootNode)
			If EnabledCache(setcache) Then
				Application.Lock
					Set Application(sAppID)=datalist
				Application.unLock
			End If
			Rs.Close : Set Rs=Nothing
			SQL=Empty
			If Not datalist Is Nothing Then
				i = 0
				For Each Node in datalist.documentElement.SelectNodes("row")
					i = i + 1
					Node.attributes.setNamedItem(datalist.createNode(2,"i","")).text = i
					Node.attributes.setNamedItem(datalist.createNode(2,"w","")).text = w
					Node.attributes.setNamedItem(datalist.createNode(2,"linewidth","")).text = strwidth
					If Eachline>0 Then
						If (i Mod Eachline)=0 Then
							Node.attributes.setNamedItem(datalist.createNode(2,"br","")).text="<br style=""clear:both"" />"
						Else
							Node.attributes.setNamedItem(datalist.createNode(2,"br","")).text=""
						End If
					Else
						Node.attributes.setNamedItem(datalist.createNode(2,"br","")).text=""
					End If
					If (i mod 2) = 0 Then
						Node.attributes.setNamedItem(datalist.createNode(2,"m","")).text = 2
					Else
						Node.attributes.setNamedItem(datalist.createNode(2,"m","")).text = 1
					End If
					Node.attributes.setNamedItem(datalist.createNode(2,"new","")).text=NewAsp.ChkIsNewDate(Node.selectSingleNode("@writetime").text)
					If showdate=0 Then
						Node.selectSingleNode("@writetime").text=""
						Node.attributes.setNamedItem(datalist.createNode(2,"date","")).text=""
					Else
						Node.selectSingleNode("@writetime").text=NewAsp.DateToString(Node.selectSingleNode("@writetime").text,datemode)
						Node.attributes.setNamedItem(datalist.createNode(2,"date","")).text=NewAsp.FormatToDate(Node.selectSingleNode("@writetime").text,datemode)
					End If
					If showcate=0 Then
						Node.selectSingleNode("@classname").text=""
						cLength=0
					Else
						cLength=NewAsp.strLength(Node.selectSingleNode("@classname").text)+2
					End If
					If strlen>0 Then
						If strlen>2 Then
							strContent=NewAsp.CutString(Node.selectSingleNode("@content").text,strlen)
							Node.selectSingleNode("@content").text=strContent
						End If
					End If
					sTitle=NewAsp.CutStr(Node.selectSingleNode("@title").text,strLength-cLength)
					Node.selectSingleNode("@title").text=NewAsp.RemoveHtml(Node.selectSingleNode("@title").text)

					setAttributesNode Node,datalist,Node.selectSingleNode("@articleid").text,Node.selectSingleNode("@imageurl").text,showcate,iXMLDom
					Node.attributes.setNamedItem(datalist.createNode(2,"datetime","")).text=Node.selectSingleNode("@writetime").text
					Node.attributes.setNamedItem(datalist.createNode(2,"topic","")).text=NewAsp.ReadFontMode(Replace(sTitle, "<", "&lt;"),Node.selectSingleNode("@colormode").text,Node.selectSingleNode("@fontmode").text)
					Node.attributes.setNamedItem(datalist.createNode(2,"mintopic","")).text=NewAsp.ReadBriefTopic(Node.selectSingleNode("@brieftopic").text)
					If Len(strTarget)>1 Then
						Node.attributes.setNamedItem(datalist.createNode(2,"linktarget","")).text=" target="""&strTarget&""""
					Else
						Node.attributes.setNamedItem(datalist.createNode(2,"linktarget","")).text=""
					End If
				Next
				Set Node = Nothing
			End If
		Else
			Set datalist=Application(sAppID)
		End If
		If Not datalist Is Nothing Then iXMLDom.documentElement.appendChild(datalist.documentElement.cloneNode(True))
		Set datalist=Nothing
	End Sub

	Private Sub LoadSoftList(iXMLDom)
		Dim Rs,SQL,i,Node,strQuery,sAppID
		Dim datalist,rootNode
		Dim channid,classid,specialid,maxnum,stype
		Dim setcache,imgWidth,imgHeight,strLength,datemode
		Dim showcate,showdate,showimg,strTarget,NoTitle,strSQL,strlen,strField,strContent
		Dim cLength,sTitle,softType,showType,Eachline,w,strwidth

		setXmlAttribute iXMLDom

		channid		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("channelid"))
		classid		= CheckIDlist(iXMLDom.documentElement.getAttribute("classid"))
		specialid	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("specialid"))
		maxnum		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("maxnum"))
		stype		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("type"))
		setcache	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("setcache"))
		rootNode	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("node"))
		imgWidth	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("width"))
		imgHeight	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("height"))
		strLength	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("length"))
		datemode	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("datemode"))
		showcate	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("showcate"))
		showdate	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("showdate"))
		showimg		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("image"))
		strTarget	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("target"))
		NoTitle		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("notitle"))
		softType	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("stype"))
		showType	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("showtype"))
		Eachline	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("eachline"))
		strlen		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("strlen"))
		strSQL		= iXMLDom.documentElement.getAttribute("sql")&""
		strField	= iXMLDom.documentElement.getAttribute("field")&""
		setLineWidth Eachline,strwidth,w
		If strlen>0 Then
			If InStr(LCase(strField),".content")=0 Then
				strField="A.content,"
			End If
		End If
		If Len(datemode)=0 Then datemode="yyyy-MM-dd"
		If setcache="" Then setcache="0"
		If softType="" Then softType="国产软件"
		If maxnum=0 Then maxnum=10
		If rootNode = "" Or rootNode = "row" Or rootNode = "xml" Then rootNode = "datalist"
		sAppID		= NewAsp.CacheName &"_softlist_"& setcache
		Select Case stype
			'### 1=最新推荐,2=最新热门,3=热门推荐,4=最新置顶,5=五星级列表
			'### 6=本日热门,7=本周热门,8=本月热门,9=随机显示
			Case 1: strQuery="And A.isBest>0 ORDER BY A.softtime DESC ,A.softid DESC"
			Case 2: strQuery="ORDER BY A.AllHits DESC ,A.softid DESC"
			Case 3: strQuery="And A.isBest>0 ORDER BY A.AllHits DESC ,A.softid DESC"
			Case 4: strQuery="And A.isTop>0 ORDER BY A.softtime DESC ,A.softid DESC"
			Case 5: strQuery="And A.star=5 ORDER BY A.softtime DESC ,A.softid DESC"
			Case 6: strQuery="ORDER BY A.DayHits DESC ,A.softid DESC"
			Case 7: strQuery="ORDER BY A.WeekHits DESC ,A.softid DESC"
			Case 8: strQuery="ORDER BY A.MonthHits DESC ,A.softid DESC"
			Case 9
				If IsSqlDataBase = 1 Then
					strQuery="ORDER BY newid()"
				Else
					strQuery="ORDER BY rnd(A.softid)"
				End If
			Case 10: strQuery="ORDER BY A.isTop DESC ,A.softtime DESC ,A.softid DESC"
			Case 11: strQuery="And A.bad<A.good ORDER BY A.good DESC ,A.softtime DESC ,A.softid DESC"
			Case Else
				strQuery="ORDER BY A.softtime DESC ,A.softid DESC"
		End Select
		If Len(strSQL)>2 Then strQuery=strSQL
		If showimg>0 Then
			strQuery="And A.SoftImage<>'' "&strQuery
		End If
		If showType>0 And Len(softType)>0 Then
			strQuery="And A.SoftType='"&softType&"' "&strQuery
		End If
		If specialid>0 Then
			strQuery="And A.SpecialID="&specialid&" "&strQuery
		End If
		If Len(classid)>0 And classid<>"0" Then
			If InStr(classid,",")=0 Then
				Dim classXmlDom,classNode,ChildStr,iChannID
				If channid=0 Then
					iChannID=2
				Else
					iChannID=channid
				End If
				If Not IsObject(Application(NewAsp.CacheName&"_classlist_"&iChannID)) Then NewAsp.LoadClassList(iChannID)
				Set classXmlDom=Application(NewAsp.CacheName&"_classlist_"&iChannID)
				Set classNode=classXmlDom.documentElement.selectSingleNode("row[@classid='"&classid&"']")
				If Not classNode is Nothing Then
					ChildStr=classNode.selectSingleNode("@childstr").text
				Else
					ChildStr="0"
				End If
				Set classNode = Nothing
				Set classXmlDom = Nothing
				If ChildStr<>"0" And ChildStr<>"" Then
					If InStr(ChildStr,",")=0 Then
						strQuery="And A.classid="&ChildStr&" "&strQuery
					Else
						strQuery="And A.classid in ("&ChildStr&") "&strQuery
					End If
				End If
			Else
				strQuery="And A.classid in ("&classid&") "&strQuery
			End If
		End If
		If channid>0 Then
			strQuery="And A.ChannelID="&channid&" "&strQuery
		End If
		SQL=" A.softid,A.classid,A.ColorMode,A.FontMode,A.SoftName,A.SoftVer,A.subtitle,A.description,A.OuterLinks,"&strField&"A.Softsize,A.Author,A.SoftImage,A.Previewimg,A.AllHits,A.SoftTime,A.plugin,A.HtmlFileDate,A.isBest,A.OuterLinks,A.Regsite,A.star,A.IsTop,"
		SQL="SELECT TOP " & maxnum & SQL & " C.ClassName,C.ClassDir,C.HtmlFileDir,B.ChannelID,B.ChannelName,B.ChannelDir,B.BindDomain,B.DomainName,B.IsCreateHtml,B.HtmlExtName,B.LeastHotHist,B.SortDestination,B.InfoDestination,B.MoreDestination FROM ([NC_SoftList] A INNER JOIN [NC_Classify] C ON A.ClassID=C.ClassID) INNER JOIN [NC_Channel] B ON A.ChannelID=B.ChannelID WHERE A.isAccept>0 " & strQuery
		If Not CacheIsObject(setcache,sAppID) Then
			Set Rs=NewAsp.Execute(SQL)
			Set datalist=NewAsp.RecordsetToxml(rs,"row",rootNode)
			If EnabledCache(setcache) Then
				Application.Lock
					Set Application(sAppID)=datalist
				Application.unLock
			End If
			Rs.Close : Set Rs=Nothing
			SQL=Empty
			If Not datalist Is Nothing Then
				i = 0
				For Each Node in datalist.documentElement.SelectNodes("row")
					i = i + 1
					Node.attributes.setNamedItem(datalist.createNode(2,"i","")).text = i
					Node.attributes.setNamedItem(datalist.createNode(2,"w","")).text = w
					Node.attributes.setNamedItem(datalist.createNode(2,"linewidth","")).text = strwidth
					If Eachline>0 Then
						If (i Mod Eachline)=0 Then
							Node.attributes.setNamedItem(datalist.createNode(2,"br","")).text="<br style=""clear:both"" />"
						Else
							Node.attributes.setNamedItem(datalist.createNode(2,"br","")).text=""
						End If
					Else
						Node.attributes.setNamedItem(datalist.createNode(2,"br","")).text=""
					End If
					If (i mod 2) = 0 Then
						Node.attributes.setNamedItem(datalist.createNode(2,"m","")).text = 2
					Else
						Node.attributes.setNamedItem(datalist.createNode(2,"m","")).text = 1
					End If
					Node.attributes.setNamedItem(datalist.createNode(2,"new","")).text=NewAsp.ChkIsNewDate(Node.selectSingleNode("@softtime").text)
					If showdate=0 Then
						Node.selectSingleNode("@softtime").text=""
						Node.attributes.setNamedItem(datalist.createNode(2,"date","")).text=""
					Else
						Node.selectSingleNode("@softtime").text=NewAsp.DateToString(Node.selectSingleNode("@softtime").text,datemode)
						Node.attributes.setNamedItem(datalist.createNode(2,"date","")).text=NewAsp.FormatToDate(Node.selectSingleNode("@softtime").text,datemode)
					End If
					If showcate=0 Then
						Node.selectSingleNode("@classname").text=""
						cLength=0
					Else
						cLength=NewAsp.strLength(Node.selectSingleNode("@classname").text)+2
					End If
					If strlen>0 Then
						If strlen>2 Then
							strContent=NewAsp.CutString(Node.selectSingleNode("@content").text,strlen)
							Node.selectSingleNode("@content").text=strContent
						End If
					End If
					sTitle=NewAsp.CutStr(Trim(Node.selectSingleNode("@softname").text&" "&Node.selectSingleNode("@softver").text),strLength-cLength)
					Node.selectSingleNode("@softname").text=Replace(Node.selectSingleNode("@softname").text, "<", "&lt;")
					Node.attributes.setNamedItem(datalist.createNode(2,"size","")).text=NewAsp.BytesToString(NewAsp.ChkNumeric(Node.selectSingleNode("@softsize").text)*1024)
					setAttributesNode Node,datalist,Node.selectSingleNode("@softid").text,Node.selectSingleNode("@softimage").text,showcate,iXMLDom
					Node.attributes.setNamedItem(datalist.createNode(2,"datetime","")).text=Node.selectSingleNode("@softtime").text
					Node.selectSingleNode("@softimage").text=NewAsp.GetImagePath(Node.selectSingleNode("@softimage").text,Node.selectSingleNode("@url").text)
					Node.selectSingleNode("@previewimg").text=NewAsp.GetImagePath(Node.selectSingleNode("@previewimg").text,Node.selectSingleNode("@url").text)
					Node.attributes.setNamedItem(datalist.createNode(2,"topic","")).text=NewAsp.ReadFontMode(Replace(sTitle, "<", "&lt;"),Node.selectSingleNode("@colormode").text,Node.selectSingleNode("@fontmode").text)
					Node.attributes.setNamedItem(datalist.createNode(2,"title","")).text=Trim(NewAsp.RemoveHtml(Node.selectSingleNode("@softname").text&" "&Node.selectSingleNode("@softver").text))
					If Len(strTarget)>1 Then
						Node.attributes.setNamedItem(datalist.createNode(2,"linktarget","")).text=" target="""&strTarget&""""
					Else
						Node.attributes.setNamedItem(datalist.createNode(2,"linktarget","")).text=""
					End If
				Next
				Set Node = Nothing
			End If
		Else
			Set datalist=Application(sAppID)
		End If
		If Not datalist Is Nothing Then iXMLDom.documentElement.appendChild(datalist.documentElement.cloneNode(True))
		Set datalist=Nothing
	End Sub

	Private Sub LoadFlashList(iXMLDom)
		Dim Rs,SQL,i,Node,strQuery,sAppID
		Dim datalist,rootNode
		Dim channid,classid,specialid,maxnum,stype
		Dim setcache,imgWidth,imgHeight,strLength,datemode
		Dim showcate,showdate,showimg,strTarget,NoTitle
		Dim cLength,sTitle,Eachline,w,strwidth,strSQL,strlen,strField,strContent

		setXmlAttribute iXMLDom

		channid		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("channelid"))
		classid		= CheckIDlist(iXMLDom.documentElement.getAttribute("classid"))
		specialid	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("specialid"))
		maxnum		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("maxnum"))
		stype		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("type"))
		setcache	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("setcache"))
		rootNode	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("node"))
		imgWidth	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("width"))
		imgHeight	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("height"))
		strLength	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("length"))
		datemode	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("datemode"))
		showcate	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("showcate"))
		showdate	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("showdate"))
		showimg		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("image"))
		strTarget	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("target"))
		NoTitle		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("notitle"))
		Eachline	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("eachline"))
		strlen		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("strlen"))
		strSQL		= iXMLDom.documentElement.getAttribute("sql")&""
		strField	= iXMLDom.documentElement.getAttribute("field")&""
		setLineWidth Eachline,strwidth,w
		If strlen>0 Then
			If InStr(LCase(strField),".content")=0 Then
				strField="A.Introduce as content,"
			End If
		End If
		If Len(datemode)=0 Then datemode="yyyy-MM-dd"
		If setcache="" Then setcache="0"
		If maxnum=0 Then maxnum=10
		If rootNode = "" Or rootNode = "row" Or rootNode = "xml" Then rootNode = "datalist"
		sAppID		= NewAsp.CacheName &"_flashlist_"& setcache
		Select Case stype
			'### 1=最新推荐,2=最新热门,3=热门推荐,4=最新置顶,5=五星级列表
			'### 6=本日热门,7=本周热门,8=本月热门,9=随机显示
			Case 1: strQuery="And A.isBest>0 ORDER BY A.addtime DESC ,A.flashid DESC"
			Case 2: strQuery="ORDER BY A.AllHits DESC ,A.flashid DESC"
			Case 3: strQuery="And A.isBest>0 ORDER BY A.AllHits DESC ,A.flashid DESC"
			Case 4: strQuery="And A.isTop>0 ORDER BY A.addtime DESC ,A.flashid DESC"
			Case 5: strQuery="And A.star=5 ORDER BY A.addtime DESC ,A.flashid DESC"
			Case 6: strQuery="ORDER BY A.DayHits DESC ,A.flashid DESC"
			Case 7: strQuery="ORDER BY A.WeekHits DESC ,A.flashid DESC"
			Case 8: strQuery="ORDER BY A.MonthHits DESC ,A.flashid DESC"
			Case 9
				If IsSqlDataBase = 1 Then
					strQuery="ORDER BY newid()"
				Else
					strQuery="ORDER BY rnd(A.flashid)"
				End If
			Case 10: strQuery="ORDER BY A.isTop DESC ,A.addtime DESC ,A.flashid DESC"
			Case 11: strQuery="And A.bad<A.good ORDER BY A.good DESC ,A.addtime DESC ,A.flashid DESC"
			Case Else
				strQuery="ORDER BY A.addtime DESC ,A.flashid DESC"
		End Select
		If Len(strSQL)>2 Then strQuery=strSQL
		If showimg>0 Then
			strQuery="And A.miniature<>'' "&strQuery
		End If
		If specialid>0 Then
			strQuery="And A.SpecialID="&specialid&" "&strQuery
		End If
		If Len(classid)>0 And classid<>"0" Then
			If InStr(classid,",")=0 Then
				Dim classXmlDom,classNode,ChildStr,iChannID
				If channid=0 Then
					iChannID=5
				Else
					iChannID=channid
				End If
				If Not IsObject(Application(NewAsp.CacheName&"_classlist_"&iChannID)) Then NewAsp.LoadClassList(iChannID)
				Set classXmlDom=Application(NewAsp.CacheName&"_classlist_"&iChannID)
				Set classNode=classXmlDom.documentElement.selectSingleNode("row[@classid='"&classid&"']")
				If Not classNode is Nothing Then
					ChildStr=classNode.selectSingleNode("@childstr").text
				Else
					ChildStr="0"
				End If
				Set classNode = Nothing
				Set classXmlDom = Nothing
				If ChildStr<>"0" And ChildStr<>"" Then
					If InStr(ChildStr,",")=0 Then
						strQuery="And A.classid="&ChildStr&" "&strQuery
					Else
						strQuery="And A.classid in ("&ChildStr&") "&strQuery
					End If
				End If
			Else
				strQuery="And A.classid in ("&classid&") "&strQuery
			End If
		End If
		If channid>0 Then
			strQuery="And A.ChannelID="&channid&" "&strQuery
		End If
		SQL=" A.flashid,A.classid,A.ColorMode,A.FontMode,A.title,A.subtitle,A.description,A.OuterLinks,"&strField&"A.[filesize],A.Author,A.miniature,A.AllHits,A.addTime,A.HtmlFileDate,A.isBest,A.star,A.IsTop,"
		SQL="SELECT TOP " & maxnum & SQL & " C.ClassName,C.ClassDir,C.HtmlFileDir,B.ChannelID,B.ChannelName,B.ChannelDir,B.BindDomain,B.DomainName,B.IsCreateHtml,B.HtmlExtName,B.LeastHotHist,B.SortDestination,B.InfoDestination,B.MoreDestination FROM ([NC_FlashList] A INNER JOIN [NC_Classify] C ON A.ClassID=C.ClassID) INNER JOIN [NC_Channel] B ON A.ChannelID=B.ChannelID WHERE A.isAccept>0 " & strQuery
		If Not CacheIsObject(setcache,sAppID) Then
			Set Rs=NewAsp.Execute(SQL)
			Set datalist=NewAsp.RecordsetToxml(rs,"row",rootNode)
			If EnabledCache(setcache) Then
				Application.Lock
					Set Application(sAppID)=datalist
				Application.unLock
			End If
			Rs.Close : Set Rs=Nothing
			SQL=Empty
			If Not datalist Is Nothing Then
				i = 0
				For Each Node in datalist.documentElement.SelectNodes("row")
					i = i + 1
					Node.attributes.setNamedItem(datalist.createNode(2,"i","")).text = i
					Node.attributes.setNamedItem(datalist.createNode(2,"w","")).text = w
					Node.attributes.setNamedItem(datalist.createNode(2,"linewidth","")).text = strwidth
					If Eachline>0 Then
						If (i Mod Eachline)=0 Then
							Node.attributes.setNamedItem(datalist.createNode(2,"br","")).text="<br style=""clear:both"" />"
						Else
							Node.attributes.setNamedItem(datalist.createNode(2,"br","")).text=""
						End If
					Else
						Node.attributes.setNamedItem(datalist.createNode(2,"br","")).text=""
					End If
					If (i mod 2) = 0 Then
						Node.attributes.setNamedItem(datalist.createNode(2,"m","")).text = 2
					Else
						Node.attributes.setNamedItem(datalist.createNode(2,"m","")).text = 1
					End If
					Node.attributes.setNamedItem(datalist.createNode(2,"new","")).text=NewAsp.ChkIsNewDate(Node.selectSingleNode("@addtime").text)
					If showdate=0 Then
						Node.selectSingleNode("@addtime").text=""
						Node.attributes.setNamedItem(datalist.createNode(2,"date","")).text=""
					Else
						Node.selectSingleNode("@addtime").text=NewAsp.DateToString(Node.selectSingleNode("@addtime").text,datemode)
						Node.attributes.setNamedItem(datalist.createNode(2,"date","")).text=NewAsp.FormatToDate(Node.selectSingleNode("@addtime").text,datemode)
					End If
					If showcate=0 Then
						Node.selectSingleNode("@classname").text=""
						cLength=0
					Else
						cLength=NewAsp.strLength(Node.selectSingleNode("@classname").text)+2
					End If
					If strlen>0 Then
						If strlen>2 Then
							strContent=NewAsp.CutString(Node.selectSingleNode("@content").text,strlen)
							Node.selectSingleNode("@content").text=strContent
						End If
					End If
					sTitle=NewAsp.CutStr(Node.selectSingleNode("@title").text,strLength-cLength)
					Node.selectSingleNode("@title").text=NewAsp.RemoveHtml(Node.selectSingleNode("@title").text)

					setAttributesNode Node,datalist,Node.selectSingleNode("@flashid").text,Node.selectSingleNode("@miniature").text,showcate,iXMLDom
					Node.attributes.setNamedItem(datalist.createNode(2,"datetime","")).text=Node.selectSingleNode("@addtime").text
					Node.attributes.setNamedItem(datalist.createNode(2,"topic","")).text=NewAsp.ReadFontMode(Replace(sTitle, "<", "&lt;"),Node.selectSingleNode("@colormode").text,Node.selectSingleNode("@fontmode").text)
					'Node.attributes.setNamedItem(datalist.createNode(2,"mintopic","")).text=NewAsp.ReadBriefTopic(Node.selectSingleNode("@brieftopic").text)
					If Len(strTarget)>1 Then
						Node.attributes.setNamedItem(datalist.createNode(2,"linktarget","")).text=" target="""&strTarget&""""
					Else
						Node.attributes.setNamedItem(datalist.createNode(2,"linktarget","")).text=""
					End If
				Next
				Set Node = Nothing
			End If
		Else
			Set datalist=Application(sAppID)
		End If
		If Not datalist Is Nothing Then iXMLDom.documentElement.appendChild(datalist.documentElement.cloneNode(True))
		Set datalist=Nothing
	End Sub

	Private Sub LoadTagList(iXMLDom)
		On Error Resume Next
		Dim SQL,Rs,strQuery,datalist,Node,i,sAppID
		Dim channid,classid,specialid,maxnum,stype
		Dim modules,setcache,default,rootNode
		Dim strTitle,strLinks

		setXmlAttribute iXMLDom

		channid		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("channelid"))
		classid		= CheckIDlist(iXMLDom.documentElement.getAttribute("classid"))
		specialid	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("specialid"))
		maxnum		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("maxnum"))
		stype		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("type"))
		modules		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("modules"))
		setcache	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("setcache"))
		default		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("default"))
		rootNode	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("node"))

		If channid=0 Or channid=4 Or channid=9999 Then channid= default

		If setcache="" Then setcache="0"
		If maxnum=0 Then maxnum=10
		If rootNode = "" Or rootNode = "row" Or rootNode = "xml" Then rootNode = "datalist"
		sAppID		= NewAsp.CacheName &"_taglist_"& setcache

		Select Case stype
			'### 1=热门标签,2=热门标签,3=推荐标签,4=置顶标签,5=热门推荐
			'### 6=热门推荐,7=热门置顶,8=热门置顶,9=随机显示,0=最新标签
			Case 1: strQuery="ORDER BY A.TagCount DESC ,A.tagid DESC"
			Case 2: strQuery="ORDER BY A.TagHits DESC ,A.tagid DESC"
			Case 3: strQuery="And A.isBest>0 ORDER BY A.tagid DESC"
			Case 4: strQuery="And A.isTop>0 ORDER BY A.tagid DESC"
			Case 5: strQuery="And A.isBest>0 ORDER BY A.TagCount DESC ,A.tagid DESC"
			Case 6: strQuery="And A.isBest>0 ORDER BY A.TagHits DESC ,A.tagid DESC"
			Case 7: strQuery="And A.isTop>0 ORDER BY A.TagCount DESC ,A.tagid DESC"
			Case 8: strQuery="And A.isTop>0 ORDER BY A.TagHits DESC ,A.tagid DESC"
			Case 9
				If IsSqlDataBase = 1 Then
					strQuery="ORDER BY newid()"
				Else
					strQuery="ORDER BY rnd(A.tagid)"
				End If
			Case Else
				strQuery="ORDER BY A.tagid DESC"
		End Select

		If Len(classid)>0 And classid<>"0" Then
			If InStr(classid,",")=0 Then
				Dim classXmlDom,classNode,ChildStr,iChannID
				If channid=0 Then
					iChannID=1
				Else
					iChannID=channid
				End If
				If Not IsObject(Application(NewAsp.CacheName&"_classlist_"&iChannID)) Then NewAsp.LoadClassList(iChannID)
				Set classXmlDom=Application(NewAsp.CacheName&"_classlist_"&iChannID)
				Set classNode=classXmlDom.documentElement.selectSingleNode("row[@classid='"&classid&"']")
				If Not classNode is Nothing Then
					ChildStr=classNode.selectSingleNode("@childstr").text
				Else
					ChildStr="0"
				End If
				Set classNode = Nothing
				Set classXmlDom = Nothing
				If ChildStr<>"0" And ChildStr<>"" Then
					If InStr(ChildStr,",")=0 Then
						strQuery="And A.classid="&ChildStr&" "&strQuery
					Else
						strQuery="And A.classid in ("&ChildStr&") "&strQuery
					End If
				End If
			Else
				strQuery="And A.classid in ("&classid&") "&strQuery
			End If
		End If
		If channid>0 Then
			strQuery="And A.ChannelID="&channid&" "&strQuery
		End If
		If modules>0 Then
			strQuery="And A.modules="&modules&" "&strQuery
		End If
		SQL="SELECT TOP "&maxnum&" A.tagid,A.TagName,A.TagCount,A.TagHits,A.IsBest,A.IsTop,C.ChannelID,C.ChannelDir,C.Modules,C.BindDomain,C.DomainName,C.HtmlExtName FROM [NC_Tags] A INNER JOIN [NC_Channel] C ON A.ChannelID=C.ChannelID WHERE A.TagCount>0 "&strQuery

		If Not CacheIsObject(setcache,sAppID) Then
			Set Rs=NewAsp.Execute(SQL)
			Set datalist=NewAsp.RecordsetToxml(rs,"row",rootNode)
			If EnabledCache(setcache) Then
				Application.Lock
					Set Application(sAppID)=datalist
				Application.unLock
			End If
			Rs.Close : Set Rs=Nothing
			SQL=Empty
			If Not datalist Is Nothing Then
				i = 0
				For Each Node in datalist.documentElement.SelectNodes("row")
					i = i + 1
					Node.attributes.setNamedItem(datalist.createNode(2,"i","")).text = i
					If (i mod 2) = 0 Then
						Node.attributes.setNamedItem(datalist.createNode(2,"m","")).text = 2
					Else
						Node.attributes.setNamedItem(datalist.createNode(2,"m","")).text = 1
					End If
					strTitle=Node.selectSingleNode("@tagname").text

					If CLng(Node.selectSingleNode("@binddomain").text)=1 Then
						Node.selectSingleNode("@domainname").text=Node.selectSingleNode("@domainname").text&"/"
					Else
						If NewAsp.BindDomain=1 Then
							Node.selectSingleNode("@domainname").text=NewAsp.MainDomain&NewAsp.InstallDir&Node.selectSingleNode("@channeldir").text
						Else
							Node.selectSingleNode("@domainname").text=NewAsp.InstallDir&Node.selectSingleNode("@channeldir").text
						End If
					End If
					If IsURLRewrite Then
						strLinks=CheckURLRewrite(Node.selectSingleNode("@domainname").text,"tag-"&Server.URLEncode(strTitle)&"-1"&Node.selectSingleNode("@htmlextname").text)
					Else
						strLinks=Node.selectSingleNode("@domainname").text&"tag.asp?name="&Server.URLEncode(strTitle)
					End If
					Node.attributes.setNamedItem(datalist.createNode(2,"url","")).text=strLinks
					Node.attributes.setNamedItem(datalist.createNode(2,"link","")).text=strLinks
					Node.attributes.setNamedItem(datalist.createNode(2,"title","")).text=strTitle
				Next
				Set Node = Nothing
			End If
		Else
			Set datalist=Application(sAppID)
		End If
		If Not datalist Is Nothing Then iXMLDom.documentElement.appendChild(datalist.documentElement.cloneNode(True))
		Set datalist=Nothing
	End Sub

	Private Sub LoadDataList(iXMLDom,sTokenAttrib)
		Dim datalist
		On Error Resume Next
		setXmlAttribute iXMLDom
		Set datalist=XmlDatalistNode(iXMLDom,sTokenAttrib)
		If Not datalist Is Nothing Then iXMLDom.documentElement.appendChild(datalist.documentElement.cloneNode(True))
		Set datalist=Nothing
		If Err Then Err.Clear
	End Sub

	Private Sub LoadCustomSQLlist(iXMLDom)
		On Error Resume Next
		Dim SQL,Rs,datalist,Node,i
		Dim sAppID
		Dim setcache,maxtop,strSQL,rootNode
		Dim datefield,datemode,topicfield,arrTopicfield,topiclength
		Dim Eachline,strwidth,w
		If IsNull(iXMLDom.documentElement.getAttribute("action")) Then iXMLDom.documentElement.setAttribute "action","0"
		If IsNull(iXMLDom.documentElement.getAttribute("select")) Then iXMLDom.documentElement.setAttribute "select","0"
		setcache		= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("setcache"))
		rootNode		= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("node"))
		strSQL			= iXMLDom.documentElement.getAttribute("sql")
		maxtop			= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("maxtop"))
		datefield		= LCase(NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("datefield")))
		datemode		= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("datemode"))
		topicfield		= LCase(NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("topicfield")))
		topiclength		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("topiclength"))
		Eachline		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("eachline"))
		setLineWidth Eachline,strwidth,w

		If setcache = "" Then setcache = "0"
		If IsNull(strSQL) Then strSQL = ""
		If strSQL="" Then Exit Sub
		If rootNode = "" Or rootNode = "row" Or rootNode = "xml" Then rootNode = "datalist"
		sAppID		= NewAsp.CacheName &"_custom_"& setcache
		If maxtop = 0 Then maxtop = 10
		If maxtop > 500 Then maxtop = 10
		If Not CacheIsObject(setcache,sAppID) Then
			SQL=LCase(strSQL)
			Set Rs = NewAsp.Execute(SQL)
			If Err.Number <> 0 Then
				HandlErr = True
				ErrMsg = "SQL 查询错误,请检查您的SQL查询代码是否正确(" & strSQL & ")"
				Exit Sub
			End If
			Set datalist=NewAsp.RecordsetToxml(rs,"row",rootNode)
			If EnabledCache(setcache) Then
				Application.Lock
					Set Application(sAppID)=datalist
				Application.unLock
			End If
			Rs.Close : Set Rs=Nothing
			SQL=Empty
			If Not datalist Is Nothing Then
				i = 0
				For Each Node in datalist.documentElement.SelectNodes("row")
					i = i + 1
					Node.attributes.setNamedItem(datalist.createNode(2,"i","")).text = i
					If Eachline>0 Then
						If (i Mod Eachline)=0 Then
							Node.attributes.setNamedItem(datalist.createNode(2,"br","")).text="<br style=""clear:both"" />"
						Else
							Node.attributes.setNamedItem(datalist.createNode(2,"br","")).text=""
						End If
					Else
						Node.attributes.setNamedItem(datalist.createNode(2,"br","")).text=""
					End If
					If (i mod 2) = 0 Then
						Node.attributes.setNamedItem(datalist.createNode(2,"m","")).text = 2
					Else
						Node.attributes.setNamedItem(datalist.createNode(2,"m","")).text = 1
					End If
					If Len(datefield)>1 Then
						Node.selectSingleNode("@"&datefield&"").text=NewAsp.DateToString(Node.selectSingleNode("@"&datefield&"").text,datemode)
					End If
					If Len(topicfield)>1 Then
						arrTopicfield=Split(topicfield, ",")
						If UBound(arrTopicfield)=0 Then
							Node.selectSingleNode("@"&arrTopicfield(0)&"").text=NewAsp.CutStr(Node.selectSingleNode("@"&arrTopicfield(0)&"").text,topiclength)
						Else
							Node.attributes.setNamedItem(datalist.createNode(2,""&arrTopicfield(0)&"_"&arrTopicfield(1)&"","")).text=NewAsp.CutStr(Node.selectSingleNode("@"&arrTopicfield(0)&"").text&" "&Node.selectSingleNode("@"&arrTopicfield(1)&"").text,topiclength)
						End If
					End If
				Next
				Set Node = Nothing
			End If
		Else
			Set datalist=Application(sAppID)
		End If
		If Not datalist Is Nothing Then iXMLDom.documentElement.appendChild(datalist.documentElement.cloneNode(True))
		Set datalist=Nothing
	End Sub

	Private Sub LoadChannelMenu(iXMLDom)
		Dim Rs,datalist,Node,i
		Dim sAppID,rootNode
		Dim ChannelUrl,sTitle
		If IsNull(iXMLDom.documentElement.getAttribute("action")) Then iXMLDom.documentElement.setAttribute "action","0"
		If IsNull(iXMLDom.documentElement.getAttribute("select")) Then iXMLDom.documentElement.setAttribute "select","0"
		rootNode		= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("node"))
		sAppID			= NewAsp.CacheName &"_channelmenu"
		If rootNode = "" Or rootNode = "row" Or rootNode = "xml" Then rootNode = "datalist"
		If Not IsObject(Application(sAppID)) Then
			Set Rs=NewAsp.Execute("SELECT ChannelID,ChannelName,Caption,ColorModes,FontModes,ChannelDir,LinkTarget,ChannelType,BindDomain,DomainName,ChannelUrl,IsHidden FROM NC_Channel WHERE IsHidden=0 And ChannelID<>3 ORDER BY orders")
			Set datalist = NewAsp.RecordsetToxml(rs,"row",rootNode)
			Rs.Close:Set Rs = Nothing
			Application.Lock
				Set Application(sAppID)=datalist
			Application.unLock
			If Not datalist Is Nothing Then
				i=0
				For Each Node In datalist.documentElement.SelectNodes("row")
					i=i+1
					Node.attributes.setNamedItem(datalist.createNode(2,"i","")).text = i
					If CLng(Node.selectSingleNode("@channeltype").text)<2 Then
						If NewAsp.BindDomain=1 Then
							If CLng(Node.selectSingleNode("@binddomain").text)=0 Then
								ChannelUrl = Trim(NewAsp.MainDomain & NewAsp.InstallDir & Node.selectSingleNode("@channeldir").text)
							Else
								ChannelUrl = Trim(Node.selectSingleNode("@domainname").text)
							End If
						Else
							If CLng(Node.selectSingleNode("@binddomain").text)=0 Then
								ChannelUrl = Trim(NewAsp.InstallDir & Node.selectSingleNode("@channeldir").text)
							Else
								ChannelUrl = Trim(Node.selectSingleNode("@domainname").text)
							End If
						End If
					Else
						ChannelUrl=Node.selectSingleNode("@channelurl").text
					End If
					sTitle=Node.selectSingleNode("@channelname").text
					Node.attributes.setNamedItem(datalist.createNode(2,"title","")).text=NewAsp.ReadFontMode(Replace(sTitle, "<", "&lt;"),Node.selectSingleNode("@colormodes").text,Node.selectSingleNode("@fontmodes").text)
					Node.attributes.setNamedItem(datalist.createNode(2,"link","")).text=ChannelUrl
				Next
				Set Node = Nothing
			End If
		Else
			Set datalist=Application(sAppID)
		End If
		If Not datalist Is Nothing Then iXMLDom.documentElement.appendChild(datalist.documentElement.cloneNode(True))
		Set datalist=Nothing
	End Sub

	Private Sub LoadSpecialMenu(iXMLDom)
		Dim SQL,Rs,i,Node,datalist
		Dim sAppID,rootNode,strQuery,strMaxListnum
		Dim channid,default,maxnum,stype,setcache
		Dim strTitle,strLinks,IsHtml,HtmlExt,strChannDir,DomainPath,ChannDomain
		If IsNull(iXMLDom.documentElement.getAttribute("action")) Then iXMLDom.documentElement.setAttribute "action","0"
		If IsNull(iXMLDom.documentElement.getAttribute("select")) Then iXMLDom.documentElement.setAttribute "select","0"
		setcache	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("setcache"))
		channid		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("channelid"))
		default		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("default"))
		maxnum		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("maxnum"))
		stype		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("type"))
		rootNode	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("node"))
		If maxnum>0 Then strMaxListnum=" TOP "&maxnum	Else strMaxListnum=""

		If setcache="" Then setcache="0"
		If default=0 Then default=0
		If channid=0 Or channid=4 Or channid=9999 Then channid= default
		sAppID		= NewAsp.CacheName &"_specialmenu_"&channid&"_"&setcache
		If rootNode = "" Or rootNode = "row" Or rootNode = "xml" Then rootNode = "datalist"
		If channid>0 Then
			strQuery="WHERE S.ChannelID="&channid
		End If
		If Not CacheIsObject(setcache,sAppID) Then
			SQL="SELECT"&strMaxListnum&" S.specialid,S.specialname,S.Topicformat,S.Readme,S.Reopen,S.SpecialDir,S.ChangeLink,S.SpecialUrl,C.ChannelID,C.ChannelDir,C.Modules,C.BindDomain,C.DomainName,C.IsCreateHtml,C.HtmlExtName,C.MoreDestination FROM [NC_Special] S INNER JOIN [NC_Channel] C ON S.ChannelID=C.ChannelID "&strQuery&" ORDER BY S.orders,S.specialid"
			Set Rs=NewAsp.Execute(SQL)
			Set datalist = NewAsp.RecordsetToxml(rs,"row",rootNode)
			Rs.Close:Set Rs = Nothing
			If EnabledCache(setcache) Then
				Application.Lock
					Set Application(sAppID)=datalist
				Application.unLock
			End If
			If Not datalist Is Nothing Then
				i=0
				For Each Node In datalist.documentElement.SelectNodes("row")
					i=i+1
					Node.attributes.setNamedItem(datalist.createNode(2,"i","")).text = i
					If (i mod 2) = 0 Then
						Node.attributes.setNamedItem(datalist.createNode(2,"m","")).text = 2
					Else
						Node.attributes.setNamedItem(datalist.createNode(2,"m","")).text = 1
					End If
					IsHtml=CLng(Node.selectSingleNode("@iscreatehtml").text)
					HtmlExt=Node.selectSingleNode("@htmlextname").text

					If Len(Node.selectSingleNode("@topicformat").text&"")>5 Then
						strTitle="<span "&Node.selectSingleNode("@topicformat").text&">"&Node.selectSingleNode("@specialname").text&"</span>"
					Else
						strTitle=Node.selectSingleNode("@specialname").text
					End If
					If CLng(Node.selectSingleNode("@binddomain").text)=1 Then
						strChannDir=""
						If IsHtml=0 Then
							DomainPath=Node.selectSingleNode("@domainname").text&"/"
						Else
							DomainPath=Node.selectSingleNode("@domainname").text
						End If
						ChannDomain=Node.selectSingleNode("@domainname").text&"/"
					Else
						'-- 如果所在频道绑定域名，转换主域名
						strChannDir=Node.selectSingleNode("@channeldir").text
						ChannDomain=NewAsp.InstallDir&Node.selectSingleNode("@channeldir").text
						If IsHtml=0 Then
							If NewAsp.BindDomain=1 Then
								DomainPath=NewAsp.MainDomain&NewAsp.InstallDir&Node.selectSingleNode("@channeldir").text
								ChannDomain=NewAsp.MainDomain&NewAsp.InstallDir&Node.selectSingleNode("@channeldir").text
							Else
								DomainPath=NewAsp.InstallDir&Node.selectSingleNode("@channeldir").text
							End If
						Else
							If NewAsp.BindDomain=1 Then
								DomainPath=NewAsp.MainDomain
								ChannDomain=NewAsp.MainDomain&NewAsp.InstallDir&Node.selectSingleNode("@channeldir").text
							Else
								DomainPath=""
							End If
						End If
					End If
					If IsHtml=0 Then
						If IsURLRewrite Then
							strLinks=CheckURLRewrite(DomainPath,"special-1-"&Node.selectSingleNode("@specialid").text&Node.selectSingleNode("@htmlextname").text)
						Else
							strLinks=DomainPath&"special.asp?specialid="&Node.selectSingleNode("@specialid").text
						End If
					Else
						strLinks=DomainPath&NewAsp.HtmlDestination(Node.selectSingleNode("@moredestination").text, strChannDir, "",Node.selectSingleNode("@specialdir").text&"/",Node.selectSingleNode("@specialid").text,Node.selectSingleNode("@specialid").text,1,"")
					End If
					Node.attributes.setNamedItem(datalist.createNode(2,"title","")).text=strTitle
					Node.attributes.setNamedItem(datalist.createNode(2,"link","")).text=strLinks

				Next
				Set Node = Nothing
				If i=0 Then
					If NewAsp.ChannelID=0 Then
						Dim channXmlDoc,Cnode,chaid
						If channid=0 Then chaid=1 Else chaid=channid
						If Not IsObject(Application(NewAsp.CacheName &"_chandata_"&chaid)) Then NewAsp.LoadChannelData chaid
						If IsObject(Application(NewAsp.CacheName &"_chandata_"&chaid)) Then
							Set channXmlDoc=Application(NewAsp.CacheName &"_chandata_"&chaid)
							If Not channXmlDoc Is Nothing Then
								Set Cnode=channXmlDoc.documentElement.selectSingleNode("chandata")
								HtmlExt=Trim(Cnode.selectSingleNode("@htmlextname").text)
								IsHtml=CLng(Cnode.selectSingleNode("@iscreatehtml").text)
								If CLng(Cnode.selectSingleNode("@binddomain").text)=0 Then
									ChannDomain=NewAsp.InstallDir&Trim(Cnode.selectSingleNode("@channeldir").text)
								Else
									ChannDomain=Trim(Cnode.selectSingleNode("@domainname").text)&"/"
								End If
							End If
							Set Cnode=Nothing
							Set channXmlDoc=Nothing
						Else
							HtmlExt=".html"
							ChannDomain="/soft/"
							IsHtml=0
						End If
					Else
						HtmlExt=NewAsp.HtmlExtName
						ChannDomain=NewAsp.ChannelPath
						IsHtml=NewAsp.IsCreateHtml
					End If
				End If
				If stype>0 Then
					Dim arrLinks(3)
					If IsHtml=0 Then
						If IsURLRewrite Then
							arrLinks(0)=CheckURLRewrite(ChannDomain,"newlist-1"&HtmlExt)
							arrLinks(1)=CheckURLRewrite(ChannDomain,"bestlist-1"&HtmlExt)
							arrLinks(2)=CheckURLRewrite(ChannDomain,"hotlist-1"&HtmlExt)
							arrLinks(3)=CheckURLRewrite(ChannDomain,"ABC_A-Z_1"&HtmlExt)
						Else
							arrLinks(0)=ChannDomain&"shownew.asp"
							arrLinks(1)=ChannDomain&"showbest.asp"
							arrLinks(2)=ChannDomain&"showhot.asp"
							arrLinks(3)=ChannDomain&"showabc.asp?q=a-z"
						End If
					Else
						arrLinks(0)=ChannDomain&OtherHtmlPath&"newlist-1"&HtmlExt
						arrLinks(1)=ChannDomain&OtherHtmlPath&"bestlist-1"&HtmlExt
						arrLinks(2)=ChannDomain&OtherHtmlPath&"hotlist-1"&HtmlExt
						arrLinks(3)=ChannDomain&OtherHtmlPath&"ABC_A-Z_1"&HtmlExt
					End If
					Set Node=datalist.createNode(1,"row","")
					i=i+1
					Node.attributes.setNamedItem(datalist.createNode(2,"i","")).text=i
					Node.attributes.setNamedItem(datalist.createNode(2,"readme","")).text="最近更新"
					Node.attributes.setNamedItem(datalist.createNode(2,"title","")).text="最近更新"
					Node.attributes.setNamedItem(datalist.createNode(2,"link","")).text=arrLinks(0)
					datalist.documentElement.appendChild(Node)
					Set Node=Nothing
					Set Node=datalist.createNode(1,"row","")
					i=i+1
					Node.attributes.setNamedItem(datalist.createNode(2,"i","")).text=i
					Node.attributes.setNamedItem(datalist.createNode(2,"readme","")).text="最新推荐"
					Node.attributes.setNamedItem(datalist.createNode(2,"title","")).text="最新推荐"
					Node.attributes.setNamedItem(datalist.createNode(2,"link","")).text=arrLinks(1)
					datalist.documentElement.appendChild(Node)
					Set Node=Nothing
					Set Node=datalist.createNode(1,"row","")
					i=i+1
					Node.attributes.setNamedItem(datalist.createNode(2,"i","")).text=i
					Node.attributes.setNamedItem(datalist.createNode(2,"readme","")).text="热门排行"
					Node.attributes.setNamedItem(datalist.createNode(2,"title","")).text="热门排行"
					Node.attributes.setNamedItem(datalist.createNode(2,"link","")).text=arrLinks(2)
					datalist.documentElement.appendChild(Node)
					Set Node=Nothing
				End If
			End If
		Else
			Set datalist=Application(sAppID)
		End If

		If Not datalist Is Nothing Then iXMLDom.documentElement.appendChild(datalist.documentElement.cloneNode(True))
		Set datalist=Nothing
	End Sub

	Private Sub LoadClassMenu(iXMLDom)
		Dim SQL,Rs,i,Node,datalist,classXmlDom,classNode
		Dim sAppID,rootNode,strQuery,strMaxListnum
		Dim channid,classid,default,maxnum,stype,setcache
		Dim depth,Parentid,Child,Eachline,strwidth,w
		Dim sTitle,strLinks
		If IsNull(iXMLDom.documentElement.getAttribute("action")) Then iXMLDom.documentElement.setAttribute "action","0"
		If IsNull(iXMLDom.documentElement.getAttribute("select")) Then iXMLDom.documentElement.setAttribute "select","0"
		setcache	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("setcache"))
		channid		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("channelid"))
		classid		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("classid"))
		default		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("default"))
		maxnum		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("maxnum"))
		stype		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("type"))
		rootNode	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("node"))
		depth		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("depth"))
		Eachline	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("eachline"))
		setLineWidth Eachline,strwidth,w

		If setcache="" Then setcache="0"
		If default=0 Then default=1
		If channid=0 Or channid=4 Or channid=9999 Then channid= default
		sAppID		= NewAsp.CacheName &"_classmenu_"&channid&"_"&setcache
		If rootNode = "" Or rootNode = "row" Or rootNode = "xml" Then rootNode = "datalist"
		If maxnum>0 Then strMaxListnum=" TOP "&maxnum	Else strMaxListnum=""

		If Not CacheIsObject(setcache,sAppID) Then
			If classid>0 Then
				If Not IsObject(Application(NewAsp.CacheName&"_classlist_"&channid)) Then NewAsp.LoadClassList(channid)
				Set classXmlDom=Application(NewAsp.CacheName&"_classlist_"&channid)
				Set classNode=classXmlDom.documentElement.selectSingleNode("row[@classid='"&classid&"']")
				If Not classNode is Nothing Then
					Parentid=CLng(classNode.selectSingleNode("@parentid").text)
					Child=CLng(classNode.selectSingleNode("@child").text)
				Else
					Exit Sub
				End If
				Set classNode = Nothing
				Set classXmlDom = Nothing
				If Child<>0 Then
					strQuery=" And C.Parentid="&classid&" ORDER BY C.orders,C.classid"
				Else
					strQuery=" And C.Parentid="&Parentid&" ORDER BY C.orders,C.rootid"
				End If
			Else
				If depth=0 Then
					strQuery=" And C.depth=0 ORDER BY C.rootid,C.classid"
				Else
					strQuery=" ORDER BY C.depth,C.rootid,C.classid"
				End If
			End If
			SQL="SELECT"&strMaxListnum&" C.classid,C.rootid,C.depth,C.ClassName,C.ColorModes,C.FontModes,C.Readme,C.Child,C.LinkTarget,C.TurnLink,C.TurnLinkUrl,C.HtmlFileDir,B.ChannelDir,B.StopChannel,B.BindDomain,B.DomainName,B.IsCreateHtml,B.HtmlExtName,B.SortDestination FROM [NC_Classify] C inner join [NC_Channel] B On C.ChannelID=B.ChannelID WHERE C.ChannelID="&channid&" "&strQuery
			Set Rs=NewAsp.Execute(SQL)
			Set datalist = NewAsp.RecordsetToxml(rs,"row",rootNode)
			Rs.Close:Set Rs = Nothing
			If EnabledCache(setcache) Then
				Application.Lock
					Set Application(sAppID)=datalist
				Application.unLock
			End If
			If Not datalist Is Nothing Then
				i=0
				For Each Node In datalist.documentElement.SelectNodes("row")
					i=i+1
					Node.attributes.setNamedItem(datalist.createNode(2,"i","")).text = i
					Node.attributes.setNamedItem(datalist.createNode(2,"w","")).text = w
					Node.attributes.setNamedItem(datalist.createNode(2,"linewidth","")).text = strwidth
					If (i mod 2) = 0 Then
						Node.attributes.setNamedItem(datalist.createNode(2,"m","")).text = 2
					Else
						Node.attributes.setNamedItem(datalist.createNode(2,"m","")).text = 1
					End If
					If CLng(Node.selectSingleNode("@binddomain").text)=1 Then
						Node.selectSingleNode("@channeldir").text=""
						If CLng(Node.selectSingleNode("@iscreatehtml").text)=0 Then
							Node.selectSingleNode("@domainname").text=Node.selectSingleNode("@domainname").text&"/"
						End If
					Else
						If CLng(Node.selectSingleNode("@iscreatehtml").text)=0 Then
							If NewAsp.BindDomain=1 Then
								Node.selectSingleNode("@domainname").text=NewAsp.MainDomain&NewAsp.InstallDir&Node.selectSingleNode("@channeldir").text
							Else
								Node.selectSingleNode("@domainname").text=NewAsp.InstallDir&Node.selectSingleNode("@channeldir").text
							End If
						Else
							If NewAsp.BindDomain=1 Then
								Node.selectSingleNode("@domainname").text=NewAsp.MainDomain
							Else
								Node.selectSingleNode("@domainname").text=""
							End If
						End If
					End If
					If CLng(Node.selectSingleNode("@turnlink").text)=1 Then
						strLinks=Node.selectSingleNode("@turnlinkurl").text
					Else
						If CLng(Node.selectSingleNode("@iscreatehtml").text)=0 Then
							If IsURLRewrite Then
								strLinks=CheckURLRewrite(Node.selectSingleNode("@domainname").text,"list_1_"&Node.selectSingleNode("@classid").text&Node.selectSingleNode("@htmlextname").text)
							Else
								strLinks=Node.selectSingleNode("@domainname").text&"list.asp?classid="&Node.selectSingleNode("@classid").text
							End If
						Else
							strLinks=Node.selectSingleNode("@domainname").text&NewAsp.HtmlDestination(Node.selectSingleNode("@sortdestination").text, Node.selectSingleNode("@channeldir").text, "",Node.selectSingleNode("@htmlfiledir").text,Node.selectSingleNode("@classid").text,0,1,"")
						End If
					End If
					sTitle=Node.selectSingleNode("@classname").text
					Node.attributes.setNamedItem(datalist.createNode(2,"title","")).text=NewAsp.ReadFontMode(Replace(sTitle, "<", "&lt;"),Node.selectSingleNode("@colormodes").text,Node.selectSingleNode("@fontmodes").text)
					Node.attributes.setNamedItem(datalist.createNode(2,"link","")).text=strLinks
				Next
				Set Node = Nothing
				If Eachline>1 Then
					Dim moreline
					If i<Eachline Then moreline=Eachline-i Else moreline=Eachline-(i Mod Eachline)
					If moreline>0 And moreline<Eachline Then
						strLinks=NewAsp.InstallDir&"sitemap.html"
						If NewAsp.BindDomain=1 Then strLinks=NewAsp.MainDomain&strLinks
						For i=i+1 To i+moreline
							Set Node=datalist.createNode(1,"row","")
							Node.attributes.setNamedItem(datalist.createNode(2,"i","")).text=i
							Node.attributes.setNamedItem(datalist.createNode(2,"w","")).text = w
							Node.attributes.setNamedItem(datalist.createNode(2,"linewidth","")).text = strwidth
							If (i mod 2) = 0 Then
								Node.attributes.setNamedItem(datalist.createNode(2,"m","")).text = 2
							Else
								Node.attributes.setNamedItem(datalist.createNode(2,"m","")).text = 1
							End If
							Node.attributes.setNamedItem(datalist.createNode(2,"classid","")).text=0
							Node.attributes.setNamedItem(datalist.createNode(2,"rootid","")).text=0
							Node.attributes.setNamedItem(datalist.createNode(2,"title","")).text="更多分类"
							Node.attributes.setNamedItem(datalist.createNode(2,"classname","")).text="更多分类"
							Node.attributes.setNamedItem(datalist.createNode(2,"readme","")).text="更多分类"
							Node.attributes.setNamedItem(datalist.createNode(2,"link","")).text=strLinks
							datalist.documentElement.appendChild(Node)
							Set Node=Nothing
						Next
					End If
				End If
			End If
		Else
			Set datalist=Application(sAppID)
		End If
		If Not datalist Is Nothing Then iXMLDom.documentElement.appendChild(datalist.documentElement.cloneNode(True))
		Set datalist=Nothing
	End Sub

	Private Sub LoadUserList(iXMLDom)
		Dim SQL,Rs,i,Node,datalist
		Dim sAppID,rootNode,strQuery
		Dim channid,maxnum,stype,setcache
		Dim grade,strLinks
		If IsNull(iXMLDom.documentElement.getAttribute("action")) Then iXMLDom.documentElement.setAttribute "action","0"
		If IsNull(iXMLDom.documentElement.getAttribute("select")) Then iXMLDom.documentElement.setAttribute "select","0"
		If IsNull(iXMLDom.documentElement.getAttribute("target")) Then iXMLDom.documentElement.setAttribute "target","_self"
		setcache	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("setcache"))
		channid		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("channelid"))
		maxnum		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("maxnum"))
		stype		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("type"))
		rootNode	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("node"))
		grade		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("grade"))
		If setcache="" Then setcache="0"
		If maxnum=0 Or maxnum>100 Then maxnum=10
		sAppID		= NewAsp.CacheName &"_userlist_"&setcache
		If rootNode = "" Or rootNode = "row" Or rootNode = "xml" Then rootNode = "datalist"
		Select Case stype
			Case 1: strQuery="ORDER BY JoinTime DESC,userid DESC"
			Case 2: strQuery="ORDER BY LastTime DESC,userid DESC"
			Case 3: strQuery="ORDER BY userpoint DESC,userid DESC"
			Case Else
				strQuery="ORDER BY userlogin DESC,userid DESC"
		End Select
		If grade > 0 Then
			SQL = "SELECT TOP "&maxnum&" userid,username,nickname,userpoint,userlogin,JoinTime,LastTime,usermsg,ip FROM [NC_User] WHERE UserGrade=" & grade & " " & strQuery
		Else
			SQL = "SELECT TOP "&maxnum&" userid,username,nickname,userpoint,userlogin,JoinTime,LastTime,usermsg,ip FROM [NC_User] " & strQuery
		End If
		If Not CacheIsObject(setcache,sAppID) Then
			Set Rs = NewAsp.Execute(SQL)
			Set datalist = NewAsp.RecordsetToxml(rs,"row",rootNode)
			Rs.Close:Set Rs = Nothing
			If EnabledCache(setcache) Then
				Application.Lock
					Set Application(sAppID)=datalist
				Application.unLock
			End If
			If Not datalist Is Nothing Then
				i=0
				For Each Node In datalist.documentElement.SelectNodes("row")
					i=i+1
					Node.attributes.setNamedItem(datalist.createNode(2,"i","")).text = i
					If (i mod 2) = 0 Then
						Node.attributes.setNamedItem(datalist.createNode(2,"m","")).text = 2
					Else
						Node.attributes.setNamedItem(datalist.createNode(2,"m","")).text = 1
					End If
					strLinks="javascript:"'NewAsp.InstallDir&"users/userlist.asp?userid="&Node.selectSingleNode("@userid").text
					If NewAsp.BindDomain=1 Then strLinks=NewAsp.MainDomain&strLinks
					Node.attributes.setNamedItem(datalist.createNode(2,"link","")).text=strLinks
				Next
				Set Node = Nothing
			End If
		Else
			Set datalist=Application(sAppID)
		End If
		If Not datalist Is Nothing Then iXMLDom.documentElement.appendChild(datalist.documentElement.cloneNode(True))
		Set datalist=Nothing
	End Sub

	Private Sub LoadAnnouncements(iXMLDom)
		Dim SQL,Rs,i,Node,datalist
		Dim sAppID,rootNode,strQuery
		Dim channid,maxnum,stype,setcache,showdate
		Dim Vertical,strLength,datemode,strTarget
		Dim strLinks,strTopic
		If IsNull(iXMLDom.documentElement.getAttribute("action")) Then iXMLDom.documentElement.setAttribute "action","0"
		If IsNull(iXMLDom.documentElement.getAttribute("select")) Then iXMLDom.documentElement.setAttribute "select","0"
		If IsNull(iXMLDom.documentElement.getAttribute("datemode")) Then iXMLDom.documentElement.setAttribute "datemode","yyyy-MM-dd"
		If IsNull(iXMLDom.documentElement.getAttribute("vertical")) Then iXMLDom.documentElement.setAttribute "vertical","0"
		If IsNull(iXMLDom.documentElement.getAttribute("showdate")) Then iXMLDom.documentElement.setAttribute "showdate","0"
		If IsNull(iXMLDom.documentElement.getAttribute("length")) Then iXMLDom.documentElement.setAttribute "length","0"
		If IsNull(iXMLDom.documentElement.getAttribute("target")) Then iXMLDom.documentElement.setAttribute "target","_self"
		If IsNull(iXMLDom.documentElement.getAttribute("ellipsis")) Then iXMLDom.documentElement.setAttribute "ellipsis","..."
		If Trim(iXMLDom.documentElement.getAttribute("ellipsis"))="0" Then
			NewAsp.Ellipsis=""
		Else
			NewAsp.Ellipsis=iXMLDom.documentElement.getAttribute("ellipsis")
		End If
		setcache	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("setcache"))
		channid		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("channelid"))
		maxnum		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("maxnum"))
		stype		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("type"))
		strLength	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("length"))
		Vertical	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("vertical"))
		rootNode	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("node"))
		datemode	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("datemode"))
		showdate	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("showdate"))
		strTarget	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("target"))
		If setcache="" Then setcache="0"
		If maxnum=0 Or maxnum>100 Then maxnum=10
		sAppID		= NewAsp.CacheName &"_announcements_"&channid&"_"&setcache
		If rootNode = "" Or rootNode = "row" Or rootNode = "xml" Then rootNode = "datalist"
		If Not CacheIsObject(setcache,sAppID) Then
			Set Rs = NewAsp.Execute("SELECT TOP "&maxnum&" AnnounceID,title,Content,PostTime,writer,hits FROM NC_Announce WHERE (ChannelID="&channid&" Or ChannelID=999) And AnnounceType<>1 ORDER BY PostTime DESC,AnnounceID DESC")
			Set datalist = NewAsp.RecordsetToxml(rs,"row",rootNode)
			Rs.Close:Set Rs = Nothing
			If EnabledCache(setcache) Then
				Application.Lock
					Set Application(sAppID)=datalist
				Application.unLock
			End If
			If Not datalist Is Nothing Then
				i=0
				For Each Node In datalist.documentElement.SelectNodes("row")
					i=i+1
					Node.attributes.setNamedItem(datalist.createNode(2,"i","")).text = i
					If (i mod 2) = 0 Then
						Node.attributes.setNamedItem(datalist.createNode(2,"m","")).text = 2
					Else
						Node.attributes.setNamedItem(datalist.createNode(2,"m","")).text = 1
					End If
					strLinks=NewAsp.InstallDir&"announce.asp?announceid="&Node.selectSingleNode("@announceid").text
					If NewAsp.BindDomain=1 Then strLinks=NewAsp.MainDomain&strLinks
					Node.attributes.setNamedItem(datalist.createNode(2,"link","")).text=strLinks
					strTopic=NewAsp.CutStr(Node.selectSingleNode("@title").text,strLength)
					Node.attributes.setNamedItem(datalist.createNode(2,"topic","")).text=strTopic
					If showdate=0 Then
						Node.attributes.setNamedItem(datalist.createNode(2,"datetime","")).text=""
					Else
						Node.attributes.setNamedItem(datalist.createNode(2,"datetime","")).text=NewAsp.DateToString(Node.selectSingleNode("@posttime").text,datemode)
					End If
				Next
				Set Node = Nothing
			End If
		Else
			Set datalist=Application(sAppID)
		End If
		If Not datalist Is Nothing Then iXMLDom.documentElement.appendChild(datalist.documentElement.cloneNode(True))
		Set datalist=Nothing
	End Sub

	Private Sub LoadFriendLink(iXMLDom)
		Dim SQL,Rs,i,Node,datalist
		Dim sAppID,rootNode,strQuery
		Dim channid,maxnum,stype,setcache
		Dim isLogo,linkmode,strLinks,strImage
		Dim Eachline,w,strwidth
		If IsNull(iXMLDom.documentElement.getAttribute("action")) Then iXMLDom.documentElement.setAttribute "action","0"
		If IsNull(iXMLDom.documentElement.getAttribute("select")) Then iXMLDom.documentElement.setAttribute "select","0"
		If IsNull(iXMLDom.documentElement.getAttribute("eachline")) Then iXMLDom.documentElement.setAttribute "eachline","0"
		If IsNull(iXMLDom.documentElement.getAttribute("islogo")) Then iXMLDom.documentElement.setAttribute "islogo","0"
		If IsNull(iXMLDom.documentElement.getAttribute("linkmode")) Then iXMLDom.documentElement.setAttribute "linkmode","0"
		If IsNull(iXMLDom.documentElement.getAttribute("target")) Then iXMLDom.documentElement.setAttribute "target","_blank"
		setcache	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("setcache"))
		channid		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("channelid"))
		maxnum		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("maxnum"))
		stype		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("type"))
		rootNode	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("node"))
		isLogo		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("islogo"))
		linkmode	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("linkmode"))
		eachline	= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("eachline"))
		setLineWidth Eachline,strwidth,w
		
		If setcache="" Then setcache="0"
		If maxnum=0 Or maxnum>100 Then maxnum=10
		sAppID		= NewAsp.CacheName &"_friendlink_"&setcache
		If rootNode = "" Or rootNode = "row" Or rootNode = "xml" Then rootNode = "datalist"
		Select Case stype
			'-- 首页显示按时间升序排列
			Case 1: strQuery="And isIndex>0 ORDER BY LinkTime DESC,LinkID DESC"
			'-- 首页显示按点击数升序排列
			Case 2: strQuery="And isIndex>0 ORDER BY LinkHist DESC,LinkID DESC"
			'-- 首页显示按点击数降序排列
			Case 3: strQuery="And isIndex>0 ORDER BY LinkHist DESC,LinkID ASC"
			'-- 所有按升序排列
			Case 4: strQuery="ORDER BY LinkID DESC"
			'-- 所有按降序排列
			Case 5: strQuery="ORDER BY LinkID ASC"
			'-- 所有按点击数升序排列
			Case 6: strQuery="ORDER BY LinkHist DESC,LinkID DESC"
			'-- 所有按点击数降序排列
			Case 7: strQuery="ORDER BY LinkHist DESC,LinkID ASC"
			'-- 首页显示按名称排列
			Case 8: strQuery="And isIndex>0 ORDER BY LinkName DESC,LinkID DESC"
			'-- 所有按名称排列
			Case 9: strQuery="ORDER BY LinkName DESC,LinkID DESC"
			Case Else
				strQuery="And isIndex>0 ORDER BY LinkTime Asc,LinkID ASC"
		End Select
		If isLogo=0 Then
			SQL = "SELECT TOP "&maxnum&" LinkID,LinkName,LinkUrl,LogoUrl,Readme,LinkHist,isLogo FROM [NC_Link] WHERE isLock=0 And isLogo=0 " & strQuery
		Else
			SQL = "SELECT TOP "&maxnum&" LinkID,LinkName,LinkUrl,LogoUrl,Readme,LinkHist,isLogo FROM [NC_Link] WHERE isLock=0 And isLogo>0 " & strQuery
		End If
		If Not CacheIsObject(setcache,sAppID) Then
			Set Rs = NewAsp.Execute(SQL)
			Set datalist = NewAsp.RecordsetToxml(rs,"row",rootNode)
			Rs.Close:Set Rs = Nothing
			If EnabledCache(setcache) Then
				Application.Lock
					Set Application(sAppID)=datalist
				Application.unLock
			End If
			If Not datalist Is Nothing Then
				i=0
				For Each Node In datalist.documentElement.SelectNodes("row")
					i=i+1
					Node.attributes.setNamedItem(datalist.createNode(2,"i","")).text = i
					Node.attributes.setNamedItem(datalist.createNode(2,"w","")).text = w
					Node.attributes.setNamedItem(datalist.createNode(2,"linewidth","")).text = strwidth
					If Eachline>0 Then
						If (i Mod Eachline)=0 Then
							Node.attributes.setNamedItem(datalist.createNode(2,"br","")).text="<br style=""clear:both"" />"
						Else
							Node.attributes.setNamedItem(datalist.createNode(2,"br","")).text=""
						End If
					Else
						Node.attributes.setNamedItem(datalist.createNode(2,"br","")).text=""
					End If
					If (i mod 2) = 0 Then
						Node.attributes.setNamedItem(datalist.createNode(2,"m","")).text = 2
					Else
						Node.attributes.setNamedItem(datalist.createNode(2,"m","")).text = 1
					End If
					If linkmode=0 Then
						strLinks=NewAsp.InstallDir&"link/link.asp?id="&Node.selectSingleNode("@linkid").text&"&url=" & Trim(Node.selectSingleNode("@linkurl").text)
						If NewAsp.BindDomain=1 Then strLinks=NewAsp.MainDomain&strLinks
					Else
						strLinks=Trim(Node.selectSingleNode("@linkurl").text)
					End If
					If CLng(Node.selectSingleNode("@islogo").text)>0 Then
						strImage=NewAsp.CheckLinksUrl(Node.selectSingleNode("@logourl").text)
						Node.selectSingleNode("@logourl").text=strImage
					End If
					Node.attributes.setNamedItem(datalist.createNode(2,"link","")).text=strLinks
					Node.attributes.setNamedItem(datalist.createNode(2,"title","")).text=Node.selectSingleNode("@linkname").text
				Next
				Set Node = Nothing
				If Eachline>1 Then
					Dim moreline
					If i<Eachline Then moreline=Eachline-i Else moreline=Eachline-(i Mod Eachline)
					If moreline>0 And moreline<Eachline Then
						strLinks=NewAsp.InstallDir&"link/"
						If NewAsp.BindDomain=1 Then strLinks=NewAsp.MainDomain&strLinks
						For i=i+1 To i+moreline
							Set Node=datalist.createNode(1,"row","")
							Node.attributes.setNamedItem(datalist.createNode(2,"i","")).text=i
							Node.attributes.setNamedItem(datalist.createNode(2,"w","")).text = w
							Node.attributes.setNamedItem(datalist.createNode(2,"linewidth","")).text = strwidth
							If Eachline>0 Then
								If (i Mod Eachline)=0 Then
									Node.attributes.setNamedItem(datalist.createNode(2,"br","")).text="<br style=""clear:both"" />"
								Else
									Node.attributes.setNamedItem(datalist.createNode(2,"br","")).text=""
								End If
							Else
								Node.attributes.setNamedItem(datalist.createNode(2,"br","")).text=""
							End If
							If (i mod 2) = 0 Then
								Node.attributes.setNamedItem(datalist.createNode(2,"m","")).text = 2
							Else
								Node.attributes.setNamedItem(datalist.createNode(2,"m","")).text = 1
							End If
							Node.attributes.setNamedItem(datalist.createNode(2,"linkhist","")).text=0
							Node.attributes.setNamedItem(datalist.createNode(2,"linkid","")).text=0
							Node.attributes.setNamedItem(datalist.createNode(2,"islogo","")).text=isLogo
							Node.attributes.setNamedItem(datalist.createNode(2,"logourl","")).text=strLinks&"link.gif"
							Node.attributes.setNamedItem(datalist.createNode(2,"title","")).text="更多链接"
							Node.attributes.setNamedItem(datalist.createNode(2,"linkname","")).text="更多链接"
							Node.attributes.setNamedItem(datalist.createNode(2,"readme","")).text="更多链接"
							Node.attributes.setNamedItem(datalist.createNode(2,"linkurl","")).text=strLinks
							Node.attributes.setNamedItem(datalist.createNode(2,"link","")).text=strLinks
							datalist.documentElement.appendChild(Node)
							Set Node=Nothing
						Next
					End If
				End If
			End If
		Else
			Set datalist=Application(sAppID)
		End If
		If Not datalist Is Nothing Then iXMLDom.documentElement.appendChild(datalist.documentElement.cloneNode(True))
		Set datalist=Nothing
	End Sub

	Private Function GetStatistic(iXMLDom)
		On Error Resume Next
		Dim SQL,Rs,strQuery,statCount,sAppID,datalist
		Dim setcache,channid,channel,classid,stype,strType
		setcache	= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("setcache"))
		channid		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("channelid"))
		channel		= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("channel"))
		classid		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("classid"))
		stype		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("type"))
		strType		= NewAsp.CheckStr(iXMLDom.documentElement.getAttribute("stype"))
		If setcache="" Then setcache="0"
		statCount=0
		sAppID		= NewAsp.CacheName &"_statistic_"&channel&"_"&setcache
		If classid>0 And channid>0 Then
			Dim classXmlDom,classNode,ChildStr
			If Not IsObject(Application(NewAsp.CacheName&"_classlist_"&channid)) Then NewAsp.LoadClassList(channid)
			Set classXmlDom=Application(NewAsp.CacheName&"_classlist_"&channid)
			Set classNode=classXmlDom.documentElement.selectSingleNode("row[@classid='"&classid&"']")
			If Not classNode is Nothing Then
				ChildStr=classNode.selectSingleNode("@childstr").text
			Else
				ChildStr="0"
			End If
			Set classNode = Nothing
			Set classXmlDom = Nothing
			If ChildStr<>"0" And ChildStr<>"" Then
				If InStr(ChildStr,",")=0 Then
					strQuery="And ChannelID="&channid&" And classid="&ChildStr
				Else
					strQuery="And ChannelID="&channid&" And classid in (" & ChildStr & ")"
				End If
			End If
		Else
			If channid>0 Then
				strQuery="And ChannelID="&channid
			Else
				strQuery=""
			End If
		End If

		Select Case channel
		Case "news"
			If stype = 1 Then
				If isSqlDataBase = 1 Then
					SQL = "SELECT COUNT(*) FROM NC_Article WHERE isAccept>0 " & strQuery & " And Datediff(d,WriteTime,GetDate())=0"
				Else
					SQL = "SELECT COUNT(*) FROM NC_Article WHERE isAccept>0 " & strQuery & " And WriteTime>=Date()"
				End If
			ElseIf stype = 2 Then
				SQL = "SELECT SUM(AllHits) FROM NC_Article WHERE isAccept>0 " & strQuery
			ElseIf stype = 4 Then
				SQL = "SELECT SUM(DayHits) FROM NC_Article WHERE isAccept>0 " & strQuery
			Else
				SQL = "SELECT COUNT(ArticleID) FROM NC_Article WHERE isAccept>0 " & strQuery
			End If
		Case "soft"
			If Len(strType)>0 And strType<>"0" Then
				strQuery = strQuery & " And SoftType='" & strType & "'"
			End If
			If stype = 1 Then
				If isSqlDataBase = 1 Then
					SQL = "SELECT COUNT(*) FROM NC_SoftList WHERE isAccept>0 " & strQuery & " And Datediff(d,SoftTime,GetDate())=0"
				Else
					SQL = "SELECT COUNT(*) FROM NC_SoftList WHERE isAccept>0 " & strQuery & " And SoftTime>=Date()"
				End If
			ElseIf stype = 2 Then
				SQL = "SELECT SUM(AllHits) FROM NC_SoftList WHERE isAccept>0 " & strQuery
			ElseIf stype = 3 Then
				SQL = "SELECT SUM(SoftSize) FROM NC_SoftList WHERE isAccept>0 " & strQuery
			ElseIf stype = 4 Then
				SQL = "SELECT SUM(DayHits) FROM NC_SoftList WHERE isAccept>0 " & strQuery
			Else
				SQL = "SELECT COUNT(*) FROM NC_SoftList WHERE isAccept>0 " & strQuery
			End If
		Case "flash"
			If stype = 1 Then
				If isSqlDataBase = 1 Then
					SQL = "SELECT COUNT(*) FROM NC_FlashList WHERE isAccept>0 " & strQuery & " And Datediff(d,addTime,GetDate())=0"
				Else
					SQL = "SELECT COUNT(*) FROM NC_FlashList WHERE isAccept>0 " & strQuery & " And addTime>=Date()"
				End If
			ElseIf stype = 2 Then
				SQL = "SELECT SUM(AllHits) FROM NC_FlashList WHERE isAccept>0 " & strQuery
			ElseIf stype = 3 Then
				SQL = "SELECT SUM(filesize) FROM NC_FlashList WHERE isAccept>0 " & strQuery
			ElseIf stype = 4 Then
				SQL = "SELECT SUM(DayHits) FROM NC_FlashList WHERE isAccept>0 " & strQuery
			Else
				SQL = "SELECT COUNT(*) FROM NC_FlashList WHERE isAccept>0 " & strQuery
			End If
		Case "user"
			If stype = 1 Then
				If isSqlDataBase = 1 Then
					SQL = "SELECT COUNT(*) FROM NC_User WHERE Datediff(d,JoinTime,GetDate())=0"
				Else
					SQL = "SELECT COUNT(*) FROM NC_User WHERE JoinTime>=Date()"
				End If
			Else
				SQL = "SELECT COUNT(*) FROM NC_User"
			End If
		Case Else
			GetStatistic=0:Exit Function
		End Select
		If Not CacheIsObject(setcache,sAppID) Then
			Set Rs = NewAsp.Execute(SQL)
			If Rs.BOF And Rs.EOF Then
				statCount=0
			Else
				If  IsNull(Rs(0)) Then
					statCount=0
				Else
					statCount = CCur(Rs(0))
					If (channel="soft" And stype=3) Or (channel="flash" And stype=3) Then
						statCount = Round(statCount / 1024 / 1024, 3)
						statCount = FormatNumber(statCount, 3, -1)
					End If
				End If
			End If
			Rs.Close:Set Rs = Nothing
			Set datalist=NewAsp.CreateXmlDoc("Msxml2.FreeThreadedDOMDocument"& MsxmlVersion)
			datalist.LoadXml("<xml><count>"&statCount&"</count></xml>")
			If EnabledCache(setcache) Then
				Application.Lock
					Set Application(sAppID)=datalist
				Application.unLock
			End If
			Set datalist=Nothing
		Else
			Set datalist=Application(sAppID)
			If Not datalist Is Nothing Then
				statCount=datalist.documentElement.selectSingleNode("count").text
			End If
			Set datalist=Nothing
		End If
		GetStatistic=statCount
	End Function

	Private Sub LoadAbcSearch(iXMLDom)
		Dim datalist,Node,i,ii
		Dim AbcListArry,AbcListsArray,strLinks,strAbcName
		Dim channid,default,forced
		Dim ChannDir,HtmlExt,IsHtml

		channid		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("channelid"))
		default		= NewAsp.ChkNumeric(iXMLDom.documentElement.getAttribute("default"))
		forced		= NewAsp.ChkBoolean(iXMLDom.documentElement.getAttribute("forced"))
		If default=0 Then default=1
		If channid=0 Or channid=4 Or channid=9999 Then channid= default

		If NewAsp.ChannelID=0 Or forced Then
			Dim channXmlDoc,Cnode
			If Not IsObject(Application(NewAsp.CacheName &"_chandata_"&channid)) Then NewAsp.LoadChannelData channid
			Set channXmlDoc=Application(NewAsp.CacheName &"_chandata_"&channid)
			If Not channXmlDoc Is Nothing Then
				Set Cnode=channXmlDoc.documentElement.selectSingleNode("chandata")
				HtmlExt=Trim(Cnode.selectSingleNode("@htmlextname").text)
				IsHtml=CLng(Cnode.selectSingleNode("@iscreatehtml").text)
				If CLng(Cnode.selectSingleNode("@binddomain").text)=0 Then
					ChannDir=NewAsp.InstallDir&Trim(Cnode.selectSingleNode("@channeldir").text)
				Else
					ChannDir=Trim(Cnode.selectSingleNode("@domainname").text)&"/"
				End If
			End If
			Set Cnode=Nothing
			Set channXmlDoc=Nothing
		Else
			ChannDir=NewAsp.ChannelPath
			HtmlExt=NewAsp.HtmlExtName
			IsHtml=NewAsp.IsCreateHtml
		End If

		AbcListArry=Array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z")
		ii=0
		Set datalist=NewAsp.CreateXMLDoc("msxml2.FreeThreadedDOMDocument"& MsxmlVersion)
		datalist.appendChild(datalist.createElement("datalist"))
		For i=0 To UBound(AbcListArry)
			ii=ii+1
			Set Node=datalist.createNode(1,"row1","")
			Node.attributes.setNamedItem(datalist.createNode(2,"id","")).text=i+1
			Node.attributes.setNamedItem(datalist.createNode(2,"i","")).text=i
			Node.attributes.setNamedItem(datalist.createNode(2,"ii","")).text=ii
			Node.attributes.setNamedItem(datalist.createNode(2,"title","")).text=AbcListArry(i)
			If IsHtml=0 Then
				If IsURLRewrite Then
					strLinks=CheckURLRewrite(ChannDir,"ABC_"&AbcListArry(i)&"_1"&HtmlExt)
				Else
					strLinks=ChannDir&"showabc.asp?q="&AbcListArry(i)
				End If
			Else
				strLinks=ChannDir&OtherHtmlPath&"ABC_"&AbcListArry(i)&"_1"&HtmlExt
			End If
			Node.attributes.setNamedItem(datalist.createNode(2,"link","")).text=strLinks
			datalist.documentElement.appendChild(Node)
			Set Node=Nothing
		Next
		AbcListArry=Null
		AbcListArry=Array("A","B","C","D","E","F","G","H","J","K","L","M","N","O","P","Q","R","S","T","W","X","Y","Z","数字","符号")
		For i=0 To UBound(AbcListArry)
			ii=ii+1
			Set Node=datalist.createNode(1,"row2","")
			Node.attributes.setNamedItem(datalist.createNode(2,"id","")).text=i+1
			Node.attributes.setNamedItem(datalist.createNode(2,"i","")).text=i
			Node.attributes.setNamedItem(datalist.createNode(2,"ii","")).text=ii
			Node.attributes.setNamedItem(datalist.createNode(2,"title","")).text=AbcListArry(i)
			strAbcName=AbcListArry(i)&"-Z"
			If AbcListArry(i)="数字" Then strAbcName="0-9"
			If AbcListArry(i)="符号" Then strAbcName="A-9"

			If IsHtml=0 Then
				If IsURLRewrite Then
					strLinks=CheckURLRewrite(ChannDir,"ABC_"&strAbcName&"_1"&HtmlExt)
				Else
					strLinks=ChannDir&"showabc.asp?q="&strAbcName
				End If
			Else
				strLinks=ChannDir&OtherHtmlPath&"ABC_"&strAbcName&"_1"&HtmlExt
			End If
			Node.attributes.setNamedItem(datalist.createNode(2,"link","")).text=strLinks
			datalist.documentElement.appendChild(Node)
			Set Node=Nothing
		Next
		AbcListArry=Null
		If Not datalist Is Nothing Then iXMLDom.documentElement.appendChild(datalist.documentElement.cloneNode(True))
		Set datalist=Nothing
	End Sub

	Public Sub setLineWidth(Eachline,strwidth,w)
		If Eachline < 2 Then
			strwidth = ""
			w = 100
		Else
			w = Int(100/Eachline)
			If w = 0 Then w = 20
			strwidth = "float:left;width:"&w-0.1&"%;"
		End If
	End Sub

End Class

%>