<!--#include file="ubbcode.asp"-->
<!--#include file="base64.asp"-->
<%
Dim NewCloud
Set NewCloud = New SoftChannel_Cls

Class SoftChannel_Cls
	Private ChannelID, CreateHtml, keyword
	Private Rs, SQL, ChannelRootDir, HtmlContent, strIndexName
	Private softid, SoftIntro, skinid, ClassID, SoftType
	Private maxperpage, TotalNumber, TotalPageNum, CurrentPage, i, totalrec
	Private strFileDir, ParentID, strParent, strClassName, ChildStr, Child
	Private ListContent, TempListContent, HtmlTemplate, HtmlFilePath
	Private SpecialID, SpecialName, SpecialDir, PageType, ForbidEssay
	Private IsShowFlush, strInstallDir, j
	Private FoundErr,strlen,RandomCodes,m_strFileDir
	Public MakeHtmlMode,MakePageDone,MakeListNum
	Private ThunderPidArray,m_strDownLinks,m_strCurrPageName
	Public ThunderUnionID,FlashGetUnionID,strBasicPath,ChannelXMLPath,htmlmark
	Public Channel_Setting,xmlFilePath,m_xmlFilePath,m_strXMLPath,TextContent,isxmltext,xmlfilename

	Public Property Let Channel(chanid)
		ChannelID = chanid
	End Property
	Public Property Let ShowFlush(para)
		IsShowFlush = para
	End Property
	Private Sub Class_Initialize()
		On Error Resume Next
		FoundErr = False
		ChannelID = 2
		strlen = 0
		MakeHtmlMode = 0
		MakePageDone = 0
		'--ÿҳ
		MakeListNum = 50
		ThunderPidArray = Split(Newasp.ThunderPid & "|||", "|")
		ThunderUnionID = Trim(ThunderPidArray(0))
		If ThunderUnionID = "" Then ThunderUnionID = "0"
		FlashGetUnionID = Trim(ThunderPidArray(1))
		If FlashGetUnionID = "" Then FlashGetUnionID = "0"
		m_strDownLinks = ""
		htmlmark = 0
	End Sub
	Private Sub Class_Terminate()
		Set HTML = Nothing
	End Sub
	Public Sub ChannelMain()
		Newasp.ReadChannel (ChannelID)
		CreateHtml = CInt(Newasp.IsCreateHtml)
		If Newasp.BindDomain = "0" Then
			ChannelRootDir = Newasp.InstallDir & Newasp.ChannelDir
			strBasicPath = ""
			strInstallDir = Newasp.InstallDir
		Else
			ChannelRootDir = "/"
			strInstallDir = Newasp.SiteUrl & "/"
			If Len(Newasp.NamedPath) > 2 Then
				strBasicPath = Newasp.NamedPath
			Else
				strBasicPath = Server.MapPath(Newasp.InstallDir & Newasp.ChannelDir)
			End If
		End If
		strIndexName = "<a href=""" & ChannelRootDir & """>" & Newasp.ChannelName & "</a>"
		ubb.BasePath = ChannelRootDir
		ubb.setUbbcode = Join(Newasp.setUserEditor,"|")
		ubb.Keyword = Newasp.ContentKeyword
		Channel_Setting = Split(Newasp.Channel_Setting & "|||||||||||||||", "|||")
		If htmlmark=1 Then
			ChannelXMLPath = Newasp.InstallDir & Newasp.ChannelDir
		Else
			ChannelXMLPath = ChannelRootDir
		End If
		m_xmlFilePath = Trim(Channel_Setting(12))
		If Len(m_xmlFilePath) > 2 And InStr(m_xmlFilePath, ":") > 0 Then
			m_strXMLPath = m_xmlFilePath &"\"
		Else
			m_strXMLPath = Server.MapPath(ChannelXMLPath & m_xmlFilePath) & "\"
		End If
		m_strXMLPath = Replace(m_strXMLPath, "\\", "\")
	End Sub

	'#############################\\ִҳʼ//#############################
	'=================================================
	'ShowDownIndex
	'  ãʾҳ
	'=================================================
	Public Sub ShowDownIndex()
		LoadDownIndex
		'If CreateHtml <> 0 Then
			'Response.Write "<meta http-equiv=""refresh"" content=""0;url=index" & Newasp.HtmlExtName & """ />"
		'Else
			Response.Write HtmlContent
		'End If
	End Sub
	'=================================================
	'CreateDownIndex
	'  ãҳHTML
	'=================================================
	Public Sub CreateDownIndex()
		LoadDownIndex
		Dim FilePath
		
		If Newasp.BindDomain = "0" Then
			FilePath = ChannelRootDir & "index" & Newasp.HtmlExtName
		Else
			FilePath = "\index" & Newasp.HtmlExtName
		End If
		Newasp.CreatedTextFile strBasicPath & FilePath, HtmlContent
		If IsShowFlush = 1 Then Response.Write "<li style=""font-size: 12px;"">" & Newasp.ModuleName & "ҳHTML... " & FilePath & "</li>" & vbNewLine
		Response.Flush
	End Sub
	Public Sub LoadDownIndex()
		Dim FilePath
		
		Newasp.LoadTemplates ChannelID, 1, Newasp.ChkNumeric(Newasp.ChannelSkin)
		HtmlContent = Newasp.HtmlContent
		HtmlContent = Replace(HtmlContent, "{$ChannelRootDir}", ChannelRootDir)
		HtmlContent = Replace(HtmlContent, "{$InstallDir}", strInstallDir)
		HtmlContent = Replace(HtmlContent, "{$ChannelID}", ChannelID)
		If Len(Newasp.HtmlSetting(1)) < 2 Then
			HtmlContent = Replace(HtmlContent, "{$PageTitle}", Newasp.ChannelName)
		Else
			HtmlContent = Replace(HtmlContent, "{$PageTitle}", Newasp.ChannelName & Newasp.HtmlSetting(1))
		End If
		HtmlContent = Replace(HtmlContent, "{$ChannelName}", Newasp.ChannelName)
		HtmlContent = Replace(HtmlContent, "{$ModuleName}", Newasp.ModuleName)
		HtmlContent = Replace(HtmlContent, "{$SoftIndex}", strIndexName)
		HtmlContent = Replace(HtmlContent, "{$IndexTitle}", strIndexName)
		HtmlContent = HTML.ReadAnnounceContent(HtmlContent, ChannelID)
		HtmlContent = ReadClassMenu(HtmlContent)
		HtmlContent = ReadClassMenubar(HtmlContent)
		HtmlContent = HTML.ReadArticlePic(HtmlContent)
		HtmlContent = HTML.ReadSoftPic(HtmlContent)
		HtmlContent = HTML.ReadArticleList(HtmlContent)
		HtmlContent = HTML.ReadSoftList(HtmlContent)
		HtmlContent = HTML.ReadFlashList(HtmlContent)
		HtmlContent = HTML.ReadFlashPic(HtmlContent)
		HtmlContent = HTML.ReadFriendLink(HtmlContent)
		HtmlContent = HTML.ReadNewsPicAndText(HtmlContent)
		HtmlContent = HTML.ReadSoftPicAndText(HtmlContent)
		HtmlContent = HTML.ReadGuestList(HtmlContent)
		HtmlContent = HTML.ReadAnnounceList(HtmlContent)
		HtmlContent = HTML.ReadPopularArticle(HtmlContent)
		HtmlContent = HTML.ReadPopularSoft(HtmlContent)
		HtmlContent = HTML.ReadPopularFlash(HtmlContent)
		HtmlContent = HTML.ReadStatistic(HtmlContent)
		HtmlContent = HTML.ReadUserRank(HtmlContent)
		HtmlContent = Replace(HtmlContent, "{$SkinPath}", Newasp.SkinPath)
		HtmlContent = Replace(HtmlContent, "{$InstallDir}", strInstallDir)
		HtmlContent = Replace(HtmlContent, "{$ChannelID}", ChannelID)
		HtmlContent = HtmlContent
	End Sub
	'#############################\\ִϢʼ//#############################
	'=================================================
	'ShowArticleInfo
	'  ãʾҳ
	'=================================================
	Public Sub ShowDownIntro()
		If CreateHtml <> 0 Then
			Response.Redirect (ChannelRootDir & "index" & Newasp.HtmlExtName)
			Exit Sub
		Else
			Newasp.PreventInfuse
			softid = Newasp.ChkNumeric(Request("id"))
			Response.Write ReadSoftIntro(softid)
		End If
	End Sub
	'=================================================
	'ReadSoftIntro
	'  ãȡ
	'  SoftID ----ID
	'=================================================
	Public Function ReadSoftIntro(softid)
		Dim SoftImageUrl, SoftImage, Previewimg, PreviewUrl, re
		Dim strImageSize, strPreviewSize, SoftReadme, softname, SoftVer
		Dim MemberSoft, HomePage, HomePageUrl, strContact, DownloadAddress
		Dim strDecode, strRegsite, strAuthor
		Dim strRegsites, strPreviewImg,ThisUrl
		Dim subtitle, HeaderTitle,HeaderTitles,HeaderTopic,HeaderTopics
		Dim m_intPlugin,m_strPluginInfo

		SQL = "SELECT A.*,C.ClassName,C.ParentID,C.ParentStr,C.skinid,C.HtmlFileDir,C.ChildStr,C.UseHtml,C.AdsCode,C.stopad FROM [NC_SoftList] A INNER JOIN [NC_Classify] C On A.ClassID=C.ClassID WHERE A.ChannelID=" & ChannelID & " And A.isAccept > 0 And A.SoftID=" & softid
		Set Rs = Newasp.Execute(SQL)
		If Rs.BOF And Rs.EOF Then
			ReadSoftIntro = ""
			If CreateHtml = 0 Then
				Response.Write "<meta http-equiv=""refresh"" content=""2;url=/"" />" & vbNewLine
				Response.Write "<p align=""center"" style=""font-size: 16px;color: red;"">Բ𣬸ҳ淢˴޷! ϵͳԶתվҳ......</p>" & vbNewLine
			End If
			Set Rs = Nothing
			Exit Function
		End If

		If Rs("skinid") <> 0 Then
			skinid = Rs("skinid")
		Else
			skinid = Newasp.ChkNumeric(Newasp.ChannelSkin)
		End If
		'--XMLļ,ʹXMLļж------
		isxmltext = Newasp.ChkNumeric(Rs("isxmltext"))
		xmlfilename = Rs("xmlfilename") & ""
		If isxmltext = 1 Then
			xmlFilePath = m_strXMLPath & xmlfilename
			TextContent = Newasp.ReadXMLDocument(xmlFilePath,"softinfo/@content")
			If TextContent = "" Then TextContent = Rs("content") & ""
			TextContent = TextContent
		Else
			TextContent = Rs("content")
		End If
		'---------------------------------------------
		Newasp.LoadTemplates ChannelID, 3, skinid
		SoftReadme = TextContent

		Set re = New RegExp
		re.IgnoreCase = True
		re.Global = True
		If Newasp.HtmlSetting(18) <> "0" Then
			re.Pattern = "\[br\]"
			SoftReadme = re.Replace(SoftReadme, "<BR>")
			re.Pattern = "\[align=right\]"
			SoftReadme = re.Replace(SoftReadme, "<div align=right>")
			re.Pattern = "\[\/align\]"
			SoftReadme = re.Replace(SoftReadme, "</div>")
		Else
			re.Pattern = "\[br\]"
			SoftReadme = re.Replace(SoftReadme, "")
			re.Pattern = "\[align=right\](.*)\[\/align\]"
			SoftReadme = re.Replace(SoftReadme, "")
		End If
		Set re = Nothing
		DownloadAddress = ShowDownAddress(Rs("softid"))
		SoftIntro = ubb.UbbCode(SoftReadme)
		HtmlContent = Newasp.HtmlContent
		'--ǰҳURL
		If CreateHtml <> 0 Then
			ThisUrl = Newasp.ReadDestination(Newasp.InfoDestination, Newasp.ChannelDir, Rs("HtmlFileDate"),Rs("HtmlFileDir"),Rs("ClassID"),Rs("softid"),1,"")
		Else
			If IsURLRewrite Then
				ThisUrl = ChannelRootDir & Rs("softid") & Newasp.HtmlExtName
			Else
				ThisUrl = ChannelRootDir & "show.asp?id=" & Rs("softid")
			End If
		End If
		strImageSize = Split(Newasp.HtmlSetting(14), "|")
		strPreviewSize = Split(Newasp.HtmlSetting(15), "|")
		If Newasp.CheckNull(Rs("SoftImage")) Then
			SoftImageUrl = Newasp.GetImageUrl(Rs("SoftImage"), ChannelRootDir)
			SoftImage = Newasp.GetFlashAndPic(SoftImageUrl, CInt(strImageSize(0)), CInt(strImageSize(1)))
			SoftImage = "<a href=""" & ChannelRootDir & "Previewimg.asp?SoftID=" & softid & """ title=""" & Rs("SoftName") & """ target=""_blank"">" & SoftImage & "</a>"
			Previewimg = Newasp.GetFlashAndPic(SoftImageUrl, CInt(strPreviewSize(0)), CInt(strPreviewSize(1)))
			PreviewUrl = ChannelRootDir & "Previewimg.asp?SoftID=" & softid
			PreviewUrl = Replace(Newasp.HtmlSetting(17), "{$PreviewUrl}", PreviewUrl)
		Else
			If Newasp.CheckNull(Rs("Previewimg")) Then
				Previewimg = Newasp.GetFlashAndPic(Newasp.GetImageUrl(Rs("Previewimg"), ChannelRootDir), CInt(strPreviewSize(0)), CInt(strPreviewSize(1)))
				PreviewUrl = ChannelRootDir & "Previewimg.asp?SoftID=" & softid
				PreviewUrl = Replace(Newasp.HtmlSetting(17), "{$PreviewUrl}", PreviewUrl)
			Else
				Previewimg = ""
				PreviewUrl = Newasp.HtmlSetting(16)
			End If
			SoftImage = Newasp.HtmlSetting(13)
		End If		
		
		If Newasp.CheckNull(Rs("Homepage")) Then
			HomePageUrl = Rs("Homepage")
			HomePage = Replace(Newasp.HtmlSetting(10), "{$HomePageUrl}", Rs("Homepage"))
			HomePage = Replace(HomePage, "{$Home_Page}", Newasp.GotTopic(Rs("Homepage"),30))
		Else
			HomePage = Newasp.HtmlSetting(9)
			HomePageUrl = ""
		End If
		If Newasp.CheckNull(Rs("Contact")) Then
			strContact = Replace(Newasp.HtmlSetting(12), "{$ContactSite}", AutoPlusLinks(Rs("Contact")))
		Else
			strContact = Newasp.HtmlSetting(11)
		End If
		If Newasp.CheckNull(Rs("Decode")) Then
			strDecode = Replace(Newasp.HtmlSetting(20), "{$strDecode}", Rs("Decode"))
		Else
			strDecode = Newasp.HtmlSetting(19)
		End If
		If Rs("UserGroup") <> 0 Then
			MemberSoft = Newasp.HtmlSetting(8)
		End If
		If Newasp.CheckNull(Rs("SoftVer")) Then
			softname = Trim(Rs("SoftName") & " " & Rs("SoftVer"))
		Else
			softname = Trim(Rs("SoftName"))
		End If
		HtmlContent = Replace(HtmlContent, "{$Soft_Name}", Rs("SoftName"))
		If Newasp.CheckNull(Rs("Regsite")) Then
			strRegsite = Replace(Newasp.HtmlSetting(24), "{$RegsiteUrl}", Rs("Regsite"))
			strRegsites = Trim(Rs("Regsite"))
		Else
			strRegsite = Newasp.HtmlSetting(23)
			strRegsites = "#"
		End If
		If strRegsites = "#" Then
			strPreviewImg = ""
		Else
			strPreviewImg = "<img src=""" & strRegsites & """ border=""0""/>"
			strPreviewImg = strPreviewImg
		End If
		If Newasp.CheckNull(Rs("Author")) Then
			strAuthor = Rs("Author")
		Else
			strAuthor = Newasp.HtmlSetting(25)
		End If
		softname = Newasp.ReadFontMode(softname, Rs("ColorMode"), Rs("FontMode"))
		'--
		subtitle = Rs("subtitle") & ""
		
		'-- 
		HtmlContent = AdsReplace(HtmlContent,Rs("AdsCode"),Rs("stopad"))
		HtmlContent = Replace(HtmlContent, "{$InstallDir}", strInstallDir)
		HtmlContent = Replace(HtmlContent, "{$ChannelID}", ChannelID)
		HtmlContent = Replace(HtmlContent, "{$DownAddress}", DownloadAddress)
		HtmlContent = Replace(HtmlContent, "{$RegsiteUrl}", strRegsite)
		HtmlContent = Replace(HtmlContent, "{$Author}", strAuthor)
		HtmlContent = Replace(HtmlContent, "{$SoftImage}", SoftImage)
		HtmlContent = Replace(HtmlContent, "{$Previewimg}", Previewimg)
		HtmlContent = Replace(HtmlContent, "{$PreviewUrl}", PreviewUrl)
		HtmlContent = Replace(HtmlContent, "{$HomePage}", HomePage)
		HtmlContent = Replace(HtmlContent, "{$HomePageUrl}", HomePageUrl)
		HtmlContent = Replace(HtmlContent, "{$Contact}", strContact)
		HtmlContent = Replace(HtmlContent, "{$Decode}", strDecode)
		HtmlContent = Replace(HtmlContent, "{$MemberSoft}", MemberSoft)
		HtmlContent = Replace(HtmlContent, "{$SoftID}", Rs("SoftID"))
		HtmlContent = Replace(HtmlContent, "{$ClassName}", Rs("ClassName")&"")
		HtmlContent = Replace(HtmlContent, "{$ThisUrl}", ThisUrl)
		HtmlContent = Replace(HtmlContent, "{$SoftTime}", Rs("SoftTime")&"")
		HtmlContent = Replace(HtmlContent, "{$UserName}", Rs("username")&"")
		HtmlContent = Replace(HtmlContent, "{$Language}", Rs("Languages")&"")
		HtmlContent = Replace(HtmlContent, "{$SoftType}", Rs("SoftType")&"")
		HtmlContent = Replace(HtmlContent, "{$RunSystem}", Rs("RunSystem")&"")
		HtmlContent = Replace(HtmlContent, "{$RunSystems}", Newasp.GotTopic(Rs("RunSystem")&"",30))
		HtmlContent = Replace(HtmlContent, "{$Impower}", Rs("impower")&"")
		HtmlContent = Replace(HtmlContent, "{$Star}", Rs("star")&"")
		HtmlContent = Replace(HtmlContent, "{$IsBest}", Rs("IsBest"))
		HtmlContent = Replace(HtmlContent, "{$IsTop}", Rs("IsTop"))
		HtmlContent = Replace(HtmlContent, "{$Regsite}", Rs("Regsite")&"")
		HtmlContent = Replace(HtmlContent, "{$PreviewPic}", strPreviewImg)
		HtmlContent = Replace(HtmlContent, "{$showreg}", Rs("showreg")&"")
		HtmlContent = Replace(HtmlContent, "{$PointNum}", Rs("PointNum")&"")
		HtmlContent = Replace(HtmlContent, "{$SoftPrice}", Rs("SoftPrice")&"")
		HtmlContent = Replace(HtmlContent, "{$SoftSize}", ReadSoftsize(Rs("SoftSize")))
		HtmlContent = Replace(HtmlContent, "{$FileSize}", CCur(Rs("SoftSize")))
		HtmlContent = Replace(HtmlContent, "{$HeadTitle}", Trim(Rs("SoftName")))
		
		HtmlContent = GetDescription(HtmlContent, SoftIntro)
		If InStr(HtmlContent, "{$Description}") > 0 Then
			HtmlContent = Replace(HtmlContent, "{$Description}", Newasp.CutString(SoftIntro,190))
		End If
		If InStr(HtmlContent, "{$FrontSoft}") > 0 Then
			HtmlContent = Replace(HtmlContent, "{$FrontSoft}", FrontSoft(softid))
		End If
		If InStr(HtmlContent, "{$NextSoft}") > 0 Then
			HtmlContent = Replace(HtmlContent, "{$NextSoft}", NextSoft(softid))
		End If
		If InStr(HtmlContent, "{$RelatedSoft}") > 0 Then
			HtmlContent = Replace(HtmlContent, "{$RelatedSoft}", RelatedSoft(Rs("Related"), Rs("SoftName"), Rs("SoftID")))
		End If
		If InStr(HtmlContent, "{$ShowHotSoft}") > 0 Then
			HtmlContent = Replace(HtmlContent, "{$ShowHotSoft}", ShowHotSoft(Rs("ClassID")))
		End If
		If InStr(HtmlContent, "{$SoftComment}") > 0 Then
			HtmlContent = Replace(HtmlContent, "{$SoftComment}", SoftComment(Rs("SoftID")))
		End If
		m_intPlugin = Newasp.ChkNumeric(Rs("plugin"))
		Select Case m_intPlugin
			Case 1 : m_strPluginInfo = Newasp.HtmlSetting(29)
			Case 2 : m_strPluginInfo = Newasp.HtmlSetting(30)
			Case 3 : m_strPluginInfo = Newasp.HtmlSetting(31)
			Case 4 : m_strPluginInfo = Newasp.HtmlSetting(32)
			Case 5 : m_strPluginInfo = Newasp.HtmlSetting(33)
			Case 6 : m_strPluginInfo = Newasp.HtmlSetting(34)
			Case 7 : m_strPluginInfo = Newasp.HtmlSetting(35)
			Case Else
			m_strPluginInfo = Newasp.HtmlSetting(28)
		End Select
		
		HtmlContent = Replace(HtmlContent, "{$Plugin}", m_intPlugin)
		HtmlContent = Replace(HtmlContent, "{$PluginInfo}", m_strPluginInfo & "")
		HtmlContent = Replace(HtmlContent, "{$ChannelRootDir}", ChannelRootDir)
		HtmlContent = Replace(HtmlContent, "{$InstallDir}", strInstallDir)
		HtmlContent = Replace(HtmlContent, "{$ChannelID}", ChannelID)
		HtmlContent = Replace(HtmlContent, "{$SoftIndex}", strIndexName)
		HtmlContent = Replace(HtmlContent, "{$IndexTitle}", strIndexName)
		HtmlContent = Replace(HtmlContent, "{$ModuleName}", Newasp.ModuleName)
		HtmlContent = Replace(HtmlContent, "{$PageTitle}", Trim(Rs("SoftName") & " " & Rs("SoftVer")))
		HtmlContent = Replace(HtmlContent, "{$ClassID}", Rs("ClassID"))
		HtmlContent = Replace(HtmlContent, "{$SoftID}", softid)
		HtmlContent = Replace(HtmlContent, "{$supsoftid}", Newasp.Supplemental(softid,6))
		HtmlContent = HTML.ReadCurrentStation(HtmlContent, ChannelID, Rs("ClassID"), Rs("ClassName"), Rs("ParentID"), Rs("ParentStr"), Rs("HtmlFileDir"))
		HtmlContent = HTML.ReadAnnounceContent(HtmlContent, ChannelID)
		HtmlContent = ReadClassMenubar(HtmlContent)
		HtmlContent = ReadClassMenu(HtmlContent)
		HtmlContent = Replace(HtmlContent, "{$Classify}", Trim(HTML.CurrentClass))
		HtmlContent = Replace(HtmlContent, "{$CurrentClass}", HTML.CurrentClass)
		If len(subtitle) = 0 Then
			HeaderTitle = Trim(HTML.CurrentClass)
			HeaderTitles = ""
			HeaderTopic = Newasp.SiteName
			HeaderTopics = ""
		Else
			HeaderTitle = subtitle
			HeaderTitles = " - " & subtitle
			HeaderTopic = subtitle
			HeaderTopics = "," & subtitle
		End If
		RandomCodes = GetRandomizeCode
		HtmlContent = Replace(HtmlContent, "{$RandomCodes}", RandomCodes)
		HtmlContent = Replace(HtmlContent, "{$HeaderTitle}", HeaderTitle)
		HtmlContent = Replace(HtmlContent, "{$HeaderTitles}", HeaderTitles)
		HtmlContent = Replace(HtmlContent, "{$HeaderTopic}", HeaderTopic)
		HtmlContent = Replace(HtmlContent, "{$HeaderTopics}", HeaderTopics)
		HtmlContent = Replace(HtmlContent, "{$ParentClass}", HTML.ParentClass)
		HtmlContent = HTML.ReadPopularSoft(HtmlContent)
		HtmlContent = HTML.ReadSoftPic(HtmlContent)
		HtmlContent = HTML.ReadSoftList(HtmlContent)
		HtmlContent = HTML.ReadFlashList(HtmlContent)
		HtmlContent = HTML.ReadFlashPic(HtmlContent)
		HtmlContent = HTML.ReadArticleList(HtmlContent)
		HtmlContent = HTML.ReadArticlePic(HtmlContent)
		HtmlContent = HTML.LoadCommentGrade(HtmlContent, ChannelID, softid)
		HtmlContent = Replace(HtmlContent, "{$SkinPath}", Newasp.SkinPath)
		HtmlContent = Replace(HtmlContent, "{$InstallDir}", strInstallDir)
		HtmlContent = Replace(HtmlContent, "{$ChannelID}", ChannelID)
		HtmlContent = Replace(HtmlContent, "{$SoftName}", softname)
		HtmlContent = Replace(HtmlContent, "{$SoftwareNames}", Rs("softname"))
		HtmlContent = Replace(HtmlContent, "{$SoftVer}", Rs("softver") & "")
		HtmlContent = Replace(HtmlContent, "{$SubTitle}", subtitle)
		HtmlContent = Replace(HtmlContent, "{$SoftContent}", SoftIntro)
		If CreateHtml <> 0 Then
			Call CreateSoftIntro
		Else
			ReadSoftIntro = HtmlContent
		End If
		Rs.Close: Set Rs = Nothing
	End Function
	'=================================================
	'CreateSoftIntro
	'  ã
	'  SoftID ----ID
	'=================================================
	Private Sub CreateSoftIntro()
		Dim HtmlFileName
		HtmlFileName = Newasp.ReadDestination(Newasp.InfoDestination, Newasp.ChannelDir, Rs("HtmlFileDate"),Rs("HtmlFileDir"),Rs("ClassID"),Rs("softid"),1,"")
		HtmlFilePath = Newasp.HtmlFilesPath
		Newasp.CreatPathEx (strBasicPath & HtmlFilePath)
		Newasp.CreatedTextFile strBasicPath & HtmlFileName, HtmlContent
		If IsShowFlush = 1 Then Response.Write "<li style=""font-size: 12px;"">" & Newasp.ModuleName & "ϢHTML... <a href=" & HtmlFileName & " target=_blank>" & Server.MapPath(HtmlFileName) & "</a></li>" & vbNewLine
		Response.Flush
	End Sub
	Public Function GetDescription(ByVal str,ByVal strIntro)
		Dim strTemp, i
		Dim sTempContent, nTempContent
		Dim arrTempContent, arrTempContents, strLen
		If Len(strIntro) = 0 Then
			GetDescription = str
			Exit Function
		End If
		strTemp = str
		If InStr(strTemp, "{$Description(") > 0 Then
			sTempContent = Newasp.CutMatchContent(strTemp, "{$Description(", ")}", 1)
			nTempContent = Newasp.CutMatchContent(strTemp, "{$Description(", ")}", 0)
			arrTempContents = Split(sTempContent, "|||")
			arrTempContent = Split(nTempContent, "|||")
			
			For i = 0 To UBound(arrTempContents)
				strLen = Newasp.ChkNumeric(arrTempContent(i))
				If strLen > 0 Then
					strTemp = Replace(strTemp, arrTempContents(i), Newasp.CutString(strIntro,strLen))
				Else
					strTemp = Replace(strTemp, arrTempContents(i), ChkDescription(strIntro))
				End If
			Next
		End If
		GetDescription = strTemp
	End Function
	Public Function ChkDescription(ByVal str)
		Dim re,strHtml
		strHtml = str
		Set re = New RegExp
		re.IgnoreCase = True
		re.Global = True
		re.Pattern = "\[br\]"
		strHtml = re.Replace(strHtml, "")
		re.Pattern = "\[align=right\](.*)\[\/align\]"
		strHtml = re.Replace(strHtml, "")
		re.Pattern = "([\f\n\r\t\v])"
		strHtml = re.Replace(strHtml, "")
		re.Pattern = "<(.[^>]*)>"
		strHtml = re.Replace(strHtml, "")
		Set re = Nothing
		strHtml = Replace(strHtml, "&nbsp;", "")
		strHtml = Replace(strHtml, "====", "")
		strHtml = Replace(strHtml, "----", "")
		strHtml = Replace(strHtml, "////", "")
		strHtml = Replace(strHtml, "\\\\", "")
		strHtml = Replace(strHtml, "####", "")
		strHtml = Replace(strHtml, "@@@@", "")
		strHtml = Replace(strHtml, "****", "")
		strHtml = Replace(strHtml, "~~~~", "")
		strHtml = Replace(strHtml, "ԡԡ", "")
		strHtml = Replace(strHtml, "++++", "")
		strHtml = Replace(strHtml, "::::", "")
		strHtml = Replace(strHtml, "", "")
		strHtml = Replace(strHtml, Chr(9), "")
		strHtml = Replace(strHtml, Chr(10), "")
		strHtml = Replace(strHtml, Chr(34), "&quot;")
		strHtml = Replace(strHtml, Chr(39), "&#39;")
		strHtml = Replace(strHtml, "[InstallDir_ChannelDir]", "")
		strHtml = Replace(strHtml, "[NextPage]", "")
		strHtml = Replace(strHtml, "[Page_Break]", "")
		ChkDescription = strHtml
	End Function
	
	'================================================
	'ShowDownAddress
	'  ãʾصַ
	'  SoftID ----ID
	'================================================
	Private Function ShowDownAddress(softid)
		Dim rsAddress, sqlAddress, rsDown,softname
		Dim SoftNameStr,DownloadName, DownloadPath
		Dim DownAddress,strDownAddress,showdown,DownText,selfont
		Dim ii,foundstr,n,m_intType
		showdown = Newasp.ChkNumeric(Newasp.HtmlSetting(28))
		If Rs("PauseDown") > 0 Then
			ShowDownAddress = Newasp.HtmlSetting(22)
			Exit Function
		End If
		If IsRandomAddress Then
			If IsSqlDataBase = 1 Then
				foundstr = " ORDER BY IsOuter DESC, newid()"
			Else
				foundstr = " ORDER BY IsOuter DESC, rnd(A.downid)"
			End If
		Else
			foundstr = " ORDER BY orders ASC"
		End If
		ii = 0
		n = 0
		softname = Trim(Rs("SoftName") & " " & Rs("SoftVer"))
		m_intType = Newasp.ChkNumeric(Newasp.HtmlSetting(26))
		If m_intType <> 1 Then
			Set rsDown = Newasp.Execute("SELECT id,downid,DownFileName,DownText FROM [NC_DownAddress] WHERE softid=" & CLng(softid))
			If Not (rsDown.BOF And rsDown.EOF) Then
				Do While Not rsDown.EOF
					ii = ii + 1
					DownText = rsDown("DownText") & ""
					If Len(DownText) = 0 Then DownText = ""
					If InStr(DownText, "{$") > 0 Then
						DownAddress = DownText
					Else
						'---- ʹط,ʹطݱ
						If rsDown("downid") > 0 Then
							sqlAddress = "SELECT downid,DownloadName,DownloadPath,IsDisp,UserGroup,DownPoint,IsOuter,selfont FROM NC_DownServer WHERE ChannelID=" & ChannelID & " And depth=1 And rootid =" & rsDown("downid") & " And isLock=0 " & foundstr
							Set rsAddress = Newasp.Execute(sqlAddress)
							If Not(rsAddress.EOF And rsAddress.BOF) Then
								Do While Not rsAddress.EOF
									DownAddress = DownAddress & Newasp.HtmlSetting(21)
									'---- Ƿֱʾֱӵصַ
									If rsAddress("IsDisp") <> 1 Or rsAddress("IsOuter") > 1  Then
										If m_intType = 2 Then
											If IsURLRewrite Then
												DownloadPath = ChannelRootDir & softid & "_" & rsAddress("downid") & "_" & rsDown(0) & "_1" & Newasp.HtmlExtName
											Else
												DownloadPath = ChannelRootDir & "softdown.asp?softid=" & softid & "&downid=" & rsAddress("downid") & "&n=" & rsDown(0) & "&type=1"
											End If
										Else
											DownloadPath = ChannelRootDir & "download.asp?softid=" & softid & "&downid=" & rsAddress("downid") & "&id=" & rsDown(0)
										End If
									Else
										If rsAddress("IsOuter") <> 1 Then
											DownloadPath = Trim(rsAddress("DownloadPath") & rsDown(2))
										Else
											DownloadPath = Trim(rsAddress("DownloadPath"))
										End If
									End If
									selfont = rsAddress("selfont") & ""
									If InStr(DownText, "###") > 0 Then
										DownloadName = Replace(rsAddress("DownloadName"), "{$SoftName}", DownText)
										DownloadName = Replace(DownloadName, "{$Soft_Name}", DownText)
										DownloadName = Replace(DownloadName, "###", "")
										DownAddress = Replace(DownAddress, "{$Soft_Name}", DownText)
										DownAddress = Replace(DownAddress, "{$show}", 1)
										DownAddress = Replace(DownAddress, "{$Title}", DownText)
									Else
										DownloadName = rsAddress("DownloadName") & ""
										DownloadName = Replace(DownloadName, "{$Soft_Name}", "")
										DownAddress = Replace(DownAddress, "{$Soft_Name}", "")
										DownAddress = Replace(DownAddress, "{$show}", 0)
										DownAddress = Replace(DownAddress, "{$Title}", SoftName)
									End If
									If Len(selfont) > 8 Then
										DownloadName = "<span " & selfont & ">" & DownloadName & "</span>"
									End If
									If rsAddress("UserGroup") > 0 Then
										DownloadName = Replace(DownloadName, "{$DownPoint}", rsAddress("DownPoint"))
									Else
										DownloadName = Replace(DownloadName, "{$DownPoint}", 0)
									End If
									DownloadName = Replace(DownloadName, "{$DownText}", DownText)
									DownloadName = Replace(DownloadName, "{$SoftName}", softname)
									DownAddress = Replace(DownAddress, "{$ii}", ii)
									DownAddress = Replace(DownAddress, "{$downid}", rsAddress("downid"))
									DownAddress = Replace(DownAddress, "{$DownLoadUrl}", DownloadPath)
									DownAddress = Replace(DownAddress, "{$DownLoadName}", DownloadName)
									DownAddress = Replace(DownAddress, "{$Number}", n)
									DownAddress = Replace(DownAddress, "###", "")
									rsAddress.MoveNext
									ii = ii + 1
									n = n + 1
								Loop
							End If
							Set rsAddress = Nothing
						Else
							DownAddress = DownAddress & Newasp.HtmlSetting(21)
							If showdown > 0 Then
								DownloadPath = Trim(rsDown("DownFileName") & "")
							Else
								If m_intType = 2 Then
									If IsURLRewrite Then
										DownloadPath = ChannelRootDir & softid & "_0_" & rsDown(0) & "_1" & Newasp.HtmlExtName
									Else
										DownloadPath = ChannelRootDir & "softdown.asp?softid=" & softid & "&downid=0&n=" & rsDown(0) & "&type=1"
									End If
								Else
									DownloadPath = ChannelRootDir & "download.asp?softid=" & softid & "&downid=0&id=" & rsDown(0)
								End If
							End If
							DownAddress = Replace(DownAddress, "{$ii}", ii)
							DownAddress = Replace(DownAddress, "{$downid}", 0)
							DownAddress = Replace(DownAddress, "{$Soft_Name}", "")
							DownAddress = Replace(DownAddress, "{$Title}", SoftName)
							DownAddress = Replace(DownAddress, "{$DownLoadUrl}", DownloadPath)
							DownAddress = Replace(DownAddress, "{$DownLoadName}", DownText)
							DownAddress = Replace(DownAddress, "{$Number}", n)
							DownAddress = Replace(DownAddress, "###", "")
							DownAddress = Replace(DownAddress, "{$show}", 2)
							n = n + 1
						End If
					End If
					rsDown.MoveNext
				Loop
			End If
			Set rsDown = Nothing
		Else
			SoftNameStr = Trim(Rs("SoftName") & " " & Rs("SoftVer"))
			If IsURLRewrite Then
				strDownAddress = ChannelRootDir & "dl" & Newasp.Supplemental(softid,6) & Newasp.HtmlExtName
			Else
				strDownAddress = ChannelRootDir & "softdown.asp?softid=" & softid
			End If
			DownAddress = Newasp.HtmlSetting(27)
			DownAddress = Replace(DownAddress, "{$ii}", 0)
			DownAddress = Replace(DownAddress, "{$downid}", 0)
			DownAddress = Replace(DownAddress, "{$ChannelRootDir}", ChannelRootDir)
			DownAddress = Replace(DownAddress, "{$InstallDir}", Newasp.InstallDir)
			DownAddress = Replace(DownAddress, "{$SoftName}", SoftNameStr)
			DownAddress = Replace(DownAddress, "{$SoftID}", softid)
			DownAddress = Replace(DownAddress, "{$DownLoadUrl}", strDownAddress)
		End If
		DownAddress = Replace(DownAddress, "{$WebSiteUrl}", Newasp.SiteUrl)
		If Newasp.CheckNull(DownAddress) Then
			ShowDownAddress = DownAddress
		Else
			ShowDownAddress = Newasp.HtmlSetting(22)
		End If
	End Function
	'=================================================
	'FrontSoft
	'  ãʾһ
	'  SoftID ----ID
	'=================================================
	Private Function FrontSoft(softid)
		Dim rsContext, SQL, HtmlFileUrl, HtmlFileName
		
		SQL = "SELECT TOP 1 A.SoftID,A.ClassID,A.SoftName,A.SoftVer,A.HtmlFileDate,C.HtmlFileDir,C.UseHtml FROM [NC_SoftList] A INNER JOIN [NC_Classify] C ON A.ClassID=C.ClassID WHERE A.ChannelID=" & ChannelID & " And A.isAccept > 0 And A.SoftID < " & softid & " ORDER BY A.SoftID DESC"
		Set rsContext = Newasp.Execute(SQL)
		If rsContext.EOF And rsContext.BOF Then
			HtmlContent = Replace(HtmlContent, "{$BackUrl}", "#")
			FrontSoft = "Ѿû"
		Else
			If CreateHtml <> 0 Then
				HtmlFileUrl = Newasp.ReadDestination(Newasp.InfoDestination, Newasp.ChannelDir, rsContext("HtmlFileDate"),rsContext("HtmlFileDir"),rsContext("ClassID"),rsContext("softid"),1,"")
			Else
				If IsURLRewrite Then
					HtmlFileUrl = rsContext("softid") & Newasp.HtmlExtName
				Else
					HtmlFileUrl = "?id=" & rsContext("softid")
				End If
			End If
			HtmlContent = Replace(HtmlContent, "{$BackUrl}", HtmlFileUrl)
			FrontSoft = "<a href=""" & HtmlFileUrl & """>" & Trim(rsContext("SoftName") & " " & rsContext("SoftVer")) & "</a>"
		End If
		rsContext.Close
		Set rsContext = Nothing
	End Function
	'=================================================
	'NextSoft
	'  ãʾһ
	'  SoftID ----ID
	'=================================================
	Private Function NextSoft(softid)
		Dim rsContext, SQL, HtmlFileUrl, HtmlFileName
		
		SQL = "SELECT TOP 1 A.SoftID,A.ClassID,A.SoftName,A.SoftVer,A.HtmlFileDate,C.HtmlFileDir,C.UseHtml from [NC_SoftList] A INNER JOIN [NC_Classify] C On A.ClassID=C.ClassID WHERE A.ChannelID=" & ChannelID & " And A.isAccept > 0 And A.SoftID > " & softid & " ORDER BY A.SoftID ASC"
		Set rsContext = Newasp.Execute(SQL)
		If rsContext.EOF And rsContext.BOF Then
			HtmlContent = Replace(HtmlContent, "{$NextUrl}", "#")
			NextSoft = "Ѿû"
		Else
			If CreateHtml <> 0 Then
				HtmlFileUrl = Newasp.ReadDestination(Newasp.InfoDestination, Newasp.ChannelDir, rsContext("HtmlFileDate"),rsContext("HtmlFileDir"),rsContext("ClassID"),rsContext("softid"),1,"")
			Else
				If IsURLRewrite Then
					HtmlFileUrl = rsContext("softid") & Newasp.HtmlExtName
				Else
					HtmlFileUrl = "?id=" & rsContext("softid")
				End If
			End If
			HtmlContent = Replace(HtmlContent, "{$NextUrl}", HtmlFileUrl)
			NextSoft = "<a href=""" & HtmlFileUrl & """>" & Trim(rsContext("SoftName") & " " & rsContext("SoftVer")) & "</a>"
		End If
		rsContext.Close
		Set rsContext = Nothing
	End Function
	Private Function ReadPagination(n)
		Dim HtmlFileName, CurrentPage
		
		CurrentPage = n
		HtmlFileName = Newasp.ReadFileName(Rs("HtmlFileDate"), Rs("SoftID"), Newasp.HtmlExtName, Newasp.HtmlPrefix, Newasp.HtmlForm, CurrentPage)
		ReadPagination = HtmlFileName
	End Function
	'=================================================
	'RelatedSoft
	'  ãʾ
	'  sRelated ----
	'=================================================
	Private Function RelatedSoft(sRelated, topic, softid)
		Dim rsRdlated, SQL, HtmlFileUrl, HtmlFileName
		Dim strSoftName, softname, strContent
		Dim strRelated, arrRelated, i, Resize, strRearrange
		Dim strKey
		Dim ArrayTemp()
		On Error Resume Next
		strRelated = Replace(Replace(Replace(Replace(Replace(Replace(sRelated, "[", ""), "]", ""), "'", ""), "%", ""), "", ""), "", "")
		strKey = Left(Newasp.ChkQueryStr(topic), 5)
		If Not IsNull(sRelated) And sRelated <> Empty Then
			If InStr(strRelated, "|") > 1 Then
				arrRelated = Split(strRelated, "|")
				strRelated = "((A.SoftName like '%" & arrRelated(0) & "%')"
				For i = 1 To UBound(arrRelated)
					strRelated = strRelated & " Or (A.SoftName like '%" & arrRelated(i) & "%')"
				Next
				'strRelated = strRelated & ")"
			Else
				strRelated = "((A.SoftName like '%" & strRelated & "%')"
			End If
			strRelated = strRelated & " Or (A.SoftName like '%" & strKey & "%'))"
		Else
			strRelated = "(A.SoftName like '%" & strKey & "%')"
		End If
		SQL = "SELECT Top " & CInt(Newasp.HtmlSetting(1)) & " A.softid,A.ClassID,A.ColorMode,A.FontMode,A.SoftName,A.SoftVer,A.AllHits,A.SoftTime,A.HtmlFileDate,C.HtmlFileDir,C.UseHtml FROM [NC_SoftList] A INNER JOIN [NC_Classify] C On A.ClassID=C.ClassID where A.ChannelID=" & ChannelID & " And A.isAccept > 0 And " & strRelated & " ORDER BY A.softid DESC"
		Set rsRdlated = Server.CreateObject("ADODB.Recordset")
		rsRdlated.Open SQL, Conn, 1, 1
		If Err Then
			rsRdlated.Close:Set rsRdlated = Nothing
			Exit Function
		End If
		If rsRdlated.EOF And rsRdlated.BOF Then
			RelatedSoft = ""
			Set rsRdlated = Nothing
			Exit Function
		Else
			i = 0
			Resize = 0
			Do While Not rsRdlated.EOF
				ReDim Preserve ArrayTemp(i + Resize)
				strContent = ArrayTemp(i) & Newasp.HtmlSetting(4)
				strSoftName = Trim(rsRdlated("SoftName") & " " & rsRdlated("SoftVer"))
				strSoftName = Newasp.GotTopic(strSoftName, CInt(Newasp.HtmlSetting(2)))
				strSoftName = Newasp.ReadFontMode(strSoftName, rsRdlated("ColorMode"), rsRdlated("FontMode"))
				If rsRdlated("softid") = softid Then
					If IsURLRewrite Then
						softname = "<a href=""" & ChannelRootDir & "dl" & Newasp.Supplemental(rsRdlated("softid"),6) & Newasp.HtmlExtName & """ target=""_blank"">" & strSoftName & "</a>"
					Else
						softname = "<a href=""" & ChannelRootDir & "softdown.asp?softid=" & rsRdlated("softid") & """ target=""_blank"">" & strSoftName & "</a>"
					End If
				Else
					If CreateHtml <> 0 Then
						HtmlFileUrl = Newasp.ReadDestination(Newasp.InfoDestination, Newasp.ChannelDir, rsRdlated("HtmlFileDate"),rsRdlated("HtmlFileDir"),rsRdlated("ClassID"),rsRdlated("softid"),1,"")
					Else
						If IsURLRewrite Then
							HtmlFileUrl = rsRdlated("softid") & Newasp.HtmlExtName
						Else
							HtmlFileUrl = "show.asp?id=" & rsRdlated("softid")
						End If
					End If
					softname = "<a href=""" & HtmlFileUrl & """" & LoadRemark(Trim(rsRdlated("SoftName") & rsRdlated("SoftVer"))) & ">" & strSoftName & "</a>"
				End If
				strContent = Replace(strContent, "{$SoftName}", softname)
				strContent = Replace(strContent, "{$AllHits}", rsRdlated("AllHits"))
				strContent = Replace(strContent, "{$WriteTime}", Newasp.ShowDateTime(rsRdlated("SoftTime"), CInt(Newasp.HtmlSetting(3))))
				strContent = Replace(strContent, "{$DateTime}", Newasp.ShowDateTime(rsRdlated("SoftTime"), CInt(Newasp.HtmlSetting(3))))
				ArrayTemp(i) = strContent
				rsRdlated.MoveNext
				i = i + 1
			Loop
		End If
		rsRdlated.Close
		Set rsRdlated = Nothing
		strRearrange = Join(ArrayTemp, vbCrLf)
		RelatedSoft = strRearrange
	End Function
	'=================================================
	'ShowHotSoft
	'  ãʾ
	'  ClassID ----ID
	'=================================================
	Private Function ShowHotSoft(ClassID)
		Dim rsHot, SQL, HtmlFileUrl, HtmlFileName
		Dim strSoftName, softname, strContent
		Dim i, Resize, strRearrange
		Dim ArrayTemp()
		
		SQL = "SELECT Top " & CInt(Newasp.HtmlSetting(1)) & " A.SoftID,A.ClassID,A.ColorMode,A.FontMode,A.SoftName,A.SoftVer,A.AllHits,A.SoftTime,A.HtmlFileDate,C.HtmlFileDir,C.UseHtml FROM [NC_SoftList] A INNER JOIN [NC_Classify] C On A.ClassID=C.ClassID WHERE A.ChannelID=" & ChannelID & " And A.isAccept > 0 And A.AllHits >= " & CLng(Newasp.LeastHotHist) & " And A.ClassID  in (" & Rs("ChildStr") & ") ORDER BY A.AllHits DESC,A.SoftID DESC"
		Set rsHot = Newasp.Execute(SQL)
		If rsHot.EOF And rsHot.BOF Then
			ShowHotSoft = ""
			Set rsHot = Nothing
			Exit Function
		Else
			i = 0
			Resize = 0
			Do While Not rsHot.EOF
				ReDim Preserve ArrayTemp(i + Resize)
				strContent = ArrayTemp(i) & Newasp.HtmlSetting(4)
				strSoftName = rsHot("SoftName") & " " & rsHot("SoftVer")
				strSoftName = Newasp.GotTopic(rsHot("SoftName"), CInt(Newasp.HtmlSetting(2)))
				strSoftName = Newasp.ReadFontMode(strSoftName, rsHot("ColorMode"), rsHot("FontMode"))
				If CreateHtml <> 0 Then
					HtmlFileUrl = Newasp.ReadDestination(Newasp.InfoDestination, Newasp.ChannelDir, rsHot("HtmlFileDate"),rsHot("HtmlFileDir"),rsHot("ClassID"),rsHot("softid"),1,"")
				Else
					If IsURLRewrite Then
						HtmlFileUrl = rsHot("softid") & Newasp.HtmlExtName
					Else
						HtmlFileUrl = "show.asp?id=" & rsHot("softid")
					End If
				End If
				softname = "<a href="""& HtmlFileUrl & """" & LoadRemark(Trim(rsHot("SoftName") & " " & rsHot("SoftVer"))) & ">" & strSoftName & "</a>"
				strContent = Replace(strContent, "{$SoftName}", softname)
				strContent = Replace(strContent, "{$AllHits}", rsHot("AllHits"))
				strContent = Replace(strContent, "{$WriteTime}", Newasp.ShowDateTime(rsHot("SoftTime"), CInt(Newasp.HtmlSetting(3))))
				ArrayTemp(i) = strContent
				rsHot.MoveNext
				i = i + 1
			Loop
		End If
		rsHot.Close
		Set rsHot = Nothing
		strRearrange = Join(ArrayTemp, vbCrLf)
		ShowHotSoft = strRearrange
	End Function
	'================================================
	'SoftComment
	'  ã
	'  SoftID ----ID
	'================================================
	Private Function SoftComment(softid)
		Dim rsComment, SQL, strContent, strComment
		Dim i, Resize, strRearrange
		Dim ArrayTemp()
		
		Set rsComment = Newasp.Execute("SELECT TOP " & CInt(Newasp.HtmlSetting(5)) & " [content],Grade,username,postime,postip FROM NC_Comment WHERE ChannelID=" & ChannelID & " And postid = " & softid & " ORDER BY postime DESC,CommentID DESC")
		If Not (rsComment.EOF And rsComment.BOF) Then
			i = 0
			Resize = 0
			Do While Not rsComment.EOF
				ReDim Preserve ArrayTemp(i + Resize)
				strContent = ArrayTemp(i) & Newasp.HtmlSetting(7)
				strComment = Newasp.CutString(rsComment("content"), CInt(Newasp.HtmlSetting(6)))
				strContent = Replace(strContent, "{$Comment}", Newasp.HTMLEncode(strComment))
				strContent = Replace(strContent, "{$UserName}", Newasp.HTMLEncode(rsComment("username")))
				strContent = Replace(strContent, "{$UserGrade}", rsComment("Grade"))
				strContent = Replace(strContent, "{$postime}", rsComment("postime"))
				strContent = Replace(strContent, "{$postip}", rsComment("postip"))
				ArrayTemp(i) = strContent
				rsComment.MoveNext
				i = i + 1
			Loop
		End If
		rsComment.Close
		strRearrange = Join(ArrayTemp, vbCrLf)
		Set rsComment = Nothing
		SoftComment = strRearrange
	End Function
	'#############################\\ִбʼ//#############################
	Public Sub ShowDownList()
		If CreateHtml <> 0 Then
			Response.Redirect (ChannelRootDir & "index" & Newasp.HtmlExtName)
			Exit Sub
		Else
			Newasp.PreventInfuse
			If Not IsNumeric(Request("page")) And Len(Request("page")) <> 0 Then
				Response.Write ("ϵͳ!")
				Response.End
			End If
			If Not IsEmpty(Request("page")) And Len(Request("page")) <> 0 Then
				CurrentPage = Newasp.ChkNumeric(Request("page"))
			Else
				CurrentPage = 1
			End If
			ClassID = Newasp.ChkNumeric(Request("ClassID"))
			Response.Write CreateSoftList(ClassID, 1)
		End If
		
	End Sub
	'================================================
	'ReadSoftList
	'  ãȡб
	'================================================
	Public Function CreateSoftList(clsid, n)
		Dim rsClass, TemplateContent, strTemplate, strOrder
		Dim ParentTemplate, ChildTemplate, HtmlFileName
		Dim MaxListnum, strMaxListop, showtree
		Dim AdsCode,stopad,m_strFilePath
		
		If Not IsNumeric(clsid) Then Exit Function
		Set rsClass = Newasp.Execute("SELECT ClassID,ClassName,ChildStr,ParentID,ParentStr,Child,skinid,HtmlFileDir,UseHtml,AdsCode,stopad FROM [NC_Classify] WHERE ChannelID = " & ChannelID & " And ClassID=" & clsid)
		If rsClass.BOF And rsClass.EOF Then
			If CreateHtml = 0 Then
				Response.Write "<meta http-equiv=""refresh"" content=""2;url=/"" />" & vbNewLine
				Response.Write "<p align=""center"" style=""font-size: 12px;color: red;"">Բ𣬸ҳ淢˴޷! ϵͳԶתվҳ......</p>" & vbNewLine
			End If
			Set rsClass = Nothing
			Exit Function
		Else
			strClassName = rsClass("ClassName")
			ClassID = rsClass("ClassID")
			ChildStr = rsClass("ChildStr")
			Child = rsClass("Child")
			strFileDir = rsClass("HtmlFileDir")
			ParentID = rsClass("ParentID")
			strParent = rsClass("ParentStr")
			If rsClass("skinid") <> 0 Then
				skinid = rsClass("skinid")
			Else
				skinid = Newasp.ChkNumeric(Newasp.ChannelSkin)
			End If
			AdsCode = rsClass("AdsCode")
			stopad = rsClass("stopad")
		End If
		rsClass.Close: Set rsClass = Nothing
		
		PageType = 1
		
		Newasp.LoadTemplates ChannelID, 2, skinid
		m_strFilePath = Newasp.ReadDestination(Newasp.SortDestination, Newasp.ChannelDir, "",strFileDir,ClassID,0,1,"")
		HtmlFilePath = Newasp.HtmlFilesPath
		m_strFileDir = strFileDir
		
		strTemplate = Split(Newasp.HtmlContent, "|||@@@|||")
		'-- бʾʽ
		showtree = Newasp.ChkNumeric(Newasp.HtmlSetting(4))
		'-- б
		MaxListnum = Newasp.ChkNumeric(Newasp.HtmlSetting(5))
		
		strlen = Newasp.ChkNumeric(Newasp.HtmlSetting(10))
		
		ParentTemplate = strTemplate(1)
		ChildTemplate = strTemplate(0)
		If Child <> 0 And showtree <> 9 Then
			TemplateContent = ParentTemplate
		Else
			TemplateContent = ChildTemplate
		End If
		
		HtmlContent = TemplateContent
		'-- 
		HtmlContent = AdsReplace(HtmlContent,AdsCode, stopad)
		HtmlContent = Replace(HtmlContent, "{$ChannelRootDir}", ChannelRootDir)
		HtmlContent = Replace(HtmlContent, "{$InstallDir}", strInstallDir)
		HtmlContent = Replace(HtmlContent, "{$ChannelID}", ChannelID)
		HtmlContent = Replace(HtmlContent, "{$ModuleName}", Newasp.ModuleName)
		HtmlContent = Replace(HtmlContent, "{$ClassID}", ClassID)
		HtmlContent = Replace(HtmlContent, "{$ThisClassName}", strClassName)
		HtmlContent = Replace(HtmlContent, "{$IndexTitle}", strIndexName)
		HtmlContent = Replace(HtmlContent, "{$SoftIndex}", strIndexName)
		If Child <> 0 And showtree <> 9 Then
			Call LoadParentList
			Call ReplaceContent
			If CInt(CreateHtml) <> 0 Then
				'Ŀ¼
				Newasp.CreatPathEx (strBasicPath & HtmlFilePath)
				'ʼɸHTMLҳ
				HtmlFileName = m_strFilePath
				Newasp.CreatedTextFile strBasicPath & HtmlFileName, HtmlContent
				If IsShowFlush = 1 Then
					Response.Write "<li style=""font-size: 16px;"">[<font color=""red"">" & strClassName & "</font>]бHTML... <a href=" & HtmlFileName & " target=_blank>" & Server.MapPath(HtmlFileName) & "</a></li>" & vbNewLine
					Response.Flush
				End If
				MakePageDone = 1
			End If
		Else
			Call ReplaceContent
			'ÿҳʾ
			maxperpage = Newasp.ChkNumeric(Newasp.HtmlSetting(1))
			If CLng(CurrentPage) = 0 Then CurrentPage = 1
			If Newasp.CheckStr(LCase(Request("order"))) = "hits" Then
				strOrder = "ORDER BY A.isTop DESC, A.AllHits DESC ,A.SoftID DESC"
			ElseIf Newasp.CheckStr(LCase(Request("order"))) = "name" Then
				strOrder = "ORDER BY A.isTop DESC, A.SoftName DESC ,A.SoftID DESC"
			ElseIf Newasp.CheckStr(LCase(Request("order"))) = "size" Then
				strOrder = "ORDER BY A.isTop DESC, A.SoftSize DESC ,A.SoftID DESC"
			Else
				strOrder = "ORDER BY A.isTop DESC, A.SoftTime DESC ,A.SoftID DESC"
			End If
			
			TotalNumber = Newasp.Execute("SELECT COUNT(SoftID) FROM NC_SoftList WHERE ChannelID = " & ChannelID & " And isAccept > 0 And ClassID in (" & ChildStr & ")")(0)
			totalrec = TotalNumber
			'-- ˸ʾ,ʾ
			If Child > 0 And TotalNumber > MaxListnum And MaxListnum <> 999 Then
				strMaxListop = " TOP " & MaxListnum
				TotalNumber = MaxListnum
			Else
				strMaxListop = vbNullString
			End If
			TotalPageNum = CLng(TotalNumber / maxperpage)  'õҳ
			If TotalPageNum < TotalNumber / maxperpage Then TotalPageNum = TotalPageNum + 1
			If CurrentPage < 1 Then CurrentPage = 1
			If CurrentPage > TotalPageNum Then CurrentPage = TotalPageNum
			Set Rs = CreateObject("ADODB.Recordset")
			SQL = "SELECT " & strMaxListop & " A.SoftID,A.ClassID,A.ColorMode,A.FontMode,A.SoftName,A.SoftVer,A.[content],A.Related,A.SoftType,A.RunSystem,A.impower,A.SoftSize,A.star,A.SoftTime,A.username,A.IsTop,A.IsBest,A.AllHits,A.SoftImage,A.HtmlFileDate,A.isxmltext,A.xmlfilename,C.ClassName,C.ParentID,C.ParentStr,C.skinid,C.HtmlFileDir,C.ChildStr,C.UseHtml FROM [NC_SoftList] A INNER JOIN [NC_Classify] C On A.ClassID=C.ClassID where A.ChannelID=" & ChannelID & " And A.isAccept > 0 And A.ClassID in (" & ChildStr & ") " & strOrder & ""
			If isSqlDataBase = 1 Then
				Set Rs = Newasp.Execute(SQL)
			Else
				Rs.Open SQL, Conn, 1, 1
			End If
			'If Err.Number <> 0 Then Response.Write "SQL ѯ"
			If Rs.BOF And Rs.EOF Then
				HtmlContent = Replace(HtmlContent, "{$PageTitle}", strClassName)
				HtmlContent = Replace(HtmlContent, "{$ReadListPage}", "ûҵκ" & Newasp.ModuleName & "")
				HtmlContent = Replace(HtmlContent, Newasp.CutFixContent(HtmlContent, "[ShowRepetend", "[/ShowRepetend]", 1), "")
				If CreateHtml <> 0 Then
					Newasp.CreatPathEx (strBasicPath & HtmlFilePath)
					HtmlFileName = m_strFilePath
					Newasp.CreatedTextFile strBasicPath & HtmlFileName, HtmlContent
					If IsShowFlush = 1 Then Response.Write "<li style=""font-size: 12px;"">[<font color=""red"">" & strClassName & "</font>]бHTML... <a href=" & HtmlFileName & " target=_blank>" & Server.MapPath(HtmlFileName) & "</a></li>" & vbNewLine
					Response.Flush
					MakePageDone = 1
				End If
			Else
				TotalNumber = totalrec
				TempListContent = Newasp.CutFixContent(HtmlContent, "[ShowRepetend]", "[/ShowRepetend]", 1)
				If CreateHtml <> 0 Then
					Call LoadChildListHtml(n)
				Else
					Call LoadChildListAsp
				End If
			End If
			Rs.Close: Set Rs = Nothing
		End If
		If CreateHtml = 0 Then CreateSoftList = HtmlContent
	End Function
	'================================================
	'ReplaceContent
	'  ã滻ģ
	'================================================
	Private Sub ReplaceContent()
		HtmlContent = HTML.ReadCurrentStation(HtmlContent, ChannelID, ClassID, strClassName, ParentID, strParent, strFileDir)
		HtmlContent = HTML.ReadAnnounceContent(HtmlContent, ChannelID)
		HtmlContent = ReadClassMenubar(HtmlContent)
		HtmlContent = ReadClassMenu(HtmlContent)
		HtmlContent = HTML.ReadSoftPic(HtmlContent)
		HtmlContent = HTML.ReadSoftList(HtmlContent)
		HtmlContent = HTML.ReadNewsPicAndText(HtmlContent)
		HtmlContent = HTML.ReadSoftPicAndText(HtmlContent)
		HtmlContent = HTML.ReadPopularArticle(HtmlContent)
		HtmlContent = HTML.ReadPopularSoft(HtmlContent)
		HtmlContent = HTML.ReadStatistic(HtmlContent)
		HtmlContent = HTML.ReadFlashList(HtmlContent)
		HtmlContent = HTML.ReadFlashPic(HtmlContent)
		HtmlContent = HTML.ReadArticleList(HtmlContent)
		HtmlContent = HTML.ReadArticlePic(HtmlContent)
		HtmlContent = Replace(HtmlContent, "{$CurrentClass}", HTML.CurrentClass)
		Dim strPageTitle
		If Len(Trim(Newasp.HtmlSetting(11))) > 1 Then
			strPageTitle = HTML.CurrentClass & Newasp.HtmlSetting(11)
		Else
			strPageTitle = HTML.CurrentClass
		End If
		HtmlContent = Replace(HtmlContent, "{$PageTitle}", strPageTitle)
		HtmlContent = Replace(HtmlContent, "{$SkinPath}", Newasp.SkinPath)
		HtmlContent = Replace(HtmlContent, "{$InstallDir}", strInstallDir)
		HtmlContent = Replace(HtmlContent, "{$ChannelID}", ChannelID)
	End Sub
	'================================================
	'LoadParentList
	'  ãװظб
	'================================================
	Private Sub LoadParentList()
		Dim rsClslist, strContent, i, showtree
		Dim ClassUrl, ClassNameStr, n
		
		showtree = Trim(Newasp.HtmlSetting(4))
		PageType = 1
		TempListContent = Newasp.CutFixContent(HtmlContent, "[ShowRepetend]", "[/ShowRepetend]", 1)
		If Not IsNull(TempListContent) Then
			SQL = "SELECT TOP " & CInt(Newasp.HtmlSetting(5)) & " ClassID,ClassName,HtmlFileDir,UseHtml FROM [NC_Classify] WHERE ChannelID = " & ChannelID & " And TurnLink = 0 And ParentID=" & ClassID & " ORDER BY orders ASC, ClassID ASC"
			Set rsClslist = Newasp.Execute(SQL)
			If rsClslist.BOF And rsClslist.EOF Then
				Set rsClslist = Nothing
				Exit Sub
			Else
				If showtree <> "1" Then strContent = "<table width=""100%"" align=center border=0 cellpadding=0 cellspacing=0 class=tablist>" & vbCrLf
				n = 0
				Do While Not rsClslist.EOF
					If showtree <> "1" Then 
						strContent = strContent & "<tr valign=""top"">" & vbCrLf
					Else
						strContent = strContent & "<div class=""mainParentListArea"">"
					End If
					For i = 1 To 2
						n = n + 1
						If showtree <> "1" Then strContent = strContent & "<td class=""tdlist"">"
						
						If Not (rsClslist.EOF) Then
							strContent = strContent & TempListContent
							If CInt(CreateHtml) <> 0 Then
								'ClassUrl = ChannelRootDir & rsClslist("HtmlFileDir")
								ClassUrl = Newasp.ReadDestination(Newasp.SortDestination, Newasp.ChannelDir, "",rsClslist("HtmlFileDir"),rsClslist("ClassID"),0,1,"")
							Else
								If IsURLRewrite Then
									ClassUrl = ChannelRootDir & "list_1_" & rsClslist("ClassID") & Newasp.HtmlExtName
								Else
									ClassUrl = ChannelRootDir & "list.asp?classid=" & rsClslist("ClassID")
								End If
							End If
							ClassNameStr = "<a href=""" & ClassUrl & """ class=""showtitle"">" & rsClslist("ClassName") & "</a>"
							strContent = Replace(strContent, "{$ChannelID}", ChannelID)
							strContent = Replace(strContent, "{$ClassifyID}", rsClslist("ClassID"))
							strContent = Replace(strContent, "{$ClassName}", ClassNameStr)
							strContent = Replace(strContent, "{$ClassUrl}", ClassUrl)
							strContent = Replace(strContent, "{$n}", n)
							strContent = Replace(strContent, "{$i}", i)
							If showtree <> "1" Then strContent = strContent & "</td>" & vbCrLf
							rsClslist.MoveNext
						Else
							If showtree <> "1" Then strContent = strContent & "</td>" & vbCrLf
						End If
					Next
					If showtree <> "1" Then
						strContent = strContent & "</tr>" & vbCrLf
					Else
						strContent = strContent & "</div>" & vbCrLf
					End If
				Loop
				If showtree <> "1" Then strContent = strContent & "</table>" & vbCrLf
			End If
			HtmlContent = Replace(HtmlContent, TempListContent, strContent)
			HtmlContent = Replace(HtmlContent, "[ShowRepetend]", "")
			HtmlContent = Replace(HtmlContent, "[/ShowRepetend]", "")
			rsClslist.Close: Set rsClslist = Nothing
		End If
	End Sub
	'================================================
	'LoadChildListHtml
	'  ãװӼбHTML
	'================================================
	Private Sub LoadChildListHtml(n)
		Dim Perownum
		Dim PerPageNum,c
		Perownum = Newasp.ChkNumeric(Newasp.HtmlSetting(8))
		PerPageNum = MakeListNum
		
		If IsNull(TempListContent) Then Exit Sub
		If n > TotalPageNum Then
			MakePageDone = 1
			Exit Sub
		End If
		'Ŀ¼
		Newasp.CreatPathEx (strBasicPath & HtmlFilePath)
		If MakeHtmlMode = 0 Then
			For CurrentPage = n To TotalPageNum
				Call CreateListHtml(CurrentPage,Perownum)
			Next
		Else
			c = 1
			For CurrentPage = n To TotalPageNum
				c = c + 1
				If CurrentPage > TotalPageNum Then Exit For
				Call CreateListHtml(CurrentPage,Perownum)
				If c > PerPageNum Then Exit Sub
			Next
			MakePageDone = 1
		End If
		
	End Sub
	Private Sub CreateListHtml(CurrentPage,Perownum)
		If CurrentPage > TotalPageNum Then MakePageDone = 1 : Exit Sub
		Dim HtmlFileName
		Dim ii,w
		Rs.MoveFirst
		i = 0
		If CurrentPage < 1 Then CurrentPage = 1
		If TotalPageNum > 1 Then Rs.Move (CurrentPage - 1) * maxperpage
		ListContent = ""
		j = (CurrentPage - 1) * maxperpage + 1
		
		If Perownum > 1 Then 
			ListContent = Newasp.HtmlSetting(9)
			w = FormatPercent(100 / Perownum / 100,0)
		End If
		
		Do While Not Rs.EOF And i < CInt(maxperpage)
			If Not Response.IsClientConnected Then Response.End
			If Perownum > 1 Then
				ListContent = ListContent & "<tr valign=""top"">" & vbCrLf
				For ii = 1 To Perownum
					ListContent = ListContent & "<td width=""" & w & """ class=""shoplistrow"">"
					If Not Rs.EOF Then
						Call LoadListDetail
						Rs.movenext
						i = i + 1
						j = j + 1
					End If
					ListContent = ListContent & "</td>" & vbCrLf
				Next
				ListContent = ListContent & "</tr>" & vbCrLf
			Else
				Call LoadListDetail
				Rs.MoveNext
				i = i + 1
				j = j + 1
			End If
			If i >= maxperpage Then Exit Do
		Loop
		'--ʼϢҳHTMLҳ
		Dim strHtmlFront, strHtmlPage
		HtmlFileName = Newasp.ReadDestination(Newasp.SortDestination, Newasp.ChannelDir, "",m_strFileDir,ClassID,0,CurrentPage,"page")
		strHtmlPage = showhtmlpage(CurrentPage, TotalPageNum, TotalNumber, maxperpage, Newasp.HtmlFilesName, strClassName)
		HtmlTemplate = HtmlContent
		HtmlTemplate = Replace(HtmlTemplate, TempListContent, ListContent)
		HtmlTemplate = Replace(HtmlTemplate, "{$ReadListPage}", strHtmlPage)
		HtmlTemplate = Replace(HtmlTemplate, "[ShowRepetend]", "")
		HtmlTemplate = Replace(HtmlTemplate, "[/ShowRepetend]", "")
		'ʼӷHTMLҳ
		'HtmlFileName = HtmlFilePath & ReadListPageName(ClassID, CurrentPage)
		Newasp.CreatedTextFile strBasicPath & HtmlFileName, HtmlTemplate
		If IsShowFlush = 1 Then Response.Write "<li style=""font-size: 12px;"">[<font color=""red"">" & strClassName & "</font>]бHTML... <a href=" & HtmlFileName & " target=_blank>" & Server.MapPath(HtmlFileName) & "</a></li>" & vbNewLine
		Response.Flush
	End Sub
	
	'================================================
	'LoadChildListAsp
	'  ãװӼбASP
	'================================================
	Private Sub LoadChildListAsp()
		If IsNull(TempListContent) Then Exit Sub
		
		Dim Perownum,ii,w
		Perownum = Newasp.ChkNumeric(Newasp.HtmlSetting(8))
		
		i = 0
		Rs.MoveFirst
		If TotalPageNum > 1 Then Rs.Move (CurrentPage - 1) * maxperpage
		ListContent = ""
		
		j = (CurrentPage - 1) * maxperpage + 1
		If Perownum > 1 Then 
			ListContent = Newasp.HtmlSetting(9)
			w = FormatPercent(100 / Perownum / 100,0)
		End If
		
		Do While Not Rs.EOF And i < CInt(maxperpage)
			If Not Response.IsClientConnected Then Response.End
			If Perownum > 1 Then
				ListContent = ListContent & "<tr valign=""top"">" & vbCrLf
				For ii = 1 To Perownum
					ListContent = ListContent & "<td width=""" & w & """ class=""shoplistrow"">"
					If Not Rs.EOF Then
						Call LoadListDetail
						Rs.movenext
						i = i + 1
						j = j + 1
					End If
					ListContent = ListContent & "</td>" & vbCrLf
				Next
				ListContent = ListContent & "</tr>" & vbCrLf
			Else
				Call LoadListDetail
				Rs.MoveNext
				i = i + 1
				j = j + 1
			End If
			If i >= maxperpage Then Exit Do
		Loop
		Dim strPagination
		strPagination = ShowListPage(CurrentPage, TotalPageNum, TotalNumber, maxperpage, ASPCurrentPage(PageType), strClassName)
		HtmlContent = Replace(HtmlContent, TempListContent, ListContent)
		HtmlContent = Replace(HtmlContent, "[ShowRepetend]", "")
		HtmlContent = Replace(HtmlContent, "[/ShowRepetend]", "")
		HtmlContent = Replace(HtmlContent, "{$ReadListPage}", strPagination)
	End Sub
	'================================================
	'LoadListDetail
	'  ãװӼбϸ
	'================================================
	Private Sub LoadListDetail()
		Dim sTitle, sTopic, softname, ListStyle
		Dim SoftUrl, SoftTime, sClassName, SoftImageUrl, SoftImage
		
		ListContent = ListContent & TempListContent
		If (i Mod 2) = 0 Then
			ListStyle = 1
		Else
			ListStyle = 2
		End If
		If strlen > 0 Then
			sTitle = Newasp.GotTopic(Trim(Rs("SoftName") & " " & Rs("SoftVer")),strlen)
		Else
			sTitle = Trim(Rs("SoftName") & " " & Rs("SoftVer"))
		End If
		sTitle = Newasp.ReadFontMode(sTitle, Rs("ColorMode"), Rs("FontMode"))
		If CInt(CreateHtml) <> 0 Then
			SoftUrl = Newasp.ReadDestination(Newasp.InfoDestination, Newasp.ChannelDir, Rs("HtmlFileDate"),Rs("HtmlFileDir"),Rs("ClassID"),Rs("softid"),1,"")
			sClassName = Newasp.ReadDestination(Newasp.SortDestination, Newasp.ChannelDir, Rs("HtmlFileDate"),Rs("HtmlFileDir"),Rs("ClassID"),Rs("softid"),1,"")
		Else
			If IsURLRewrite Then
				SoftUrl = ChannelRootDir & Rs("softid") & Newasp.HtmlExtName
				sClassName = ChannelRootDir & "list_1_" & Rs("ClassID") & Newasp.HtmlExtName
			Else
				SoftUrl = ChannelRootDir & "show.asp?id=" & Rs("softid")
				sClassName = ChannelRootDir & "list.asp?classid=" & Rs("ClassID")
			End If
		End If
		SoftImageUrl = Newasp.GetImageUrl(Rs("SoftImage"), ChannelRootDir)
		SoftImage = Newasp.GetFlashAndPic(SoftImageUrl, CInt(Newasp.HtmlSetting(6)), CInt(Newasp.HtmlSetting(7)))
		SoftImage = "<a href=""" & SoftUrl & """ title=""" & Trim(Rs("SoftName") & " " & Rs("SoftVer")) & """>" & SoftImage & "</a>"
		sClassName = "<a class=newclass href=""" & sClassName & """>" & Rs("ClassName") & "</a>"
		softname = "<a class=newsoft href=""" & SoftUrl & """" & LoadRemark(Trim(Rs("SoftName") & " " & Rs("SoftVer"))) & ">" & sTitle & "</a>"
		'--XMLļ,ʹXMLļж------
		isxmltext = Newasp.ChkNumeric(Rs("isxmltext"))
		xmlfilename = Rs("xmlfilename") & ""
		If isxmltext = 1 Then
			xmlFilePath = m_strXMLPath & xmlfilename
			TextContent = Newasp.ReadXMLDocument(xmlFilePath,"softinfo/@content")
			If TextContent = "" Then TextContent = Rs("content") & ""
		Else
			TextContent = Rs("content")
		End If
		'---------------------------------------------
		SoftIntro = Newasp.CutString(TextContent, CInt(Newasp.HtmlSetting(3)))
		
		SoftTime = Newasp.ShowDateTime(Rs("SoftTime"), CInt(Newasp.HtmlSetting(2)))
		ListContent = Replace(ListContent, "{$ClassifyName}", sClassName)
		ListContent = Replace(ListContent, "{$SoftName}", softname)
		ListContent = Replace(ListContent, "{$SoftTopic}", sTitle)
		ListContent = Replace(ListContent, "{$SoftUrl}", SoftUrl)
		ListContent = Replace(ListContent, "{$SoftImage}", SoftImage)
		ListContent = Replace(ListContent, "{$SoftID}", Rs("softid"))
		ListContent = Replace(ListContent, "{$SoftHits}", Rs("AllHits"))
		ListContent = Replace(ListContent, "{$UserName}", Rs("username")&"")
		ListContent = Replace(ListContent, "{$Star}", Rs("star"))
		ListContent = Replace(ListContent, "{$SoftDateTime}", SoftTime)
		ListContent = Replace(ListContent, "{$SoftContent}", SoftIntro)
		ListContent = Replace(ListContent, "{$ListStyle}", ListStyle)
		ListContent = Replace(ListContent, "{$SoftSize}", ReadSoftsize(Rs("SoftSize")))
		ListContent = Replace(ListContent, "{$RunSystem}", Rs("RunSystem")&"")
		ListContent = Replace(ListContent, "{$Impower}", Rs("impower")&"")
		ListContent = Replace(ListContent, "{$SoftType}", Rs("SoftType")&"")
		ListContent = Replace(ListContent, "{$IsTop}", Rs("IsTop"))
		ListContent = Replace(ListContent, "{$IsBest}", Rs("IsBest"))
		ListContent = Replace(ListContent, "{$Order}", j)
		ListContent = Replace(ListContent, "{$i}", i)
		ListContent = Replace(ListContent, "{$PageID}", CurrentPage)
		
	End Sub

	Public Function ASPCurrentPage(stype)
		Dim CurrentUrl
		Select Case stype
			Case "1"
				CurrentUrl = "&amp;classid=" & Trim(Request("classid")) & "&amp;order=" & Trim(Request("order"))
			Case "2"
				CurrentUrl = "&amp;sid=" & Trim(Request("sid"))
			Case "3"
				CurrentUrl = ""
			Case "4"
				CurrentUrl = ""
			Case "6"
				CurrentUrl = "&amp;type=" & Newasp.CheckStr(Request("type"))
			Case Else
				If Trim(Request("word")) <> "" Then
					CurrentUrl = "&amp;word=" & Trim(Request("word"))
				Else
					CurrentUrl = "&amp;act=" & Trim(Request("act")) & "&amp;classid=" & Trim(Request("classid")) & "&amp;keyword=" & Trim(Request("keyword"))
				End If
		End Select
		ASPCurrentPage = CurrentUrl
	End Function
	
	Private Function ReadListPageName(ClassID, CurrentPage)
		ReadListPageName = Newasp.ClassFileName(ClassID, Newasp.HtmlExtName, Newasp.HtmlPrefix, CurrentPage)
	End Function
	'#############################\\ִרʼ//#############################
	Public Sub ShowDownSpecial()
		If CreateHtml <> 0 Then
			Response.Redirect (ChannelRootDir & "index" & Newasp.HtmlExtName)
			Exit Sub
		Else
			Newasp.PreventInfuse
			If Not IsNumeric(Request("page")) And Len(Request("page")) <> 0 Then
				Response.Write ("ϵͳ!")
				Response.End
			End If
			If Not IsEmpty(Request("page")) And Len(Request("page")) <> 0 Then
				CurrentPage = CLng(Request("page"))
			Else
				CurrentPage = 1
			End If
			SpecialID = Newasp.ChkNumeric(Request("sid"))
			Response.Write CreateSoftSpecial(SpecialID, 1)
		End If
	End Sub
	Public Function CreateSoftSpecial(sid, n)
		Dim rsPecial
		Dim HtmlFileName
		m_strCurrPageName = "special"
		PageType = 2
		If Not IsNumeric(SpecialID) Then Exit Function
		Set rsPecial = Newasp.Execute("SELECT SpecialID,SpecialName,SpecialDir FROM [NC_Special] WHERE ChannelID = " & ChannelID & " And SpecialID=" & sid)
		If rsPecial.BOF And rsPecial.EOF Then
			Response.Write ("ϵͳ!")
			Set rsPecial = Nothing
			Exit Function
		Else
			SpecialName = rsPecial("SpecialName")
			SpecialID = rsPecial("SpecialID")
			SpecialDir = rsPecial("SpecialDir")
			skinid = Newasp.ChkNumeric(Newasp.ChannelSkin)
		End If
		rsPecial.Close: Set rsPecial = Nothing
		strClassName = SpecialName
		m_strCurrPageName = SpecialDir
		Newasp.LoadTemplates ChannelID, 4, skinid
		If CreateHtml <> 0 Then
			HtmlFileName = Newasp.ReadDestination(Newasp.MoreDestination, Newasp.ChannelDir, "",SpecialDir & "/",SpecialID,SpecialID,1,m_strCurrPageName)
			HtmlFilePath = Newasp.HtmlFilesPath
			Newasp.CreatPathEx (strBasicPath & HtmlFilePath)
		End If
		HtmlContent = Newasp.HtmlContent
		HtmlContent = Replace(HtmlContent, "{$ChannelRootDir}", ChannelRootDir)
		HtmlContent = Replace(HtmlContent, "{$InstallDir}", strInstallDir)
		HtmlContent = Replace(HtmlContent, "{$ChannelID}", ChannelID)
		HtmlContent = Replace(HtmlContent, "{$ModuleName}", Newasp.ModuleName)
		HtmlContent = Replace(HtmlContent, "{$SpecialID}", SpecialID)
		HtmlContent = Replace(HtmlContent, "{$PageTitle}", SpecialName)
		HtmlContent = Replace(HtmlContent, "{$IndexTitle}", strIndexName)
		HtmlContent = Replace(HtmlContent, "{$SoftIndex}", strIndexName)
		HtmlContent = Replace(HtmlContent, "{$SpecialName}", SpecialName)
		Call ReplaceString
		maxperpage = CInt(Newasp.HtmlSetting(1))

		If CLng(CurrentPage) = 0 Then CurrentPage = 1
		'¼
		TotalNumber = Newasp.Execute("SELECT COUNT(SoftID) from NC_SoftList WHERE ChannelID = " & ChannelID & " And isAccept > 0 And SpecialID = " & SpecialID)(0)
		TotalPageNum = CLng(TotalNumber / maxperpage)  'õҳ
		If TotalPageNum < TotalNumber / maxperpage Then TotalPageNum = TotalPageNum + 1
		If CurrentPage < 1 Then CurrentPage = 1
		If CurrentPage > TotalPageNum Then CurrentPage = TotalPageNum
		Set Rs = CreateObject("ADODB.Recordset")
		SQL = "SELECT A.SoftID,A.ClassID,A.ColorMode,A.FontMode,A.SoftName,A.SoftVer,A.[content],A.Related,A.SoftType,A.RunSystem,A.impower,A.SoftSize,A.star,A.SoftTime,A.username,A.IsTop,A.IsBest,A.AllHits,A.SoftImage,A.HtmlFileDate,A.isxmltext,A.xmlfilename,C.ClassName,C.HtmlFileDir,C.UseHtml FROM [NC_SoftList] A INNER JOIN [NC_Classify] C On A.ClassID=C.ClassID WHERE A.ChannelID=" & ChannelID & " And A.isAccept > 0 And A.SpecialID = " & SpecialID & " ORDER BY A.isTop DESC, A.SoftTime DESC ,A.SoftID DESC"
		If isSqlDataBase = 1 Then
			Set Rs = Newasp.Execute(SQL)
		Else
			Rs.Open SQL, Conn, 1, 1
		End If
		If Rs.BOF And Rs.EOF Then
			'ûҵ,õıǩ
			HtmlContent = Replace(HtmlContent, "{$ReadListPage}", "ûҵκר" & Newasp.ModuleName & "")
			HtmlContent = Replace(HtmlContent, Newasp.CutFixContent(HtmlContent, "[ShowRepetend]", "[/ShowRepetend]", 1), "")
			'HTML,ִ
			If CreateHtml <> 0 Then
				Newasp.CreatedTextFile strBasicPath & HtmlFileName, HtmlContent
				If IsShowFlush = 1 Then 
					Response.Write "<li style=""font-size: 12px;"">" & strClassName & "HTML... <a href=" & HtmlFileName & " target=_blank>" & Server.MapPath(HtmlFileName) & "</a></li>" & vbNewLine
					Response.Flush
				End If
			End If
		Else
			'ȡģǩ[ShowRepetend][/ReadSoftList]еַ
			TempListContent = Newasp.CutFixContent(HtmlContent, "[ShowRepetend]", "[/ShowRepetend]", 1)
			If CreateHtml <> 0 Then
				Call LoadSoftListHtml(n)
			Else
				Call LoadChildListAsp
			End If
		End If
		Rs.Close: Set Rs = Nothing
		If CreateHtml = 0 Then CreateSoftSpecial = HtmlContent
	End Function
	'================================================
	'LoadSoftListHtml
	'  ãװбHTML
	'================================================
	Private Sub LoadSoftListHtml(n)
		Dim HtmlFileName
		
		If IsNull(TempListContent) Then Exit Sub
		For CurrentPage = n To TotalPageNum
			Rs.MoveFirst
			i = 0
			If TotalPageNum > 1 Then Rs.Move (CurrentPage - 1) * maxperpage
			'Dim bookmark:bookmark = Rs.bookmark
			ListContent = ""
			j = (CurrentPage - 1) * maxperpage + 1
			Do While Not Rs.EOF And i < CInt(maxperpage)
				If Not Response.IsClientConnected Then Response.End
				Call LoadListDetail
				Rs.MoveNext
				i = i + 1
				j = j + 1
				If i >= maxperpage Then Exit Do
			Loop
			Dim strHtmlPage
			HtmlFileName  = Newasp.ReadDestination(Newasp.MoreDestination, Newasp.ChannelDir, "",SpecialDir & "/",SpecialID,SpecialID,CurrentPage,m_strCurrPageName)
			strHtmlPage = showhtmlpage(CurrentPage, TotalPageNum, TotalNumber, maxperpage, Newasp.HtmlFilesName, SpecialName)
			
			HtmlTemplate = HtmlContent
			HtmlTemplate = Replace(HtmlTemplate, TempListContent, ListContent)
			HtmlTemplate = Replace(HtmlTemplate, "{$ReadListPage}", strHtmlPage)
			HtmlTemplate = Replace(HtmlTemplate, "[ShowRepetend]", "")
			HtmlTemplate = Replace(HtmlTemplate, "[/ShowRepetend]", "")
			'ʼӷHTMLҳ
			Newasp.CreatedTextFile strBasicPath & HtmlFileName, HtmlTemplate
			If IsShowFlush = 1 Then Response.Write "<li style=""font-size: 12px;"">" & strClassName & "HTML... <a href=" & HtmlFileName & " target=_blank>" & Server.MapPath(HtmlFileName) & "</a></li>" & vbNewLine
			Response.Flush
		Next
		Exit Sub
	End Sub
	'================================================
	'ReplaceString
	'  ã滻ģ
	'================================================
	Private Sub ReplaceString()
		HtmlContent = Replace(HtmlContent, "{$SelectedType}", "")
		HtmlContent = ReadClassMenu(HtmlContent)
		HtmlContent = HTML.ReadSoftPic(HtmlContent)
		HtmlContent = HTML.ReadSoftList(HtmlContent)
		HtmlContent = HTML.ReadSoftPicAndText(HtmlContent)
		HtmlContent = HTML.ReadPopularSoft(HtmlContent)
		HtmlContent = HTML.ReadFlashList(HtmlContent)
		HtmlContent = HTML.ReadFlashPic(HtmlContent)
		HtmlContent = HTML.ReadArticleList(HtmlContent)
		HtmlContent = HTML.ReadArticlePic(HtmlContent)
		HtmlContent = Replace(HtmlContent, "{$SkinPath}", Newasp.SkinPath)
		HtmlContent = Replace(HtmlContent, "{$InstallDir}", strInstallDir)
		HtmlContent = Replace(HtmlContent, "{$ChannelID}", ChannelID)
	End Sub
	'#############################\\ִƼʼ//#############################
	'================================================
	'ShowBestDown
	'  ãʾƼ
	'================================================
	Public Sub ShowBestDown()
		If CreateHtml <> 0 Then
			Response.Redirect (ChannelRootDir & "index" & Newasp.HtmlExtName)
			Exit Sub
		Else
			Newasp.PreventInfuse
			If Not IsNumeric(Request("page")) And Len(Request("page")) <> 0 Then
				Response.Write ("ϵͳ!")
				Response.End
			End If
			If Not IsEmpty(Request("page")) And Len(Request("page")) <> 0 Then
				CurrentPage = CLng(Request("page"))
			Else
				CurrentPage = 1
			End If
			Response.Write CreateBestDown(1)
		End If
	End Sub
	'================================================
	'ShowNewDown
	'  ãʾ
	'================================================
	Public Sub ShowNewDown()
		If CreateHtml <> 0 Then
			Response.Redirect (ChannelRootDir & "index" & Newasp.HtmlExtName)
			Exit Sub
		Else
			Newasp.PreventInfuse
			If Not IsNumeric(Request("page")) And Len(Request("page")) <> 0 Then
				Response.Write ("ϵͳ!")
				Response.End
			End If
			If Not IsEmpty(Request("page")) And Len(Request("page")) <> 0 Then
				CurrentPage = CLng(Request("page"))
			Else
				CurrentPage = 1
			End If
			Response.Write CreateBestDown(0)
		End If
	End Sub
	'================================================
	'ShowSoftType
	'  ãʾ
	'================================================
	Public Sub ShowSoftType()
		Newasp.PreventInfuse
		If Not IsNumeric(Request("page")) And Len(Request("page")) <> 0 Then
			Response.Write ("ϵͳ!")
			Response.End
		End If
		If Not IsEmpty(Request("page")) And Len(Request("page")) <> 0 Then
			CurrentPage = CLng(Request("page"))
		Else
			CurrentPage = 1
		End If
		SoftType = Newasp.CheckStr(Request("type"))
		Response.Write CreateBestDown(2)
	End Sub
	'================================================
	'ShowSoftType
	'  ãʾ
	'================================================
	Public Sub ShowHotDownload()
		Newasp.PreventInfuse
		If Not IsNumeric(Request("page")) And Len(Request("page")) <> 0 Then
			Response.Write ("ϵͳ!")
			Response.End
		End If
		If Not IsEmpty(Request("page")) And Len(Request("page")) <> 0 Then
			CurrentPage = CLng(Request("page"))
		Else
			CurrentPage = 1
		End If
		SoftType = Newasp.CheckStr(Request("type"))
		Response.Write CreateBestDown(3)
	End Sub
	'================================================
	'CreateBestDown
	'  ãƼб
	'================================================
	Public Function CreateBestDown(t)
		Dim HtmlFileName, SQL1, SQL2
		
		skinid = Newasp.ChkNumeric(Newasp.ChannelSkin)
		Newasp.LoadTemplates ChannelID, 5, skinid
		HtmlContent = Newasp.HtmlContent
		HtmlContent = Replace(HtmlContent, "{$ChannelRootDir}", ChannelRootDir)
		HtmlContent = Replace(HtmlContent, "{$InstallDir}", strInstallDir)
		HtmlContent = Replace(HtmlContent, "{$ChannelID}", ChannelID)
		HtmlContent = Replace(HtmlContent, "{$ModuleName}", Newasp.ModuleName)
		HtmlContent = Replace(HtmlContent, "{$SoftIndex}", strIndexName)
		HtmlContent = Replace(HtmlContent, "{$IndexTitle}", strIndexName)
		'HtmlContent = Replace(HtmlContent, "{$PageTitle}", "Ƽ" & Newasp.ModuleName)
		If CInt(t) = 1 Then
			strClassName = Newasp.HtmlSetting(9)
			HtmlContent = Replace(HtmlContent, "{$PageTitle}", Newasp.HtmlSetting(9))
			PageType = 3
			SQL1 = "And IsBest>0"
			SQL2 = "And A.IsBest>0 ORDER BY A.isTop DESC, A.SoftTime DESC ,A.SoftID DESC"
			m_strCurrPageName = "best"
		ElseIf CInt(t) = 2 Then
			Dim Channel_Setting, strSoftType, SelectedType, i
			Channel_Setting = Split(Newasp.Channel_Setting, "|||")(2)
			strSoftType = Split(Channel_Setting, ",")
			SelectedType = "<select name=""type"" size=""1"" style=""font-size: 9pt"" onChange=""if(this.options[this.selectedIndex].value!=''){location=this.options[this.selectedIndex].value;}"">" & vbNewLine
			SelectedType = SelectedType & "<option value=""showtype.asp"">ȫ" & Newasp.ModuleName & "</option>" & vbNewLine
			For i = 0 To UBound(strSoftType)
				SelectedType = SelectedType & "<option value=""showtype.asp?type=" & strSoftType(i) & """"
				If Trim(strSoftType(i)) = Trim(SoftType) Then SelectedType = SelectedType & " selected"
				SelectedType = SelectedType & ">" & strSoftType(i) & "</option>" & vbNewLine
			Next
			SelectedType = SelectedType & "<select>" & vbNewLine
			HtmlContent = Replace(HtmlContent, "{$SelectedType}", SelectedType)
			If Trim(SoftType) <> "" Then
				strClassName = SoftType
				HtmlContent = Replace(HtmlContent, "{$PageTitle}", SoftType)
				PageType = 6
				SQL1 = "And SoftType='" & SoftType & "'"
				SQL2 = "And A.SoftType='" & SoftType & "' ORDER BY A.isTop DESC, A.SoftTime DESC ,A.SoftID DESC"
			Else
				strClassName = "ȫ" & Newasp.ModuleName & ""
				HtmlContent = Replace(HtmlContent, "{$PageTitle}", Newasp.ModuleName & "")
				PageType = 6
				SQL1 = ""
				SQL2 =  " ORDER BY A.isTop DESC, A.SoftTime DESC ,A.SoftID DESC"
			End If
			m_strCurrPageName = "new"
		ElseIf CInt(t) = 3 Then
			strClassName = Newasp.HtmlSetting(10)
			HtmlContent = Replace(HtmlContent, "{$PageTitle}", Newasp.HtmlSetting(10))
			PageType = 3
			SQL1 = "And AllHits > " & CLng(Newasp.LeastHotHist)
			SQL2 = "And A.AllHits > " & CLng(Newasp.LeastHotHist) & " ORDER BY A.AllHits DESC, A.SoftTime DESC ,A.SoftID DESC"
			m_strCurrPageName = "hot"
		Else
			strClassName = Newasp.HtmlSetting(8)
			HtmlContent = Replace(HtmlContent, "{$PageTitle}", Newasp.HtmlSetting(8))
			PageType = 3
			SQL1 = vbNullString
			SQL2 = "ORDER BY A.isTop DESC, A.SoftTime DESC ,A.SoftID DESC"
			m_strCurrPageName = "new"
		End If
		
		'--ȡHTMLļ·
		If CreateHtml <> 0 And CInt(t) <> 2 Then
			HtmlFileName = Newasp.ReadDestination(Newasp.MoreDestination, Newasp.ChannelDir, "",m_strCurrPageName & "/",t,t,1,m_strCurrPageName)
			HtmlFilePath = Newasp.HtmlFilesPath
			Newasp.CreatPathEx (strBasicPath & HtmlFilePath)
		End If
		'---------------------------
		Call ReplaceString
		maxperpage = CLng(Newasp.HtmlSetting(1))
		If CLng(CurrentPage) = 0 Then CurrentPage = 1
		'¼
		
		TotalNumber = Newasp.Execute("SELECT COUNT(SoftID) FROM NC_SoftList WHERE ChannelID = " & ChannelID & " And isAccept > 0  " & SQL1 & "")(0)
		
		If TotalNumber >= CLng(Newasp.HtmlSetting(4)) Then TotalNumber = CLng(Newasp.HtmlSetting(4))
		TotalPageNum = CLng(TotalNumber / maxperpage)  'õҳ
		If TotalPageNum < TotalNumber / maxperpage Then TotalPageNum = TotalPageNum + 1
		If CurrentPage < 1 Then CurrentPage = 1
		If CurrentPage > TotalPageNum Then CurrentPage = TotalPageNum
		Set Rs = Server.CreateObject("ADODB.Recordset")

		SQL = "SELECT TOP " & CLng(Newasp.HtmlSetting(4)) & " A.softid,A.ClassID,A.ColorMode,A.FontMode,A.SoftName,A.SoftVer,A.[content],A.Related,A.SoftType,A.RunSystem,A.impower,A.SoftSize,A.star,A.SoftTime,A.username,A.IsTop,A.IsBest,A.AllHits,A.SoftImage,A.HtmlFileDate,A.isxmltext,A.xmlfilename,C.ClassName,C.HtmlFileDir,C.UseHtml FROM [NC_SoftList] A INNER JOIN [NC_Classify] C ON A.ClassID=C.ClassID where A.ChannelID=" & ChannelID & " And A.isAccept > 0  " & SQL2
		
		If isSqlDataBase = 1 Then
			Set Rs = Newasp.Execute(SQL)
		Else
			Rs.Open SQL, Conn, 1, 1
		End If
		
		If Rs.BOF And Rs.EOF Then
			'ûҵ,õıǩ
			HtmlContent = Replace(HtmlContent, "{$ReadListPage}", "ûҵκƼ" & Newasp.ModuleName & "")
			HtmlContent = Replace(HtmlContent, Newasp.CutFixContent(HtmlContent, "[ShowRepetend]", "[/ShowRepetend]", 1), "")
			'HTML,ִ
			If CreateHtml <> 0 And CInt(t) <> 2 Then
				Newasp.CreatedTextFile strBasicPath & HtmlFileName, HtmlContent
				If IsShowFlush = 1 Then
					Response.Write "<li style=""font-size: 12px;"">" & strClassName & "HTML... <a href=" & HtmlFileName & " target=_blank>" & Server.MapPath(HtmlFileName) & "</a></li>" & vbNewLine
					Response.Flush
				End If
			End If
		Else
			'ȡģǩ[ShowRepetend][/ReadSoftList]еַ
			TempListContent = Newasp.CutFixContent(HtmlContent, "[ShowRepetend]", "[/ShowRepetend]", 1)
			If CreateHtml <> 0 And CInt(t) <> 2 Then
				Call LoadBestSoftListHtml(t)
			Else
				Call LoadChildListAsp
			End If
		End If
		Rs.Close: Set Rs = Nothing
		If CreateHtml = 0 Or CInt(t) = 2 Then CreateBestDown = HtmlContent
	End Function
	'================================================
	'LoadBestSoftListHtml
	'  ãװбHTML
	'================================================
	Private Sub LoadBestSoftListHtml(t)
		Dim HtmlFileName, sulCurrentPage
		
		If IsNull(TempListContent) Then Exit Sub
		For CurrentPage = 1 To TotalPageNum
			Rs.MoveFirst
			i = 0
			If TotalPageNum > 1 Then Rs.Move (CurrentPage - 1) * maxperpage
			ListContent = ""
			j = (CurrentPage - 1) * maxperpage + 1
			Do While Not Rs.EOF And i < CInt(maxperpage)
				If Not Response.IsClientConnected Then Response.End
				Call LoadListDetail
				Rs.MoveNext
				i = i + 1
				j = j + 1
				If i >= maxperpage Then Exit Do
			Loop
			Dim strHtmlPage
			HtmlFileName  = Newasp.ReadDestination(Newasp.MoreDestination, Newasp.ChannelDir, "",m_strCurrPageName & "/",t,t,CurrentPage,m_strCurrPageName)
			strHtmlPage = showhtmlpage(CurrentPage, TotalPageNum, TotalNumber, maxperpage, Newasp.HtmlFilesName, strClassName)
			HtmlTemplate = HtmlContent
			HtmlTemplate = Replace(HtmlTemplate, TempListContent, ListContent)
			HtmlTemplate = Replace(HtmlTemplate, "{$ReadListPage}", strHtmlPage)
			HtmlTemplate = Replace(HtmlTemplate, "[ShowRepetend]", "")
			HtmlTemplate = Replace(HtmlTemplate, "[/ShowRepetend]", "")
			'ʼӷHTMLҳ
			Newasp.CreatedTextFile strBasicPath & HtmlFileName, HtmlTemplate
			If IsShowFlush = 1 Then Response.Write "<li style=""font-size: 12px;"">" & strClassName & "HTML... <a href=" & HtmlFileName & " target=_blank>" & Server.MapPath(HtmlFileName) & "</a></li>" & vbNewLine
			Response.Flush
		Next
	End Sub
	
	'#############################\\ִʼ//#############################
	'================================================
	'ShowHotDown
	'  ãʾ
	'================================================
	Public Sub ShowHotDown()
		If CreateHtml <> 0 Then
			Response.Redirect (ChannelRootDir & "index" & Newasp.HtmlExtName)
			Exit Sub
		Else
			Newasp.PreventInfuse
			If Not IsNumeric(Request("page")) And Len(Request("page")) <> 0 Then
				Response.Write ("ϵͳ!")
				Response.End
			End If
			If Not IsEmpty(Request("page")) And Len(Request("page")) <> 0 Then
				CurrentPage = CLng(Request("page"))
			Else
				CurrentPage = 1
			End If
			Response.Write CreateHotDown
		End If
	End Sub
	Public Function CreateHotDown()
		Dim HtmlFileName
		
		PageType = 4
		skinid = Newasp.ChkNumeric(Newasp.ChannelSkin)
		Newasp.LoadTemplates ChannelID, 6, skinid
		HtmlFilePath = ChannelRootDir & "special/"
		HtmlContent = Newasp.HtmlContent
		HtmlContent = Replace(HtmlContent, "{$ChannelRootDir}", ChannelRootDir)
		HtmlContent = Replace(HtmlContent, "{$InstallDir}", strInstallDir)
		HtmlContent = Replace(HtmlContent, "{$ChannelID}", ChannelID)
		HtmlContent = Replace(HtmlContent, "{$ModuleName}", Newasp.ModuleName)
		HtmlContent = Replace(HtmlContent, "{$SoftIndex}", strIndexName)
		HtmlContent = Replace(HtmlContent, "{$IndexTitle}", strIndexName)
		HtmlContent = Replace(HtmlContent, "{$PageTitle}", "")
		strClassName = ""
		Call ReplaceString
		maxperpage = CInt(Newasp.HtmlSetting(1))
		If CLng(CurrentPage) = 0 Then CurrentPage = 1
		'¼
		TotalNumber = Newasp.Execute("SELECT COUNT(SoftID) FROM NC_SoftList WHERE ChannelID = " & ChannelID & " And isAccept > 0 And AllHits > " & CLng(Newasp.LeastHotHist) & "")(0)
		If TotalNumber >= CLng(Newasp.HtmlSetting(4)) Then TotalNumber = CLng(Newasp.HtmlSetting(4))
		TotalPageNum = CLng(TotalNumber / maxperpage)  'õҳ
		If TotalPageNum < TotalNumber / maxperpage Then TotalPageNum = TotalPageNum + 1
		If CurrentPage < 1 Then CurrentPage = 1
		If CurrentPage > TotalPageNum Then CurrentPage = TotalPageNum
		Set Rs = CreateObject("ADODB.Recordset")
		SQL = "SELECT TOP " & CLng(Newasp.HtmlSetting(4)) & " A.SoftID,A.ClassID,A.ColorMode,A.FontMode,A.SoftName,A.SoftVer,A.[content],A.Related,A.SoftType,A.RunSystem,A.impower,A.SoftSize,A.star,A.SoftTime,A.username,A.IsTop,A.IsBest,A.AllHits,A.SoftImage,A.HtmlFileDate,A.isxmltext,A.xmlfilename,C.ClassName,C.HtmlFileDir,C.UseHtml FROM [NC_SoftList] A INNER JOIN [NC_Classify] C ON A.ClassID=C.ClassID WHERE A.ChannelID=" & ChannelID & " And A.isAccept > 0 And A.AllHits > " & CLng(Newasp.LeastHotHist) & " ORDER BY A.AllHits DESC, A.SoftTime DESC ,A.SoftID DESC"
		If isSqlDataBase = 1 Then
			Set Rs = Newasp.Execute(SQL)
		Else
			Rs.Open SQL, Conn, 1, 1
		End If
		
		If Rs.BOF And Rs.EOF Then
			'ûҵ,õıǩ
			HtmlContent = Replace(HtmlContent, "{$ReadListPage}", "ûҵκ" & Newasp.ModuleName & "")
			HtmlContent = Replace(HtmlContent, Newasp.CutFixContent(HtmlContent, "[ShowRepetend]", "[/ShowRepetend]", 1), "")
			'HTML,ִ
			If CreateHtml <> 0 Then
				HtmlFileName = HtmlFilePath & Newasp.HtmlPrefix & "Hot001" & Newasp.HtmlExtName
				Newasp.CreatedTextFile strBasicPath & HtmlFileName, HtmlContent
				If IsShowFlush = 1 Then 
					Response.Write "<li style=""font-size: 12px;"">" & strClassName & "HTML... <a href=" & HtmlFileName & " target=_blank>" & Server.MapPath(HtmlFileName) & "</a></li>" & vbNewLine
					Response.Flush
				End If
			End If
		Else
			'ȡģǩ[ShowRepetend][/ReadSoftList]еַ
			TempListContent = Newasp.CutFixContent(HtmlContent, "[ShowRepetend]", "[/ShowRepetend]", 1)
			If CreateHtml <> 0 Then
				Call LoadHotSoftListHtml
			Else
				Call LoadChildListAsp
			End If
		End If
		Rs.Close: Set Rs = Nothing
		If CreateHtml = 0 Then CreateHotDown = HtmlContent
	End Function
	'================================================
	'LoadHotSoftListHtml
	'  ãװбHTML
	'================================================
	Private Sub LoadHotSoftListHtml()
		Dim HtmlFileName, sulCurrentPage
		If IsNull(TempListContent) Then Exit Sub
		For CurrentPage = 1 To TotalPageNum
			Rs.MoveFirst
			i = 0
			If TotalPageNum > 1 Then Rs.Move (CurrentPage - 1) * maxperpage
			ListContent = ""
			j = (CurrentPage - 1) * maxperpage + 1
			Do While Not Rs.EOF And i < CInt(maxperpage)
				If Not Response.IsClientConnected Then Response.End
				Call LoadListDetail
				Rs.MoveNext
				i = i + 1
				j = j + 1
				If i >= maxperpage Then Exit Do
			Loop
			Dim strHtmlFront, strHtmlPage
			strHtmlFront = Newasp.HtmlPrefix & "Hot"
			strHtmlPage = htmlmorepage(CurrentPage, TotalPageNum, TotalNumber, maxperpage, strHtmlFront, Newasp.HtmlExtName, strClassName)
			HtmlTemplate = HtmlContent
			HtmlTemplate = Replace(HtmlTemplate, TempListContent, ListContent)
			HtmlTemplate = Replace(HtmlTemplate, "{$ReadListPage}", strHtmlPage)
			HtmlTemplate = Replace(HtmlTemplate, "[ShowRepetend]", "")
			HtmlTemplate = Replace(HtmlTemplate, "[/ShowRepetend]", "")
			'ʼӷHTMLҳ
			sulCurrentPage = Newasp.HtmlPrefix & "Hot" & Newasp.Supplemental(CurrentPage, 3)
			HtmlFileName = HtmlFilePath & sulCurrentPage & Newasp.HtmlExtName
			Newasp.CreatedTextFile strBasicPath & HtmlFileName, HtmlTemplate
			If IsShowFlush = 1 Then Response.Write "<li style=""font-size: 12px;"">" & strClassName & "HTML... <a href=" & HtmlFileName & " target=_blank>" & Server.MapPath(HtmlFileName) & "</a></li>" & vbNewLine
			Response.Flush
		Next
		Exit Sub
	End Sub
	'#############################\\ʼ//#############################
	Public Sub ShowDownSearch()
		Dim SearchMaxPageList
		Dim Action, findword
		Dim rsClass, strNoResult
		Dim strWord, s
		
		PageType = 5
		keyword = Newasp.ChkQueryStr(Trim(Request("keyword")))
		keyword = Newasp.CheckInfuse(keyword,255)
		strWord = Newasp.CheckStr(Trim(Request("word")))
		strWord = Newasp.CheckInfuse(strWord,10)
		s = Newasp.ChkNumeric(Request.QueryString("s"))
		
		If Newasp.CheckNull(strWord) Then
			strWord = UCase(Left(strWord, 6))
			keyword = strWord
		Else
			strWord = ""
		End If
		
		If keyword = "" And strWord = "" Then
			Call OutAlertScript("ҪѯĹؼ֣")
			Exit Sub
		End If
		If strWord = "" Then
			If Not Newasp.CheckQuery(keyword) Then
				Call OutAlertScript("ѯĹؼзǷַ\n뷵ؼֲѯ")
				Exit Sub
			End If
		End If
		
		skinid = Newasp.ChkNumeric(Newasp.ChannelSkin)
		On Error Resume Next
		Newasp.LoadTemplates ChannelID, 7, skinid
		If Newasp.HtmlSetting(4) <> "0" Then
			If IsNumeric(Newasp.HtmlSetting(4)) Then
				'If CInt(Newasp.HtmlSetting(4)) Mod CInt(Newasp.HtmlSetting(1)) = 0 Then
					'SearchMaxPageList = CLng(Newasp.HtmlSetting(4)) \ CInt(Newasp.HtmlSetting(1))
				'Else
					'SearchMaxPageList = CLng(Newasp.HtmlSetting(4)) \ CInt(Newasp.HtmlSetting(1)) + 1
				'End If
				SearchMaxPageList = CLng(Newasp.HtmlSetting(4))
			Else
				SearchMaxPageList = 50
			End If
		Else
			SearchMaxPageList = 50
		End If
		
		strNoResult = Replace(Newasp.HtmlSetting(8), "{$KeyWord}", keyword)
		Action = Newasp.CheckStr(Trim(Request("act")))
		Action = Newasp.CheckStr(Action)
		
		If strWord = "" And LCase(Action) <> "isweb" Then
			If Newasp.strLength(keyword) < CLng(Newasp.HtmlSetting(5)) Or Newasp.strLength(keyword) > CLng(Newasp.HtmlSetting(6)) Then
				Call OutAlertScript("ѯ\nѯĹؼֲС " & Newasp.HtmlSetting(5) & " ߴ " & Newasp.HtmlSetting(6) & " ֽڡ")
				Exit Sub
			End If
		End If
		
		
		If strWord = "" Then
			If LCase(Action) = "topic" Then
				findword = "A.SoftName like '%" & keyword & "%'"
			ElseIf LCase(Action) = "content" Then
				If CInt(Newasp.FullContQuery) <> 0 Then
					findword = "A.[content] like '%" & keyword & "%'"
				Else
					Call OutAlertScript(Replace(Replace(Newasp.HtmlSetting(10), Chr(34), "\"""), vbCrLf, ""))
					Exit Sub
				End If
			Else
				findword = "A.SoftName like '%" & keyword & "%'"
			End If
		Else
			findword = "A.AlphaIndex='" & strWord & "'"
		End If
		If LCase(Action) <> "isweb" Then
			If IsEmpty(Session("QueryLimited")) Then
				Session("QueryLimited") = keyword & "|" & Action & "|" & Now()
			Else
				Dim QueryLimited
				QueryLimited = Split(Session("QueryLimited"), "|")
				If UBound(QueryLimited) = 2 Then
					If CStr(Trim(QueryLimited(0))) = CStr(keyword) And CStr(Trim(QueryLimited(1))) = CStr(Action) Then
						Session("QueryLimited") = keyword & "|" & Action & "|" & Now()
					Else
						If DateDiff("s", QueryLimited(2), Now()) < CLng(Newasp.HtmlSetting(7)) Then
							Dim strLimited
							strLimited = Replace(Newasp.HtmlSetting(9), "{$TimeLimited}", Newasp.HtmlSetting(7))
							Call OutAlertScript(Replace(Replace(strLimited, Chr(34), "\"""), vbCrLf, ""))
							Exit Sub
						Else
							Session("QueryLimited") = keyword & "|" & Action & "|" & Now()
						End If
					End If
				Else
					Session("QueryLimited") = keyword & "|" & Action & "|" & Now()
				End If
			End If
		End If
		HtmlContent = Newasp.HtmlContent
		HtmlContent = Replace(HtmlContent, "{$ChannelRootDir}", ChannelRootDir)
		HtmlContent = Replace(HtmlContent, "{$InstallDir}", strInstallDir)
		HtmlContent = Replace(HtmlContent, "{$ChannelID}", ChannelID)
		HtmlContent = Replace(HtmlContent, "{$ModuleName}", Newasp.ModuleName)
		HtmlContent = Replace(HtmlContent, "{$SoftIndex}", strIndexName)
		HtmlContent = Replace(HtmlContent, "{$IndexTitle}", strIndexName)
		HtmlContent = Replace(HtmlContent, "{$KeyWord}", KeyWord)
		HtmlContent = Replace(HtmlContent, "{$PageTitle}", KeyWord)
		HtmlContent = Replace(HtmlContent, "{$QueryKeyWord}", "<font color=red><strong>" & keyword & "</strong></font>")
		Call ReplaceString
		If LCase(Action) <> "isweb" Then
			If IsNumeric(Request("classid")) And Request("classid") <> "" Then
				Set rsClass = Newasp.Execute("SELECT ClassID,ChildStr FROM [NC_Classify] WHERE ChannelID = " & ChannelID & " And ClassID=" & CLng(Request("classid")))
				If rsClass.BOF And rsClass.EOF Then
					HtmlContent = Replace(HtmlContent, "{$ReadListPage}", strNoResult, 1, 1, 1)
					HtmlContent = Replace(HtmlContent, "{$ReadListPage}", "")
					HtmlContent = Replace(HtmlContent, "{$totalrec}", 0)
					HtmlContent = Replace(HtmlContent, Newasp.CutFixContent(HtmlContent, "[ShowRepetend]", "[/ShowRepetend]", 1), "")
					Set rsClass = Nothing
					Response.Write HtmlContent
					Exit Sub
				Else
					findword = "A.ClassID IN (" & rsClass("ChildStr") & ") And " & findword
				End If
				rsClass.Close: Set rsClass = Nothing
			End If
			maxperpage = CInt(Newasp.HtmlSetting(1))
			If Not IsNumeric(Request("page")) And Len(Request("page")) <> 0 Then
				Response.Write ("ϵͳ!")
				Response.End
			End If
			If Not IsEmpty(Request("page")) And Len(Request("page")) <> 0 Then
				CurrentPage = CInt(Request("page"))
			Else
				CurrentPage = 1
			End If
			If CInt(CurrentPage) = 0 Then CurrentPage = 1
			
			Set Rs = CreateObject("ADODB.Recordset")
			SQL = "SELECT TOP " & SearchMaxPageList & " A.SoftID,A.ClassID,A.ColorMode,A.FontMode,A.SoftName,A.SoftVer,A.[content],A.Related,A.Languages,A.SoftType,A.RunSystem,A.impower,A.Contact,A.SoftSize,A.star,A.SoftTime,A.username,A.AllHits,A.HtmlFileDate,A.isxmltext,A.xmlfilename,C.ClassName,C.HtmlFileDir,C.UseHtml FROM [NC_SoftList] A INNER JOIN [NC_Classify] C On A.ClassID=C.ClassID where A.ChannelID=" & ChannelID & " And A.isAccept > 0 And " & findword & " ORDER BY A.SoftTime DESC ,A.SoftID DESC"
			Rs.Open SQL, Conn, 1, 1
			If Err Or (Rs.BOF And Rs.EOF) Then
				'ûҵ,õıǩ
				HtmlContent = Replace(HtmlContent, "{$ReadListPage}", strNoResult, 1, 1, 1)
				HtmlContent = Replace(HtmlContent, "{$ReadListPage}", "")
				HtmlContent = Replace(HtmlContent, "{$totalrec}", 0)
				HtmlContent = Replace(HtmlContent, Newasp.CutFixContent(HtmlContent, "[ShowRepetend]", "[/ShowRepetend]", 1), "")
			Else
				TotalNumber = Rs.RecordCount
				If (TotalNumber Mod maxperpage) = 0 Then
					TotalPageNum = TotalNumber \ maxperpage
				Else
					TotalPageNum = TotalNumber \ maxperpage + 1
				End If
				If CurrentPage > TotalPageNum Then CurrentPage = TotalPageNum
				If CurrentPage < 1 Then CurrentPage = 1
				HtmlContent = Replace(HtmlContent, "{$totalrec}", TotalNumber)
				'ȡģǩ[ShowRepetend][/ReadSoftList]еַ
				TempListContent = Newasp.CutFixContent(HtmlContent, "[ShowRepetend]", "[/ShowRepetend]", 1)
				Call LoadSearchList
			End If
			Rs.Close: Set Rs = Nothing
		Else
			HtmlContent = Replace(HtmlContent, "{$ReadListPage}", "")
			HtmlContent = Replace(HtmlContent, "{$totalrec}", 0)
			HtmlContent = Replace(HtmlContent, Newasp.CutFixContent(HtmlContent, "[ShowRepetend]", "[/ShowRepetend]", 1), "")
			If s = 1 Then
				Call isWeb_Query()
				Exit Sub
			End If
			Response.Write HtmlContent & SearchObj
			Exit Sub
		End If
		Response.Write HtmlContent
		Exit Sub
	End Sub
	'================================================
	'LoadSearchList
	'  ãװб
	'================================================
	Private Sub LoadSearchList()
		If IsNull(TempListContent) Then Exit Sub
		i = 0
		If TotalPageNum > 1 Then Rs.Move (CurrentPage - 1) * maxperpage
		ListContent = ""
		j = (CurrentPage - 1) * maxperpage + 1
		Do While Not Rs.EOF And i < CInt(maxperpage)
			If Not Response.IsClientConnected Then Response.End
			Call SearchResult
			Rs.MoveNext
			i = i + 1
			j = j + 1
			If i >= maxperpage Then Exit Do
		Loop
		Dim strPagination
		strPagination = ShowListPage(CurrentPage, TotalPageNum, TotalNumber, maxperpage, ASPCurrentPage(PageType), "")
		HtmlContent = Replace(HtmlContent, TempListContent, ListContent)
		HtmlContent = Replace(HtmlContent, "[ShowRepetend]", "")
		HtmlContent = Replace(HtmlContent, "[/ShowRepetend]", "")
		HtmlContent = Replace(HtmlContent, "{$ReadListPage}", strPagination)
	End Sub
	'================================================
	'SearchResult
	'  ãװбϸ
	'================================================
	Private Sub SearchResult()
		Dim sTitle, sTopic, softname, ListStyle, TitleWord
		Dim SoftUrl, SoftTime, sClassName, SoftImage, SoftVer
		
		ListContent = ListContent & TempListContent
		If (i Mod 2) = 0 Then
			ListStyle = 1
		Else
			ListStyle = 2
		End If
		TitleWord = Replace(Rs("SoftName"), "" & keyword & "", "<font color=""red"">" & keyword & "</font>")
		sTitle = Newasp.ReadFontMode(TitleWord, Rs("ColorMode"), Rs("FontMode")) & " " & Rs("SoftVer")
		
		If CInt(CreateHtml) <> 0 Then
			SoftUrl = Newasp.ReadDestination(Newasp.InfoDestination, Newasp.ChannelDir, Rs("HtmlFileDate"),Rs("HtmlFileDir"),Rs("ClassID"),Rs("softid"),1,"")
			sClassName = Newasp.ReadDestination(Newasp.SortDestination, Newasp.ChannelDir, Rs("HtmlFileDate"),Rs("HtmlFileDir"),Rs("ClassID"),Rs("softid"),1,"")
		Else
			If IsURLRewrite Then
				SoftUrl = ChannelRootDir & Rs("softid") & Newasp.HtmlExtName
				sClassName = ChannelRootDir & "list_1_" & Rs("ClassID") & Newasp.HtmlExtName
			Else
				SoftUrl = ChannelRootDir & "show.asp?id=" & Rs("softid")
				sClassName = ChannelRootDir & "list.asp?classid=" & Rs("ClassID")
			End If
		End If
		
		sClassName = "<a class=newclass href=""" & sClassName & """ target=""_blank""><span style=""color:" & Newasp.MainSetting(3) & """>" & Rs("ClassName") & "</span></a>"
		softname = "<a class=newsoft href=""" & SoftUrl & """" & LoadRemark(Trim(Rs("SoftName") & " " & Rs("SoftVer"))) & " target=""_blank"">" & sTitle & "</a>"
		'--XMLļ,ʹXMLļж------
		isxmltext = Newasp.ChkNumeric(Rs("isxmltext"))
		xmlfilename = Rs("xmlfilename") & ""
		If isxmltext = 1 Then
			xmlFilePath = m_strXMLPath & xmlfilename
			TextContent = Newasp.ReadXMLDocument(xmlFilePath,"softinfo/@content")
			If TextContent = "" Then TextContent = Rs("content") & ""
		Else
			TextContent = Rs("content")
		End If
		'---------------------------------------------
		SoftIntro = Newasp.CutString(TextContent, CInt(Newasp.HtmlSetting(3)))
		SoftIntro = Replace(SoftIntro, "" & keyword & "", "<font color=""red"">" & keyword & "</font>")
		
		SoftTime = Newasp.ShowDateTime(Rs("SoftTime"), CInt(Newasp.HtmlSetting(2)))
		ListContent = Replace(ListContent, "{$KeyWord}", keyword)
		ListContent = Replace(ListContent, "{$totalrec}", TotalNumber)
		ListContent = Replace(ListContent, "{$ClassifyName}", sClassName)
		ListContent = Replace(ListContent, "{$SoftUrl}", SoftUrl)
		ListContent = Replace(ListContent, "{$LinksUrl}", SoftUrl)
		ListContent = Replace(ListContent, "{$Star}", Rs("star"))
		ListContent = Replace(ListContent, "{$SoftHits}", Rs("AllHits"))
		ListContent = Replace(ListContent, "{$UserName}", Rs("username")&"")
		ListContent = Replace(ListContent, "{$SoftDateTime}", SoftTime)
		ListContent = Replace(ListContent, "{$ListStyle}", ListStyle)
		ListContent = Replace(ListContent, "{$SoftSize}", ReadSoftsize(Rs("SoftSize")))
		ListContent = Replace(ListContent, "{$RunSystem}", Rs("RunSystem")&"")
		ListContent = Replace(ListContent, "{$Impower}", Rs("impower")&"")
		ListContent = Replace(ListContent, "{$Language}", Rs("Languages")&"")
		ListContent = Replace(ListContent, "{$SoftType}", Rs("SoftType")&"")
		ListContent = Replace(ListContent, "{$SoftID}", Rs("SoftID"))
		ListContent = Replace(ListContent, "{$Order}", j)
		ListContent = Replace(ListContent, "{$SoftName}", softname)
		ListContent = Replace(ListContent, "{$SoftTopic}", sTitle)
		ListContent = Replace(ListContent, "{$SoftContent}", SoftIntro)
	End Sub
	'================================================
	'ReadSoftsize
	'  ãȡĴС
	'================================================
	Function ReadSoftsize(ByVal para)
		On Error Resume Next
		Dim parasize
		parasize = Clng(para)
	
		If parasize = 0 Then
			ReadSoftsize = "δ֪"
			Exit Function
		End If
		If parasize > 1024*1024+5200 Then
			ReadSoftsize = FormatRound(Round(parasize / (1024*1024), 2)) & " GB"
			Exit Function
		ElseIf parasize > 1024+5 Then
			ReadSoftsize = FormatRound(Round(parasize / 1024, 2)) & " MB"
			Exit Function
		Else
			ReadSoftsize = FormatRound(parasize) & " KB"
			Exit Function
		End If
		ReadSoftsize = "δ֪"
	End Function
	'================================================
	'ShowSoftComment
	'  ãʾ
	'================================================
	Public Sub ShowSoftComment()
		Dim softname, HtmlFileUrl, HtmlFileName
		Dim AverageGrade, TotalGrade, TotalComment, TempListContent
		Dim strComment, strCheckBox, strAdminComment, BackUrl
		Newasp.PreventInfuse
		strCheckBox = ""
		strAdminComment = ""
		On Error Resume Next
		
		softid = Newasp.ChkNumeric(Request("softid"))
		If softid = 0 Then
			Response.Write "<Br><Br><Br>Sorryϵͳ,ѡȷӷʽ"
			Response.End
		End If
		skinid = Newasp.ChkNumeric(Newasp.ChannelSkin)
		Newasp.LoadTemplates ChannelID, 8, skinid
		HtmlContent = Newasp.HtmlContent
		HtmlContent = Replace(HtmlContent, "{$ChannelRootDir}", ChannelRootDir)
		HtmlContent = Replace(HtmlContent, "{$InstallDir}", strInstallDir)
		HtmlContent = Replace(HtmlContent, "{$ChannelID}", ChannelID)
		HtmlContent = Replace(HtmlContent, "{$ModuleName}", Newasp.ModuleName)
		HtmlContent = Replace(HtmlContent, "{$SoftIndex}", strIndexName)
		HtmlContent = Replace(HtmlContent, "{$IndexTitle}", strIndexName)
		'HtmlContent = Replace(HtmlContent, "{$PageTitle}", Newasp.ModuleName & "")
		HtmlContent = Replace(HtmlContent, "{$SoftID}", softid)
		'
		SQL = "SELECT TOP 1 A.SoftID,A.ClassID,A.SoftName,A.SoftVer,A.HtmlFileDate,A.ForbidEssay,C.HtmlFileDir,C.UseHtml FROM [NC_SoftList] A INNER JOIN [NC_Classify] C ON A.ClassID=C.ClassID WHERE A.ChannelID=" & ChannelID & " And A.isAccept > 0 And A.softid=" & CLng(softid)
		Set Rs = Newasp.Execute(SQL)
		If Rs.EOF And Rs.BOF Then
			Response.Write "Ѿû"
			Set Rs = Nothing
			Exit Sub
		Else
			If CreateHtml <> 0 Then
				HtmlFileUrl = Newasp.ReadDestination(Newasp.InfoDestination, Newasp.ChannelDir, Rs("HtmlFileDate"),Rs("HtmlFileDir"),Rs("ClassID"),Rs("softid"),1,"")
				BackUrl = HtmlFileUrl
			Else
				If IsURLRewrite Then
					BackUrl = Rs("softid") & Newasp.HtmlExtName
				Else
					BackUrl = "show.asp?id=" & Rs("softid")
				End If
			End If
			softname = "<a href=""" & BackUrl & """>" & Trim(Rs("SoftName") & " " & Rs("SoftVer")) & "</a>"
			ForbidEssay = Rs("ForbidEssay")
			HtmlContent = Replace(HtmlContent, "{$PageTitle}", Trim(Rs("SoftName") & " " & Rs("SoftVer")) & " ")
			HtmlContent = Replace(HtmlContent, "{$BackUrl}", BackUrl)
			HtmlContent = Replace(HtmlContent, "{$ClassID}", Rs("ClassID"))
		End If
		Rs.Close
		Set Rs = Server.CreateObject("adodb.recordset")
		SQL = "SELECT COUNT(CommentID) As TotalComment, AVG(Grade) As avgGrade,SUM(Grade) As TotalGrade FROM NC_Comment WHERE ChannelID=" & ChannelID & " And postid = " & CLng(softid)
		Set Rs = Newasp.Execute(SQL)
		TotalComment = Rs("TotalComment")
		AverageGrade = Rs("avgGrade")
		TotalGrade = Rs("TotalGrade")
		If IsNull(AverageGrade) Then AverageGrade = 0
		If IsNull(TotalComment) Then TotalComment = 0
		If IsNull(TotalGrade) Then TotalGrade = 0
		AverageGrade = Round(AverageGrade)
		Rs.Close: Set Rs = Nothing
		HtmlContent = Replace(HtmlContent, "{$SoftName}", softname)
		HtmlContent = Replace(HtmlContent, "{$TotalComment}", TotalComment)
		HtmlContent = Replace(HtmlContent, "{$AverageGrade}", AverageGrade)
		HtmlContent = Replace(HtmlContent, "{$TotalGrade}", TotalGrade)
		If Not IsNumeric(Request("page")) And Len(Request("page")) <> 0 Then
			Response.Write ("ϵͳ!")
			Response.End
		End If
		If Not IsEmpty(Request("page")) And Len(Request("page")) <> 0 Then
			CurrentPage = CInt(Request("page"))
		Else
			CurrentPage = 1
		End If
		If CInt(CurrentPage) = 0 Then CurrentPage = 1
		'ÿҳʾ
		maxperpage = CInt(Newasp.PaginalNum)
		'¼
		TotalNumber = TotalComment
		TotalPageNum = CInt(TotalNumber / maxperpage)  'õҳ
		If TotalPageNum < TotalNumber / maxperpage Then TotalPageNum = TotalPageNum + 1
		If CurrentPage < 1 Then CurrentPage = 1
		If CurrentPage > TotalPageNum Then CurrentPage = TotalPageNum
		Set Rs = CreateObject("ADODB.Recordset")
		SQL = "SELECT * FROM NC_Comment WHERE ChannelID=" & ChannelID & " And postid=" & CLng(softid) & " ORDER BY postime DESC,CommentID DESC"
		If isSqlDataBase = 1 Then
			Set Rs = Newasp.Execute(SQL)
		Else
			Rs.Open SQL, Conn, 1, 1
		End If
		If Rs.BOF And Rs.EOF Then
			'ûҵ,õıǩ
			HtmlContent = Replace(HtmlContent, "{$ReadListPage}", "ʱ˲μ", 1, 1, 1)
			HtmlContent = Replace(HtmlContent, "{$ReadListPage}", "")
			HtmlContent = Replace(HtmlContent, Newasp.CutFixContent(HtmlContent, "[ShowRepetend]", "[/ShowRepetend]", 1), "")
		Else
			Rs.MoveFirst
			i = 0
			If TotalPageNum > 1 Then Rs.Move (CurrentPage - 1) * maxperpage
			ListContent = ""
			'ȡģǩ[ShowRepetend][/ReadArticleList]еַ
			TempListContent = Newasp.CutFixContent(HtmlContent, "[ShowRepetend]", "[/ShowRepetend]", 1)
			Do While Not Rs.EOF And i < CInt(maxperpage)
				If Not Response.IsClientConnected Then Response.End
				ListContent = ListContent & TempListContent
				strComment = Newasp.HTMLEncode(Rs("Content"))
				ListContent = Replace(ListContent, "{$CommentContent}", strComment)
				ListContent = Replace(ListContent, "{$UserName}", Newasp.HTMLEncode(Rs("username")))
				ListContent = Replace(ListContent, "{$CommentGrade}", Rs("Grade"))
				ListContent = Replace(ListContent, "{$PostTime}", Rs("postime"))
				ListContent = Replace(ListContent, "{$PostIP}", Rs("postip"))
				If Session("AdminName") <> "" Or Newasp.membergrade = "999" Then
					strCheckBox = "<input type='checkbox' name='selCommentID' value='" & Rs("CommentID") & "'>"
				End If
				ListContent = Replace(ListContent, "{$SelCheckBox}", strCheckBox)
				Rs.MoveNext
				i = i + 1
				If i >= maxperpage Then Exit Do
			Loop
		End If
		Rs.Close: Set Rs = Nothing
		HtmlContent = Replace(HtmlContent, TempListContent, ListContent)
		HtmlContent = Replace(HtmlContent, "[ShowRepetend]", "")
		HtmlContent = Replace(HtmlContent, "[/ShowRepetend]", "")
		If Session("AdminName") <> "" Or Newasp.membergrade = "999" Then
			strAdminComment = "<input class=Button type=button name=chkall value='ȫѡ' onClick=""CheckAll(this.form)""><input class=Button type=button name=chksel value='ѡ' onClick=""ContraSel(this.form)"">" & vbNewLine
			strAdminComment = strAdminComment & "<input type=hidden name=SoftID value='" & softid & "'>" & vbNewLine
			strAdminComment = strAdminComment & "<input type=hidden name=action value='del'>" & vbNewLine
			strAdminComment = strAdminComment & "<input class=Button type=submit name=Submit2 value='ɾѡе' onclick=""{if(confirm('ȷִиò?')){this.document.selform.submit();return true;}return false;}"">"
		End If
		HtmlContent = Replace(HtmlContent, "{$AdminComment}", strAdminComment)
		Call ShowCommentPage
		Call ReplaceString
		If Newasp.CheckStr(LCase(Request.Form("action"))) = "del" Then
			Call CommentDel
		End If
		If Newasp.CheckStr(LCase(Request.Form("action"))) = "save" Then
			Call CommentSave
		End If
		Response.Write HtmlContent
		Exit Sub
	End Sub
	'================================================
	'ShowCommentPage
	'  ã۷ҳ
	'================================================
	Private Sub ShowCommentPage()
		Dim FileName, ii, n, strTemp
		
		FileName = "comment.asp"
		If TotalNumber Mod maxperpage = 0 Then
			n = TotalNumber \ maxperpage
		Else
			n = TotalNumber \ maxperpage + 1
		End If
		strTemp = "<table cellspacing=1 width='100%' border=0><tr><td align=center> " & vbCrLf
		If CurrentPage < 2 Then
			strTemp = strTemp & "  <font COLOR=#FF0000>" & TotalNumber & "</font> &nbsp;&nbsp; ҳ&nbsp;&nbsp;һҳ&nbsp;&nbsp;&nbsp;"
		Else
			strTemp = strTemp & " <font COLOR=#FF0000>" & TotalNumber & "</font> &nbsp;&nbsp;<a href=" & FileName & "?page=1&SoftID=" & Request("SoftID") & "> ҳ</a>&nbsp;&nbsp;"
			strTemp = strTemp & "<a href=" & FileName & "?page=" & CurrentPage - 1 & "&SoftID=" & Request("SoftID") & ">һҳ</a>&nbsp;&nbsp;&nbsp;"
		End If

		If n - CurrentPage < 1 Then
			strTemp = strTemp & "һҳ&nbsp;&nbsp;β ҳ " & vbCrLf
		Else
			strTemp = strTemp & "<a href=" & FileName & "?page=" & (CurrentPage + 1) & "&SoftID=" & Request("SoftID") & ">һҳ</a>"
			strTemp = strTemp & "&nbsp;&nbsp;<a href=" & FileName & "?page=" & n & "&SoftID=" & Request("SoftID") & ">β ҳ</a>" & vbCrLf
		End If
		strTemp = strTemp & "&nbsp;ҳΣ<strong><font color=red>" & CurrentPage & "</font>/" & n & "</strong>ҳ "
		strTemp = strTemp & "&nbsp;<b>" & maxperpage & "</b>/ҳ " & vbCrLf
		strTemp = strTemp & "</td></tr></table>" & vbCrLf
		HtmlContent = Replace(HtmlContent, "{$ReadListPage}", strTemp)
	End Sub
	'================================================
	'CommentDel
	'  ãɾ
	'================================================
	Private Sub CommentDel()
		Dim selCommentID
		
		If Newasp.CheckPost = False Then
			Call OutAlertScript("ύݲϷ벻Ҫⲿύ")
			Exit Sub
		End If
		If Not IsEmpty(Request.Form("selCommentID")) Then
			selCommentID = Newasp.CheckStr(Request("selCommentID"))
			If Session("AdminName") <> "" Or Newasp.membergrade = "999" Then
				Newasp.Execute ("delete from NC_Comment where ChannelID=" & ChannelID & " And CommentID in (" & selCommentID & ")")
				Call OutHintScript("ɾɹ")
			Else
				Call OutAlertScript("Ƿûɾ۵Ȩޡ")
				Exit Sub
			End If
		End If
	End Sub
	'================================================
	'CommentSave
	'  ãӱ
	'================================================
	Public Sub CommentSave()
		If Newasp.CheckPost = False Then
			FoundErr = True
			Call OutAlertScript("ύݲϷ벻Ҫⲿύ")
			Exit Sub
		End If
		On Error Resume Next
		Call PreventRefresh
		If CInt(Newasp.AppearGrade) <> 0 And Session("AdminName") = "" Then
			If CInt(Newasp.AppearGrade) > CInt(Newasp.membergrade) Then
				FoundErr = True
				Call OutAlertScript("ûз۵ȨޣǻԱ½ٲۡ")
				Exit Sub
			End If
		End If
		If ForbidEssay <> 0 Then
			FoundErr = True
			Call OutAlertScript("" & Newasp.ModuleName & "ֹۣ")
			Exit Sub
		End If
		If Not Newasp.CodeIsTrue() Then
			Call OutAlertScript("֤Уʧܣ뷵ˢҳԡ")
			Session("GetCode") = ""
			Founderr = True
			Exit Sub
		End If
		Session("GetCode") = ""
		If Trim(Request.Form("UserName")) = "" Then
			FoundErr = True
			Call OutAlertScript("ûΪգ")
			Exit Sub
		End If
		If Len(Trim(Request.Form("UserName"))) > 15 Then
			FoundErr = True
			Call OutAlertScript("ûܴ15ַ")
			Exit Sub
		End If
		If Newasp.IsValidStr(Request.Form("UserName")) = False Then
			FoundErr = True
			Call OutAlertScript("ûзǷַ")
			Exit Sub
		End If
		If Newasp.strLength(Request.Form("content")) < Newasp.LeastString Then
			FoundErr = True
			Call OutAlertScript("ݲС" & Newasp.LeastString & "ַ")
			Exit Sub
		End If
		If Newasp.strLength(Request.Form("content")) > Newasp.MaxString Then
			FoundErr = True
			Call OutAlertScript("ݲܴ" & Newasp.MaxString & "ַ")
			Exit Sub
		End If
		If FoundErr = True Then Exit Sub
		softid = Newasp.ChkNumeric(Request.Form("SoftID"))
		Set Rs = CreateObject("ADODB.RecordSet")
		SQL = "SELECT * FROM NC_Comment WHERE (CommentID is null)"
		Rs.Open SQL, Conn, 1, 3
		Rs.AddNew
			Rs("ChannelID") = ChannelID
			Rs("postid") = softid
			Rs("UserName") = Newasp.ChkFormStr(Request.Form("UserName"))
			Rs("Grade") = Newasp.ChkNumeric(Request.Form("Grade"))
			Rs("content") = Server.HTMLEncode(Request.Form("content"))
			Rs("postime") = Now()
			Rs("postip") = Newasp.GetUserip
		Rs.Update
		Rs.Close: Set Rs = Nothing
		If CreateHtml <> 0 Then ReadSoftIntro (softid)
		Session("UserRefreshTime") = Now()
		Response.Redirect (Request.ServerVariables("HTTP_REFERER"))
		Exit Sub
	End Sub
	Public Sub PreventRefresh()
		Dim RefreshTime
		
		RefreshTime = 20
		If DateDiff("s", Session("UserRefreshTime"), Now()) < RefreshTime Then
			Response.Write "<meta http-equiv=""Content-Type"" content=""text/html; chaRset=gb2312"" /><meta http-equiv=""refresh"" content=""" & RefreshTime & """ /><br />ҳ˷ˢ»ƣ벻Ҫ" & RefreshTime & "ˢ±ҳ<BR>ڴҳ棬Ժ󡭡"
			FoundErr = True
			Response.End
		End If
	End Sub
	Public Function AutoPlusLinks(ByVal str)
		Dim re
		If Len(str) < 5 Then
			AutoPlusLinks = str
			Exit Function
		End If
		Set re = New RegExp
		re.IgnoreCase = True
		re.Global = True
		re.Pattern = "(^|[^<=""])(((http|https|ftp|rtsp|mms):(\/\/|\\\\))(([\w\/\\\+\-~`@:%])+\.)+([\w\/\\\.\=\?\+\-~`@\':!%#]|(&amp;)|&)+)"
		str = re.Replace(str,"$1<a target=""_blank"" href=""$2"">$2</a>")
		re.Pattern = "(^|[^\/\\\w\=])((www|bbs)\.(\w)+\.([\w\/\\\.\=\?\+\-~`@\'!%#]|(&amp;))+)"
		str = re.Replace(str,"$1<a target=""_blank"" href=""http://$2"">$2</a>")
		Set re = Nothing
		AutoPlusLinks = str
	End Function
	
End Class
%>