<% Class admin_MakeHtml	
	Private ishion
	Private Sub Class_Initialize()
		Set ishion = New Cls_Main
		Server.ScriptTimeout = 999999999
		Call ishion.LoadSetting
	End Sub
	Private Sub Class_Terminate()
		Set ishion = Nothing	
	End Sub
	Public Sub AspInit()
		Response.Write "<HTML>" & vbCrLf
		Response.Write "<HEAD>" & vbCrLf
		Response.Write "<TITLE>下载管理</TITLE>" & vbCrLf
		Response.Write "<META http-equiv=Content-Type content=""text/html; charset=gb2312"">" & vbCrLf
		Response.Write "<LINK href=""admin.css"" type=text/css rel=stylesheet>" & vbCrLf
		Response.Write "</HEAD>" & vbCrLf
		Response.Write "<BODY leftmargin=""3"" topmargin=""3"">" & vbCrLf
			
			If ishion.adminName = "" Then
				ishion.strMsg = "<li>非法操作：登录超时或你没有以管理员身份登录系统，<a href=""../admin_login.asp"" target=_top>点此进入管理员登录界面</a>。"
				Call ishion.SystemMsg
			ElseIf myPermission() = False Then
				ishion.strMsg = "<li>非法操作：你没有权限进行此项操作，请联系管理员！"
				Call ishion.SystemMsg
			Else
				Call Main
			End If
	
		Response.Write "</BODY>" & vbCrLf
		Response.Write "</HTML>" & vbCrLf
	
	End Sub
	Private Function myPermission()
		myPermission = False
		If ishion.checkPermission(ishion.adminName, "11") Then myPermission = True: Exit Function
	End Function
	Private Sub Main()
		Select Case Trim(Request("action"))
		Case "runMake"
			Call runMake
		Case Else
			Call makehtml
		End Select
	End Sub
	
	Private Sub makehtml()
		Dim i
		Response.Write "<table width=""100%""  border=""0"" cellpadding=""3"" cellspacing=""1"" bgcolor=""#FFFFFF"" class=""b1"">" & vbCrLf
		Response.Write "<form action=""?action=runMake"" method=""post"" name=""MakeHtml"">" & vbCrLf
		Response.Write "  <tr>" & vbCrLf
		Response.Write "    <td align=""center"" class=""tdbg2"">下载系统网站页面生成操作</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr>" & vbCrLf
		Response.Write "    <td class=""tdbg3"">　1、 " & vbCrLf
		Response.Write "      <input name=""makePage"" type=""checkbox"" id=""makePage"" value=""Down_Update"" checked> " & vbCrLf
		Response.Write "      下载分类统计数据更新及生成XML数据</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr>" & vbCrLf
		Response.Write "    <td class=""tdbg3"">　2、" & vbCrLf
		Response.Write "      <input name=""makePage"" type=""checkbox"" id=""makePage"" value=""Down_New"" checked> " & vbCrLf
		Response.Write "      生成下载最近更新页</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr>" & vbCrLf
		Response.Write "    <td class=""tdbg3"">　3、" & vbCrLf
		Response.Write "      <input name=""makePage"" type=""checkbox"" id=""makePage"" value=""Down_Top"" checked> " & vbCrLf
		Response.Write "      生成下载排行榜页</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr>" & vbCrLf
		Response.Write "    <td class=""tdbg3"">　4、" & vbCrLf
		Response.Write "      <input name=""makePage"" type=""checkbox"" id=""makePage"" value=""Down_Abc"" checked> " & vbCrLf
		Response.Write "      生成下载按字母排序页</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr>" & vbCrLf
		Response.Write "    <td class=""tdbg3"">　5、" & vbCrLf
		Response.Write "      <input name=""makePage"" type=""checkbox"" id=""makePage"" value=""Down_List"" checked> " & vbCrLf
		Response.Write "      生成下载列表页　　　　选项：" & vbCrLf
		Response.Write "        <input name=""Down_List_1"" type=""radio"" value=""1"" checked>只生成有更新过的分类 " & vbCrLf
		Response.Write "      <input type=""radio"" name=""Down_List_1"" value=""2"">生成所有分类列表页 </td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr>" & vbCrLf
		Response.Write "    <td class=""tdbg3"">　6、" & vbCrLf
		Response.Write "      <input name=""makePage"" type=""checkbox"" id=""makePage"" value=""Down_Info"" checked>" & vbCrLf
		Response.Write "      生成下载详细信息页　　选项：生成" & vbCrLf
		Response.Write "              <select name=""Down_day"" id=""Down_day""> " & vbCrLf
		For i = 1 To 7
			Response.Write ("<option value=""" & i & """>" & i & "天内更新</option>")
		Next
		Response.Write "                <option value=""0"" selected>全部</option>" & vbCrLf
		Response.Write "      </select> 的下载信息页</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr>" & vbCrLf
		Response.Write "    <td class=""tdbg3"">　7、" & vbCrLf
		Response.Write "      <input name=""makePage"" type=""checkbox"" id=""makePage"" value=""Down_Default"" checked>" & vbCrLf
		Response.Write "      生成下载首页</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr>" & vbCrLf
		Response.Write "    <td class=""tdbg3"">　8、" & vbCrLf
		Response.Write "      <input name=""makePage"" type=""checkbox"" id=""makePage"" value=""Down_Catalog""> " & vbCrLf
		Response.Write "      生成下载分类页</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr>" & vbCrLf
		Response.Write "    <td class=""tdbg2"">　9、" & vbCrLf
		Response.Write "      <input name=""makePage"" type=""checkbox"" id=""makePage"" value=""HtmlPage""> " & vbCrLf
		Response.Write "      生成自定义静态页</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr>" & vbCrLf
		Response.Write "    <td class=""tdbg3""><input type=""submit"" name=""Submit"" value="" 执行操作  ""></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "</form>" & vbCrLf
		Response.Write "</table>" & vbCrLf
		
		Response.Write "<table width=""100%""  border=""0"" cellpadding=""3"" cellspacing=""1"" bgcolor=""#FFFFFF"" class=""b1"">" & vbCrLf
		Response.Write "<form action=""?action=runMake"" method=""post"" name=""MakeHtml"">" & vbCrLf
		Response.Write "  <tr>" & vbCrLf
		Response.Write "    <td align=""center"" class=""tdbg2"">文章系统网站页面生成操作</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr>" & vbCrLf
		Response.Write "    <td class=""tdbg3"">　1、 " & vbCrLf
		Response.Write "      <input name=""makePage"" type=""checkbox"" id=""makePage"" value=""Cms_Update"" checked>" & vbCrLf
		Response.Write "      文章分类统计数据更新及生成XML数据 </td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr>" & vbCrLf
		Response.Write "    <td class=""tdbg3"">　2、" & vbCrLf
		Response.Write "      <input name=""makePage"" type=""checkbox"" id=""makePage"" value=""Cms_List"" checked> " & vbCrLf
		Response.Write "      生成文章列表页　　　　选项：" & vbCrLf
		Response.Write "        <input name=""Cms_List_1"" type=""radio"" value=""1"" checked>只生成有更新过的分类列表" & vbCrLf
		Response.Write "<input type=""radio"" name=""Cms_List_1"" value=""2"">生成所有分类列表页</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr>" & vbCrLf
		Response.Write "    <td class=""tdbg3"">　3、" & vbCrLf
		Response.Write "      <input name=""makePage"" type=""checkbox"" id=""makePage"" value=""Cms_Info"" checked> " & vbCrLf
		Response.Write "      生成文章详细信息页　　选项： 生成" & vbCrLf
		Response.Write "              <select name=""Cms_day"" id=""Cms_day""> " & vbCrLf
		For i = 1 To 7
			Response.Write ("<option value=""" & i & """>" & i & "天内更新</option>")
		Next
		Response.Write "                <option value=""0"">全部</option>" & vbCrLf
		Response.Write "              </select> 的文章信息页</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr>" & vbCrLf
		Response.Write "    <td class=""tdbg3"">　4、" & vbCrLf
		Response.Write "      <input name=""makePage"" type=""checkbox"" id=""makePage"" value=""Cms_Default"" checked>" & vbCrLf
		Response.Write "      生成文件首页</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr>" & vbCrLf
		Response.Write "    <td class=""tdbg3"">　5、" & vbCrLf
		Response.Write "      <input name=""makePage"" type=""checkbox"" id=""makePage"" value=""Cms_Catalog""> " & vbCrLf
		Response.Write "      生成文章分类页</td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "  <tr>" & vbCrLf
		Response.Write "    <td class=""tdbg3""><input type=""submit"" name=""Submit"" value="" 执行操作  ""></td>" & vbCrLf
		Response.Write "  </tr>" & vbCrLf
		Response.Write "</form>" & vbCrLf
		Response.Write "</table>" & vbCrLf
	
	End Sub
	Private Sub runMake()
		Dim i, arrMakePage, Step, MakePage
		If Trim(Request.Form("makePage")) = "" Then
			Response.Write ("请选择操作项目")
			Exit Sub
		End If
		
		If Trim(Request.Form("Step")) = "" Then
			Step = 0
		Else
			Step = Trim(Request.Form("Step"))
		End If
		'Response.Write(Request.Form("makePage"))
		Response.Write ("自动生成HTML 第" & Step + 1 & "步 ")
		arrMakePage = Split(Trim(Request.Form("makePage")), ",")
		'If Ubound(arrMakePage)= 0 then
			'MakePage = Trim(Request.Form("MakePage"))
		'Else
			If Int(Step) > UBound(arrMakePage) Then
				Exit Sub
			Else
				MakePage = Trim(arrMakePage(Int(Step)))
			End If
		'End If
		Response.Write (MakePage & "<br>")
		'Response.End
		Call callMakPage(MakePage)
		Response.Write ("<br>全部完成！")
	End Sub
	Private Sub callMakPage(Page)
		Select Case Page
			Case "Down_Update"
				Call run_Down_Update
			Case "Down_New"
				Call run_Down_New
			Case "Down_Top"
				Call run_Down_Top
			Case "Down_Abc"
				Call run_Down_Abc
			Case "Down_List"
				Call run_Down_List
			Case "Down_Info"
				Call run_Down_Info
			Case "Down_Default"
				Call run_Down_Default
			Case "Down_Catalog"
				Call run_Down_Catalog
			Case "HtmlPage"
				Call run_HtmlPage
			Case "Cms_Update"
				Call run_Cms_Update
			Case "Cms_List"
				Call run_Cms_List
			Case "Cms_Info"
				Call run_Cms_Info
			Case "Cms_Default"
				Call run_Cms_Default
			Case "Cms_Catalog"
				Call run_Cms_Catalog
			End Select
	End Sub
	
	Private Sub run_Down_Update()
		Dim run
		run = Make_Down_update()
		Call autoSubmit(0, 0, 0, 0)
	End Sub
	
	Private Sub run_Down_New()
		Dim arrNew, i, run
		arrNew = "全部软件," & ishion.Setting(143)
		'Response.Write(arrNew)
		arrNew = Split(arrNew, ",")
		For i = 0 To UBound(arrNew)
			'Response.Write(arrNew(i))
			'Response.end
			run = Make_Down_New(i, arrNew(i))
		Next
		Call autoSubmit(0, 0, 0, 0)
	End Sub
	
	Private Sub run_Down_Top()
		Dim arrTop1, arrTop2, i, run
		arrTop1 = "HitsTotal,HitsMonth,HitsWeek,HitsToday"
		arrTop2 = "全部下载排行榜,本月下载排行榜,本周下载排行榜,本日下载排行榜"
		arrTop1 = Split(arrTop1, ",")
		arrTop2 = Split(arrTop2, ",")
		For i = 0 To UBound(arrTop1)
			run = Make_Down_Top(i + 1, arrTop1(i), arrTop2(i))
		Next
		Call autoSubmit(0, 0, 0, 0)
	End Sub
	
	Private Sub run_Down_Abc()
		Dim i
		For i = 0 To UBound(Split(ishion.Setting(78), ","))
		Response.Write (Make_Down_Abc(Split(ishion.Setting(78), ",")(i)) & "　")
		If (i + 1) Mod 4 = 0 Then
			Response.Write ("<br>")
		End If
		Response.Flush
		Next
		For i = 0 To UBound(Split(ishion.Setting(79), ","))
		Response.Write (Make_Down_Abc(Split(ishion.Setting(79), ",")(i)) & "　")
		If (i + 1) Mod 4 = 0 Then
			Response.Write ("<br>")
		End If
		Response.Flush
		Next
		Call autoSubmit(0, 0, 0, 0)
	End Sub
	
	Private Sub run_Down_List()
		Dim Rs, i, run, sql
		If CLng(Request.Form("Down_List_1")) = 1 Then
			Set Rs = ishion.Execute("select rootID,catalogID,catalogName,depth,Child,orders,resNum from ishion_Down_Catalog where isUpdate=1")
		Else
			Set Rs = ishion.Execute("select rootID,catalogID,catalogName,depth,Child,orders,resNum from ishion_Down_Catalog")
		End If
		If Not(Rs.eof and Rs.bof) then
			sql = Rs.GetRows(-1)
			'rootID,catalogID,catalogName,depth,Child,orders,resNum
			For i = 0 To UBound(sql, 2)
				'Response.Write(SQL(0,i))
				run = Make_Down_List(sql(0, i), sql(1, i), sql(2, i), sql(3, i), sql(4, i), sql(5, i), sql(6, i))
				Response.Write (run)
				If (i + 1) Mod 6 = 0 Then
					Response.Write ("<br>")
				End If
				Response.Flush
			Next
		End If
		Set Rs = Nothing
		ishion.Execute ("Update ishion_Down_Catalog set isUpdate = 0")
		Call autoSubmit(0, 0, 0, 0)
	End Sub
	
	Private Sub run_Down_Info()
		Dim i, nextDownID, Rs, sql, arrDownID
		If CLng(Request.Form("Down_day")) = 0 Then
			If Trim(Request.Form("nextDownID")) = "" Or CLng(Request.Form("nextDownID")) = 0 Then
				Set Rs = ishion.Execute("select top 1 ID from ishion_Down_Resource order by ID asc")
				
				If Rs.eof and Rs.Bof then
					Set Rs = nothing
					Exit Sub
				Else
					nextDownID = Rs(0)
				End If
				Set Rs = Nothing
			Else
			   
				nextDownID = CLng(Request.Form("nextDownID"))
			End If
			For i = nextDownID To (nextDownID + 2000)   '500
				Response.Write (Make_Down_Info(i))
				Response.Flush
			Next
			If Session("countDownRes") = "" Or IsNull(Session("countDownRes")) Then
				If ishion.F469e80d32(1) = "1" Then
				Set Rs = ishion.Execute("select top 1 id from ishion_Down_Resource order by ID Desc")
				If Rs.eof and Rs.Bof then
					Set Rs = nothing
					Exit Sub
				Else
					Session("countDownRes") = Rs(0)
				End If
				Set Rs = Nothing
				Else
					Session("countDownRes") = 23000
				End If
			End If
			If CLng(i) > CLng(Session("countDownRes")) Then
				Response.Write "完成！"
				Call autoSubmit(0, 0, 0, 0)
				Exit Sub
			End If
			Call autoSubmit(i, 0, 0, 0)
		Else
			'调用arrDownID
			If Trim(Request.Form("arrDownID")) = "" Or CLng(Request.Form("arrDownID")) = 0 Then
				If SqlNowString = "GetDate()" Then
					Set Rs = ishion.Execute("select id from ishion_Down_Resource where datediff('d',UpdateTime,getdate())<" & CLng(Request("Down_day")) & "")
				Else
			'Response.Write datediff("d","2006-7-29 16:47:51",Now())
			'response.end
					Set Rs = ishion.Execute("select id from ishion_Down_Resource where datediff('d',UpdateTime,Now())<" & CLng(Request("Down_day")) & "")
				End If
				If Rs.EOF And Rs.BOF Then
					Set Rs = Nothing
					Call autoSubmit(0, 0, 0, 0)
					Response.Write ("没有找到今天的更新记录！")
					Exit Sub
				End If
				sql = Rs.GetRows(-1)
				For i = 0 To UBound(sql, 2)
					If i = 0 Then
						arrDownID = sql(0, i)
					Else
						arrDownID = arrDownID & "," & sql(0, i)
					End If
				Next
			Else
				arrDownID = Trim(Request.Form("arrDownID"))
			End If
			'开始MakeHtml
			If Trim(Request.Form("nextDownID")) = "" Or CLng(Request.Form("nextDownID")) = 0 Then
				nextDownID = 0
			Else
				nextDownID = CLng(Request.Form("nextDownID"))
			End If
			'Response.Write(arrDownID)
			'Response.end
			For i = nextDownID To (nextDownID + 2000)     '500
				If i > UBound(Split(arrDownID, ",")) Then
					Response.Write ("完成！")
					Call autoSubmit(0, 0, 0, 0)
					Exit Sub
				End If
				Response.Write (Make_Down_Info(Split(arrDownID, ",")(i)))
				Response.Flush
			Next
			Call autoSubmit(i, arrDownID, 0, 0)
	
		End If
	End Sub
	Private Sub run_Down_Default()
		Dim run
		run = Make_Down_Default()
		Response.Write ("生成下载首页-OK!")
		Call autoSubmit(0, 0, 0, 0)
	End Sub
	
	Private Sub run_Down_Catalog()
		Dim run
		Response.Write (Make_Down_Catalog())
		Call autoSubmit(0, 0, 0, 0)
	End Sub
	
	Private Sub run_Cms_Update()
		Dim run
		run = Make_Cms_update()
		Call autoSubmit(0, 0, 0, 0)
	End Sub
	
	Private Sub run_Cms_List()
		Dim Rs, sql, i, run
		If CLng(Request.Form("Cms_List_1")) = 1 Then
			Set Rs = ishion.Execute("select rootID,catalogID,catalogName,depth,Child,orders,resNum from ishion_Cms_Catalog where isUpdate = 1")
		Else
			Set Rs = ishion.Execute("select rootID,catalogID,catalogName,depth,Child,orders,resNum from ishion_Cms_Catalog")
		End If
		If Not(Rs.eof and Rs.bof) then
			sql = Rs.GetRows(-1)
			'rootID,catalogID,catalogName,depth,Child,orders,resNum
			For i = 0 To UBound(sql, 2)
				'Response.Write(SQL(0,i))
				run = Make_Cms_List(sql(0, i), sql(1, i), sql(2, i), sql(3, i), sql(4, i), sql(5, i), sql(6, i))
				Response.Write (run)
				If (i + 1) Mod 6 = 0 Then
					Response.Write ("<br>")
				End If
			Next
		End IF
		Set Rs = Nothing
		ishion.Execute ("Update ishion_Cms_Catalog set isUpdate = 0")
		Call autoSubmit(0, 0, 0, 0)
	End Sub
	
	Private Sub run_Cms_Info()
		Dim i, nextCmsID, Rs, sql, arrCmsID
		If CLng(Request.Form("Cms_day")) = 0 Then
			If Trim(Request.Form("nextCmsID")) = "" Or CLng(Request.Form("nextCmsID")) = 0 Then
				Set Rs = ishion.Execute("select top 1 id from ishion_Cms_Resource order by ID asc")
				If Rs.eof and Rs.Bof then
					Set Rs = nothing
					Exit Sub
				Else
					nextCmsID = Rs(0)
				End If
				Set Rs = Nothing
				
			Else
				nextCmsID = CLng(Request.Form("nextCmsID"))
			End If
			For i = nextCmsID To (nextCmsID + 2000)   '500
				Response.Write (Make_Cms_Info(i))
				Response.Flush
			Next
			If Session("countCmsRes") = "" Or IsNull(Session("countCmsRes")) Then
				If ishion.F469e80d32(1) = "1" Then
					Set Rs = ishion.Execute("select top 1 id from ishion_Cms_Resource order by ID Desc")
					If Rs.eof and Rs.Bof then
						Set Rs = nothing
						Exit Sub
					Else
						Session("countCmsRes") = Rs(0)
					End If
					Set Rs = Nothing
				Else
					Session("countCmsRes") = 20000
				End If
			End If
			If i > Session("countCmsRes") Then
				Response.Write "完成！"
				Call autoSubmit(0, 0, 0, 0)
				Exit Sub
			End If
			Call autoSubmit(0, 0, i, 0)
		Else
			'调用arrCmsID
			If Trim(Request.Form("arrCmsID")) = "" Or CLng(Request.Form("arrCmsID")) = 0 Then
				If SqlNowString = "GetDate()" Then
					Set Rs = ishion.Execute("select id from ishion_Cms_Resource where datediff(d,DateAndTime,getdate())<" & CLng(Request("Cms_day")) & "")
				Else
					Set Rs = ishion.Execute("select id from ishion_Cms_Resource where datediff('d',DateAndTime,Now())<" & CLng(Request("Cms_day")) & "")

				End If
				If Rs.EOF And Rs.BOF Then
					Set Rs = Nothing
					Response.Write ("没有找到今天的更新记录！")
					Call autoSubmit(0, 0, 0, 0)
					Exit Sub
				End If
				sql = Rs.GetRows(-1)
				For i = 0 To UBound(sql, 2)
					If i = 0 Then
						arrCmsID = sql(0, i)
					Else
						arrCmsID = arrCmsID & "," & sql(0, i)
					End If
				Next
			Else
				arrCmsID = Trim(Request.Form("arrCmsID"))
			End If
			'开始MakeHtml
			If Trim(Request.Form("nextCmsID")) = "" Or CLng(Request.Form("nextCmsID")) = 0 Then
				nextCmsID = 0
			Else
				nextCmsID = CLng(Request.Form("nextCmsID"))
			End If
			'Response.Write(arrCmsID)
			'Response.end
			For i = nextCmsID To (nextCmsID + 2000)     '500
				If i > UBound(Split(arrCmsID, ",")) Then
					Response.Write ("完成！")
					Call autoSubmit(0, 0, 0, 0)
					Exit Sub
				End If
				Response.Write (Make_Cms_Info(Split(arrCmsID, ",")(i)))
				Response.Flush
			Next
			Call autoSubmit(0, 0, i, arrCmsID)
	
		End If
	End Sub
	
	Private Sub run_Cms_Default()
		Dim run
		run = Make_Cms_Default()
		Response.Write ("生成下载首页-OK!")
		Call autoSubmit(0, 0, 0, 0)
	End Sub
	
	Private Sub run_Cms_Catalog()
		Dim run
		Response.Write (Make_Cms_Catalog())
		Call autoSubmit(0, 0, 0, 0)
	End Sub
	Private Sub run_HtmlPage()
		Dim RS,SQL,i
		Dim fso, fout
		'response.write "sccess"
		'response.end
		Set Rs = ishion.Execute("select id,title,content,filename from ishion_HtmlPage")
		if Rs.Eof and Rs.Bof then
			Call autoSubmit(0, 0, 0, 0)
			Exit sub
		Else
			Set fso = Server.CreateObject(ishion.Setting(23))
			sql = Rs.GetRows(-1)			
			For i = 0 To UBound(sql, 2)
				tempStr = sql(2,i)
				tempStr = regExp_showDownRes(tempStr)
				tempStr = regExp_showDownResImages(tempStr)
				tempStr = regExp_showDownResStat(tempStr)				
				tempStr = Replace(regExp_AdvshowDownRes(tempStr), "../", "")
				tempStr = regExp_showCmsRes(tempStr)
				tempStr = regExp_showCmsResImages(tempStr)
				tempStr = regExp_showCmsResStat(tempStr)
				tempStr = regExp_showCmsResExcerptImages(tempStr)
				tempStr = Replace(regExp_AdvshowCmsRes(tempStr), "../", "")			
				Set fout = fso.CreateTextFile(Server.MapPath(MyDbPath &  sql(3,i)))
				fout.WriteLine ishion.HtmlHead() & tempStr
				fout.Close
				Response.Write sql(0,i) & "、" & sql(1,i) & "<br>"
				Response.Flush
			Next			
		End if
		Set fout = Nothing
		Set Rs = nothing
		Call autoSubmit(0, 0, 0, 0)
	End Sub
	Private Sub autoSubmit(nextDownID, arrDownID, nextCmsID, arrCmsID)
		If (nextDownID = 0 And nextCmsID = 0) Then
			If UBound(Split(Trim(Request.Form("makePage")), ",")) = 0 Then
				Exit Sub
			End If
		End If
		Dim Step
		If Trim(Request.Form("Step")) = "" Then
			If nextDownID = 0 And nextCmsID = 0 Then
				Step = 1
			Else
				Step = 0
			End If
		Else
			If nextDownID = 0 And nextCmsID = 0 Then
				Step = CLng(Request.Form("Step")) + 1
			Else
				Step = CLng(Request.Form("Step"))
			End If
		End If
	
		Response.Write "<form name=""form1"" method=""post"" action=""?action=runMake"">" & vbCrLf
		Response.Write "<input name=""makePage"" type=""hidden"" value=""" & Trim(Request.Form("makePage")) & """>" & vbCrLf
		Response.Write "<input name=""Down_List_1"" type=""hidden"" value=""" & Trim(Request.Form("Down_List_1")) & """>" & vbCrLf
		Response.Write "<input name=""Down_day"" type=""hidden"" value=""" & Trim(Request.Form("Down_day")) & """>" & vbCrLf
		Response.Write "<input name=""Cms_List_1"" type=""hidden"" value=""" & Trim(Request.Form("Cms_List_1")) & """>" & vbCrLf
		Response.Write "<input name=""Cms_day"" type=""hidden"" value=""" & Trim(Request.Form("Cms_day")) & """>" & vbCrLf
		
		Response.Write "<input name=""Step"" type=""hidden"" value=""" & Step & """>" & vbCrLf
		
		Response.Write "<input type=""hidden"" name=""arrDownID"" value=""" & arrDownID & """>" & vbCrLf
		Response.Write "<input type=""hidden"" name=""nextDownID"" value=""" & nextDownID & """>" & vbCrLf
		
		Response.Write "<input type=""hidden"" name=""arrCmsID"" value=""" & arrCmsID & """>" & vbCrLf
		Response.Write "<input type=""hidden"" name=""nextCmsID"" value=""" & nextCmsID & """>" & vbCrLf
		'Response.Write "<input type=""submit"" name=""Submit"" value=""下一步"">" & vbCrlf
		Response.Write "</form>" & vbCrLf
		Response.Write ("<SCRIPT language=javascript>" & vbNewLine)
		Response.Write ("document.form1.submit();" & vbNewLine)
		Response.Write ("</SCRIPT>")
	
	End Sub
	Rem *************************************************下载首页****************************************************
	Public Function Make_Down_Default()
		Dim arrMainPage, tempStr
		arrMainPage = Split(ishion.ReadStylePage("Style_Down_Main"), "<!--|||-->")
		tempStr = arrMainPage(0) & arrMainPage(1) & arrMainPage(2) & arrMainPage(3) & arrMainPage(4) & arrMainPage(5)
		tempStr = regExp_showDownRes(tempStr)
		tempStr = regExp_showDownResImages(tempStr)
		tempStr = regExp_showDownResStat(tempStr)
		tempStr = regExp_showNews(tempStr)
		tempStr = regExp_showSiteLinks(tempStr)
		tempStr = Replace(regExp_AdvshowDownRes(tempStr), "../", "")
		
		tempStr = regExp_showCmsRes(tempStr)
		tempStr = regExp_showCmsResImages(tempStr)
		tempStr = regExp_showCmsResExcerptImages(tempStr)
		tempStr = regExp_showCmsResStat(tempStr)
		tempStr = Replace(regExp_AdvshowCmsRes(tempStr), "../", "")
		
		tempStr = Replace(tempStr, "{$page_title}", ishion.Setting(0) & " — 下载首页")
		Dim fso, fout
		Set fso = Server.CreateObject(ishion.Setting(23))
		Set fout = fso.CreateTextFile(Server.MapPath(MyDbPath & ishion.Setting(70)))
		If ishion.F469e80d32(1) = "1" Then
			fout.WriteLine ishion.HtmlHead() & tempStr
		Else
			fout.WriteLine ishion.HtmlHead() & tempStr & ishion.CopyRight
		End If
	
		fout.Close: Set fout = Nothing
		Set fso = Nothing
		tempStr = Null
		arrMainPage = Null
	End Function
	
	Rem *************************************************文章首页****************************************************
	Public Function Make_Cms_Default()
		Dim arrMainPage, tempStr
		arrMainPage = Split(ishion.ReadStylePage("Style_Cms_Main"), "<!--|||-->")
		tempStr = arrMainPage(0) & arrMainPage(1) & arrMainPage(2) & arrMainPage(3) & arrMainPage(4)
		tempStr = regExp_showCmsRes(tempStr)
		tempStr = regExp_showCmsResImages(tempStr)
		tempStr = regExp_showCmsResExcerptImages(tempStr)
		tempStr = regExp_showCmsResStat(tempStr)
		tempStr = regExp_showNews(tempStr)
		tempStr = regExp_showSiteLinks(tempStr)
		tempStr = Replace(regExp_AdvshowCmsRes(tempStr), "../", "")
		tempStr = regExp_showDownRes(tempStr)
		tempStr = regExp_showDownResImages(tempStr)
		tempStr = regExp_showDownResStat(tempStr)
		tempStr = Replace(regExp_AdvshowDownRes(tempStr), "../", "")
		
		tempStr = Replace(tempStr, "{$page_title}", ishion.Setting(0) & " — 文章首页")
		Dim fso, fout
		Set fso = Server.CreateObject(ishion.Setting(23))
		Set fout = fso.CreateTextFile(Server.MapPath(MyDbPath & ishion.Setting(95)))
		
		If ishion.F469e80d32(1) = "1" Then
			fout.WriteLine ishion.HtmlHead() & tempStr
		Else
			fout.WriteLine ishion.HtmlHead() & tempStr & ishion.CopyRight
		End If
		
		fout.Close: Set fout = Nothing
		Set fso = Nothing
		tempStr = Null
		arrMainPage = Null
	End Function
	
	Rem ***************************************更新CMS分类数据生成分类XML********************************************
	Public Function Make_Cms_update()
		Dim Rs, sql, i, ResNum, xmlSQL, xmlFile
		Set Rs = ishion.Execute("select rootID,catalogID,catalogName,depth,Child,orders,resNum from ishion_Cms_Catalog")
		sql = Rs.GetRows(-1)
		Set Rs = Nothing
		
		For i = 0 To UBound(sql, 2)
			If sql(3, i) = 0 Then
				ResNum = ishion.Execute("select Count(*) from ishion_Cms_Resource where rootID=" & sql(0, i))(0)
				xmlSQL = "rootID=" & sql(0, i)
				xmlFile = "xml/rss_Cms_r" & sql(0, i) & ".xml"
			Else
				If sql(4, i) > 0 Then
					ResNum = ishion.Execute("select Count(*) from ishion_Cms_Resource where catalogID in (select catalogID from ishion_Cms_Catalog where rootID=" & sql(0, i) & " and depth>" & sql(3, i) & " and orders>" & sql(5, i) & ")")(0)
					xmlSQL = "catalogID in (select catalogID from ishion_Cms_Catalog where rootID=" & sql(0, i) & " and depth>" & sql(3, i) & " and orders>" & sql(5, i) & ")"
				Else
					ResNum = ishion.Execute("select Count(*) from ishion_Cms_Resource where catalogID=" & sql(1, i))(0)
					xmlSQL = "catalogID=" & sql(1, i)
				End If
				xmlFile = "xml/rss_Cms_s" & sql(1, i) & ".xml"
			End If
			ishion.Execute ("update ishion_Cms_Catalog set ResNum = " & ResNum & "  where catalogID=" & sql(1, i))
			Rs = Make_Cms_XML(xmlSQL, xmlFile, sql(2, i))
			Response.Write (sql(2, i) & "-OK!　")
			If i Mod 7 = 0 Then Response.Write ("<br>")
			Response.Flush
		Next
		Rs = Make_Cms_XML("", "xml/rss_Cms.xml", "全部文章更新")
	End Function
	Public Function Make_Cms_XML(xmlSQL, xmlFile, catalogName)
		Dim Rs, s
		s = s & "<?xml version=""1.0"" encoding=""gb2312""?>" & vbCrLf
		s = s & "<rss version=""2.0"">" & vbCrLf
		s = s & "<channel>" & vbCrLf
		s = s & "       <title>" & ishion.Setting(0) & " - " & catalogName & "</title>" & vbCrLf
		s = s & "       <link>" & ishion.Setting(2) & "</link>" & vbCrLf
		s = s & "       <description>" & catalogName & "</description>" & vbCrLf
		s = s & "       <language>zh-cn</language>" & vbCrLf
		s = s & "       <generator>Www.ishion.Cn</generator>" & vbCrLf
		s = s & "       <copyright>Copyright 2001-2004 www.ishion.cn, All Rights Reserved</copyright>" & vbCrLf
		s = s & "       <pubDate>" & Now() & "</pubDate>" & vbCrLf
		If xmlSQL = "" Then
		Set Rs = ishion.Execute("select top 50 ID,rootID,catalogID,catalogName,title,content,DateAndTime,Writer from ishion_Cms_Resource where isAuditing=1 order by DateAndTime Desc")
		Else
		Set Rs = ishion.Execute("select top 50 ID,rootID,catalogID,catalogName,title,content,DateAndTime,Writer from ishion_Cms_Resource where " & xmlSQL & " and isAuditing=1 order by DateAndTime Desc")
		End If
		If Not (Rs.EOF And Rs.BOF) Then
			Do While Not Rs.EOF
			s = s & "       <item>" & vbCrLf
			s = s & "           <title>[" & Rs(3) & "]" & Rs(4) & "</title>" & vbCrLf
			s = s & "           <link>" & ishion.Setting(2) & "/" & Replace(ishion.Setting(77), "{$id}", Rs(0)) & "</link>" & vbCrLf
			s = s & "           <author>" & Rs(7) & "</author>" & vbCrLf
			s = s & "           <guid></guid>" & vbCrLf
			s = s & "           <category>" & Rs(3) & "</category>" & vbCrLf
			s = s & "           <pubDate>" & Rs(6) & "</pubDate>" & vbCrLf
			s = s & "           <comments></comments>" & vbCrLf
			s = s & "           <description>" & Server.HTMLEncode(Rs(5)) & "</description>" & vbCrLf
			s = s & "       </item>" & vbCrLf
			Rs.MoveNext
			Loop
		Else
			s = s & "<item></item>" & vbCrLf
		End If
		Set Rs = Nothing
		s = s & "</channel>" & vbCrLf
		s = s & "</rss>" & vbCrLf
		Dim fso, fout
		Set fso = Server.CreateObject(ishion.Setting(23))
		Set fout = fso.CreateTextFile(Server.MapPath(MyDbPath & xmlFile))
		fout.WriteLine s
		fout.Close: Set fout = Nothing
		Set fso = Nothing
		s = Null
	End Function
	
	Rem ***************************************更新分类数据生成分类XML********************************************
	Public Function Make_Down_update()
	
		Dim Rs, sql, i, ResNum, xmlSQL, xmlFile
		Set Rs = ishion.Execute("select rootID,catalogID,catalogName,depth,Child,orders,resNum from ishion_Down_Catalog")
		sql = Rs.GetRows(-1)
		Set Rs = Nothing
		
		For i = 0 To UBound(sql, 2)
			If sql(3, i) = 0 Then
				ResNum = ishion.Execute("select Count(*) from ishion_Down_Resource where rootID=" & sql(0, i))(0)
				xmlSQL = "rootID=" & sql(0, i)
				xmlFile = "xml/rss_Down_r" & sql(0, i) & ".xml"
			Else
				If sql(4, i) > 0 Then
					ResNum = ishion.Execute("select Count(*) from ishion_Down_Resource where catalogID in (select catalogID from ishion_Down_Catalog where rootID=" & sql(0, i) & " and depth>" & sql(3, i) & " and orders>" & sql(5, i) & ")")(0)
					xmlSQL = "catalogID in (select catalogID from ishion_Down_Catalog where rootID=" & sql(0, i) & " and depth>" & sql(3, i) & " and orders>" & sql(5, i) & ")"
				Else
					ResNum = ishion.Execute("select Count(*) from ishion_Down_Resource where catalogID=" & sql(1, i))(0)
					xmlSQL = "catalogID=" & sql(1, i)
				End If
				xmlFile = "xml/rss_Down_s" & sql(1, i) & ".xml"
			End If
			ishion.Execute ("update ishion_Down_Catalog set ResNum = " & ResNum & "  where catalogID=" & sql(1, i))
			Rs = Make_Down_XML(xmlSQL, xmlFile, sql(2, i))
			Response.Write (sql(2, i) & "-OK!　")
			If i Mod 7 = 0 Then Response.Write ("<br>")
			Response.Flush
		Next
		Rs = Make_Down_XML("", "xml/rss_Down.xml", "全部软件更新")
	End Function
	
	Public Function Make_Down_XML(xmlSQL, xmlFile, catalogName)
	
		Dim Rs, s
		s = s & "<?xml version=""1.0"" encoding=""gb2312""?>" & vbCrLf
		s = s & "<rss version=""2.0"">" & vbCrLf
		s = s & "<channel>" & vbCrLf
		s = s & "       <title>" & ishion.Setting(0) & " - " & catalogName & "</title>" & vbCrLf
		s = s & "       <link>" & ishion.Setting(2) & "</link>" & vbCrLf
		s = s & "       <description>" & catalogName & "</description>" & vbCrLf
		s = s & "       <language>zh-cn</language>" & vbCrLf
		s = s & "       <generator>Www.Ishion.net</generator>" & vbCrLf
		s = s & "       <copyright>Copyright 2005-2006 www.ishion.net, All Rights Reserved</copyright>" & vbCrLf
		s = s & "       <pubDate>" & Now() & "</pubDate>" & vbCrLf
		If xmlSQL = "" Then
		Set Rs = ishion.Execute("select top 50 ID,rootID,catalogID,catalogName,ResName,ResVer,content,UpdateTime,authorEmail from ishion_Down_Resource where isAuditing=1 order by UpdateTime Desc")
		Else
		Set Rs = ishion.Execute("select top 50 ID,rootID,catalogID,catalogName,ResName,ResVer,content,UpdateTime,authorEmail from ishion_Down_Resource where " & xmlSQL & " and isAuditing=1 order by UpdateTime Desc")
		End If
		If Not (Rs.EOF And Rs.BOF) Then
			Do While Not Rs.EOF
			s = s & "       <item>" & vbCrLf
			s = s & "           <title>[" & Rs(3) & "]" & Rs(4) & " " & Rs(5) & "</title>" & vbCrLf
			s = s & "           <link>" & ishion.Setting(2) & "/" & Replace(ishion.Setting(77), "{$id}", Rs(0)) & "</link>" & vbCrLf
			s = s & "           <author>" & Rs(8) & "</author>" & vbCrLf
			s = s & "           <guid></guid>" & vbCrLf
			s = s & "           <category>" & Rs(3) & "</category>" & vbCrLf
			s = s & "           <pubDate>" & Rs(7) & "</pubDate>" & vbCrLf
			s = s & "           <comments></comments>" & vbCrLf
			s = s & "           <description>" & Server.HTMLEncode(Rs(6)) & "</description>" & vbCrLf
			s = s & "       </item>" & vbCrLf
			Rs.MoveNext
			Loop
		Else
			s = s & "<item></item>" & vbCrLf
		End If
		Set Rs = Nothing
		s = s & "</channel>" & vbCrLf
		s = s & "</rss>" & vbCrLf
		Dim fso, fout
		Set fso = Server.CreateObject(ishion.Setting(23))
			
		TestFilePath=Server.MapPath(MyDbPath & split(xmlFile,"/")(0))
		If Not FSO.FolderExists(TestFilePath) Then
			Set TestFolder = FSO.CreateFolder(TestFilePath)
		End If

		Set fout = fso.CreateTextFile(Server.MapPath(MyDbPath & xmlFile))
		fout.WriteLine s
		fout.Close: Set fout = Nothing
		Set fso = Nothing
		s = Null
	End Function
	
	Rem ***************************************更新分类数据生成分类XML********************************************
	Public Function Make_Down_Catalog()
	
		Dim arrPage, arrMainPage, tempStr
		arrPage = Split(ishion.ReadStylePage("Style_Down_Catalog"), "<!--|||-->")
		arrMainPage = Split(ishion.ReadStylePage("Style_Down_Main"), "<!--|||-->")
		tempStr = Replace(arrMainPage(0), "{$page_title}", ishion.Setting(0) & " — 下载分类") & arrMainPage(1) & arrMainPage(2)
		tempStr = tempStr & Replace(arrPage(0), "{$site_nav}", ishion.site_nav(0, "ishion_Down_catalog", "下载分类", ""))
		tempStr = tempStr & Replace(arrPage(1), "{$showcatalog}", ishion.showDownResCatalog()) & arrMainPage(4) & arrMainPage(5)
		
		Dim fso, fout
		Set fso = Server.CreateObject(ishion.Setting(23))
		Set fout = fso.CreateTextFile(Server.MapPath(MyDbPath & ishion.Setting(71)))
		fout.WriteLine ishion.HtmlHead() & Replace(tempStr, "../", "")
		fout.Close: Set fout = Nothing
		tempStr = Null
		
		tempStr = "document.write(""<select name=\""catalog\"" id=\""catalog\"">"");"
		tempStr = tempStr & "document.write(""" & ishion.HTMLToJS(ishion.GetCatalogSelect(0,"ishion_Down_Catalog")) & """);"
		tempStr = tempStr & "document.write(""</select>"");"
		Set fout = fso.CreateTextFile(Server.MapPath(MyDbPath & "js/down_select_catalog.js"))
		fout.WriteLine tempStr
		fout.Close: Set fout = Nothing
		Set fso = Nothing
		tempStr = Null
		Make_Down_Catalog = "生成下载分类网页-OK!"
	End Function
	Rem ***************************************更新分类数据生成分类XML********************************************
	Public Function Make_Cms_Catalog()
	
		Dim arrPage, arrMainPage, tempStr
		arrPage = Split(ishion.ReadStylePage("Style_Cms_Catalog"), "<!--|||-->")
		arrMainPage = Split(ishion.ReadStylePage("Style_Cms_Main"), "<!--|||-->")
		tempStr = Replace(arrMainPage(0), "{$page_title}", ishion.Setting(0) & " — 文章分类") & arrMainPage(1) & arrMainPage(2)
		tempStr = tempStr & Replace(arrPage(0), "{$site_nav}", ishion.site_nav(0, "ishion_Cms_catalog", "文章分类", ""))
		tempStr = tempStr & Replace(arrPage(1), "{$showcatalog}", ishion.showCmsResCatalog()) & arrMainPage(4)
		
		Dim fso, fout
		Set fso = Server.CreateObject(ishion.Setting(23))
		Set fout = fso.CreateTextFile(Server.MapPath(MyDbPath & ishion.Setting(96)))
		fout.WriteLine ishion.HtmlHead() & Replace(tempStr, "../", "")
		fout.Close: Set fout = Nothing
		tempStr = Null
		
		tempStr = "document.write(""<select name=\""catalog\"" id=\""catalog\"">"");"
		tempStr = tempStr & "document.write(""" & ishion.HTMLToJS(ishion.GetCatalogSelect(0,"ishion_Cms_Catalog")) & """);"
		tempStr = tempStr & "document.write(""</select>"");"
		Set fout = fso.CreateTextFile(Server.MapPath(MyDbPath & "js/cms_select_catalog.js"))
		fout.WriteLine tempStr
		fout.Close: Set fout = Nothing
		Set fso = Nothing
		tempStr = Null
		Make_Cms_Catalog = "生成下载分类网页-OK!"
	End Function
	Rem *********************************************按首字排序页*************************************************
	Public Function Make_Down_Abc(s)
	
		Dim arrPage, arrMainPage, str, tempStr, Rs, i
		arrPage = Split(ishion.ReadStylePage("Style_Down_abc"), "<!--|||-->")
		arrMainPage = Split(ishion.ReadStylePage("Style_Down_Main"), "<!--|||-->")
		
		tempStr = Replace(arrMainPage(0), "{$page_title}", ishion.Setting(0) & " — 资源索引 — " & s) & arrMainPage(1) & arrMainPage(2) & arrMainPage(4) & arrPage(0) '页头
		
		Set Rs = ishion.Execute("select ID,rootID,catalogID,catalogName,ResName,ResVer,UpdateTime,ResRank,HitsTotal,ResSize,isHot,isTop,isBest from ishion_Down_Resource where IndexKeys='" & s & "' and isAuditing=1 order by ResName")
		If Rs.EOF And Rs.BOF Then
			tempStr = tempStr & arrPage(2)
			Set Rs = Nothing
		Else
			Dim sql
			sql = Rs.GetRows(-1)
			Set Rs = Nothing
			For i = 0 To UBound(sql, 2)
				str = arrPage(1)
				If sql(11, i) Then
					str = Replace(str, "{$dot_images}", "<img src=""../images/isTop.gif"" align=""absmiddle"">")
				ElseIf sql(10, i) Then
					str = Replace(str, "{$dot_images}", "<img src=""../images/isHot.gif"" align=""absmiddle"">")
				ElseIf sql(12, i) Then
					str = Replace(str, "{$dot_images}", "<img src=""../images/isBest.gif"" align=""absmiddle"">")
				Else
					str = Replace(str, "{$dot_images}", "<img src=""../images/isList.gif"" align=""absmiddle"">")
				End If
				str = Replace(str, "{$catalogurl}", "../" & Replace(Replace(ishion.Setting(73), "{$id}", sql(2, i)), "{$pages}", "1"))
				str = Replace(str, "{$catalogname}", sql(3, i))
				str = Replace(str, "{$softurl}", Replace(ishion.Setting(77), "{$id}", sql(0, i)))
				str = Replace(str, "{$softname}", sql(4, i))
				str = Replace(str, "{$softver}", sql(5, i))
				str = Replace(str, "{$updatetime}", ishion.FormatMyDate(sql(6, i), "{Y}-{m}-{d}"))
				str = Replace(str, "{$softrank}", sql(7, i))
				str = Replace(str, "{$hitstotal}", sql(8, i))
				If sql(9, i) > 1024 Then
					str = Replace(str, "{$softsize}", Round(sql(9, i) / 1024, 2) & " MB")
				Else
					str = Replace(str, "{$softsize}", sql(9, i) & " KB")
				End If
				tempStr = tempStr & str
			Next
			sql = Null
		End If
		Set Rs = Nothing
		tempStr = tempStr & arrPage(3) & arrMainPage(5)
		
		Dim fso, fout
		Set fso = Server.CreateObject(ishion.Setting(23))
		
		TestFilePath=Server.MapPath(MyDbPath & split(ishion.Setting(74),"/")(0))
		If Not FSO.FolderExists(TestFilePath) Then
			Set TestFolder = FSO.CreateFolder(TestFilePath)
		End If

		Set fout = fso.CreateTextFile(Server.MapPath(MyDbPath & Replace(ishion.Setting(74), "{$s}", s)))
		fout.WriteLine ishion.HtmlHead() & tempStr
		fout.Close: Set fout = Nothing
		Set fso = Nothing
		tempStr = Null
		Make_Down_Abc = "生成资源索引页" & s & "-OK!"
	End Function
	Rem *********************************************下载排行榜页*************************************************
	Public Function Make_Down_Top(sID, topC, topN)
	
		Dim arrPage, arrMainPage, sFileName, sXml, x, selectType, strSQL
		Dim arrTop1, arrTop2
		arrTop1 = "HitsTotal,HitsMonth,HitsWeek,HitsToday"
		arrTop2 = "全部下载排行榜,本月下载排行榜,本周下载排行榜,本日下载排行榜"
		arrTop1 = Split(arrTop1, ",")
		arrTop2 = Split(arrTop2, ",")
		For x = 0 To UBound(arrTop1)
			If x = 0 Then
				selectType = selectType & "<a href=""../" & Replace(Replace(ishion.Setting(76), "{$s}", x + 1), "{$pages}", "1") & """>" & arrTop2(x) & "</a>"
			Else
				selectType = selectType & " | <a href=""../" & Replace(Replace(ishion.Setting(76), "{$s}", x + 1), "{$pages}", "1") & """>" & arrTop2(x) & "</a>"
			End If
		Next
		arrPage = Split(ishion.ReadStylePage("Style_Down_Top"), "<!--|||-->")
		arrMainPage = Split(ishion.ReadStylePage("Style_Down_Main"), "<!--|||-->")
		
		Dim Rs, showPageRs, sql, i, sColumn, currentPage, Pages, tempStr, s, n
		Dim fso, fout	
		
		Set showPageRs = New cls_ishion_showPage
		
		If ishion.Setting(86) Mod ishion.Setting(87) = 0 Then
			Pages = CLng(ishion.Setting(86) / ishion.Setting(87) * -1) * -1
		Else
			Pages = CLng(ishion.Setting(86) / ishion.Setting(87) * -1) * -1 + 1
		End If
		
		For currentPage = 1 To Pages
			If IsSqlDataBase = 1 Then
				showPageRs.DbType = "MSSQL"
			Else
				showPageRs.DbType = "AC"
			End If
			sColumn = "ID,rootID,catalogID,catalogName,ResName,ResVer,UpdateTime,ResRank," & topC & ",ResSize,isHot,isTop,isBest,excerpt"
			showPageRs.RecType = 3
			showPageRs.RecSql = ishion.Setting(87)
			showPageRs.RecTerm = 2
			showPageRs.CookieName = "View_New_reslist" & sID
			showPageRs.Order = 1
			showPageRs.PageSize = Int(ishion.Setting(87))
			showPageRs.currentPage = Int(currentPage)
			showPageRs.sql = sColumn & "$ishion_Down_Resource$isAuditing=1$" & topC & " desc$" & topC & ""
			Dim iRecCount, sqlRs
			iRecCount = showPageRs.RecCount()
			
			sFileName = "../" & Replace(ishion.Setting(76), "{$s}", sID)
			tempStr = Replace(arrMainPage(0), "{$page_title}", ishion.Setting(0) & " — " & topN) & arrMainPage(1) & arrMainPage(2)
			tempStr = tempStr & Replace(Replace(arrPage(0), "{$site_nav}", ishion.site_nav(0, "ishion_Down_catalog", topN, "")), "{$select_toptype}", selectType)
			tempStr = tempStr & Replace(Replace(arrPage(1), "{$strsql}", strSQL), "{$showpage}", showPageRs.showPage(sFileName))
			tempStr = regExp_showDownRes(tempStr)
			
			If iRecCount < 1 Then
			
				s = "<tr> <td colspan=""5"">Sorry！没有找到任何记录。</td></tr>"
				tempStr = tempStr & s
				s = Null
			Else
				Set sqlRs = showPageRs.ResultSet()  '返回ResultSet
				Rs = sqlRs.GetRows(Int(ishion.Setting(87)))
				For i = 0 To UBound(Rs, 2)
					s = arrPage(2)
					If currentPage = 1 Then
						n = " 第" & i + 1 & "名 "
					Else
						n = " 第" & ((currentPage - 1) * Int(ishion.Setting(87)) + i + 1) & "名 "
					End If
					If Rs(11, i) Then
						s = Replace(s, "{$dot_images}", "<img src=""../images/isTop.gif"" align=""absmiddle"">" & n)
					ElseIf Rs(10, i) Then
						s = Replace(s, "{$dot_images}", "<img src=""../images/isHot.gif"" align=""absmiddle"">" & n)
					ElseIf Rs(12, i) Then
						s = Replace(s, "{$dot_images}", "<img src=""../images/isBest.gif"" align=""absmiddle"">" & n)
					Else
						s = Replace(s, "{$dot_images}", "<img src=""../images/isList.gif"" align=""absmiddle"">" & n)
					End If
	
					s = Replace(s, "{$catalogurl}", "../" & Replace(Replace(ishion.Setting(73), "{$id}", Rs(2, i)), "{$pages}", "1"))
					s = Replace(s, "{$catalogname}", Rs(3, i))
					s = Replace(s, "{$softurl}", Replace(ishion.Setting(77), "{$id}", Rs(0, i)))
					s = Replace(s, "{$softname}", Rs(4, i))
					s = Replace(s, "{$softver}", Rs(5, i))
					s = Replace(s, "{$updatetime}", ishion.FormatMyDate(Rs(6, i), "{Y}-{m}-{d}"))
					s = Replace(s, "{$softrank}", Rs(7, i))
					s = Replace(s, "{$hitstotal}", Rs(8, i))
					If Rs(9, i) > 1024 Then
						s = Replace(s, "{$softsize}", Round(Rs(9, i) / 1024, 2) & " MB")
					Else
						s = Replace(s, "{$softsize}", Rs(9, i) & " KB")
					End If
					s = Replace(s, "{$excerpt}", Rs(13, i))
					tempStr = tempStr & s
					s = Null
				Next
				Rs = Null
				Set sqlRs = Nothing
			End If			
			i = Null
			s = Null
			tempStr = tempStr & Replace(arrPage(3), "{$showpage}", showPageRs.showPage(sFileName)) & arrMainPage(5)
			
			Set fso = Server.CreateObject(ishion.Setting(23))
			
			TestFilePath=Server.MapPath(MyDbPath & split(ishion.Setting(76),"/")(0))
			If Not FSO.FolderExists(TestFilePath) Then
				Set TestFolder = FSO.CreateFolder(TestFilePath)
			End If
			
			Set fout = fso.CreateTextFile(Server.MapPath(MyDbPath & Replace(Replace(ishion.Setting(76), "{$s}", sID), "{$pages}", currentPage)))
			fout.WriteLine ishion.HtmlHead() & tempStr
			fout.Close: Set fout = Nothing
			Set fso = Nothing
			tempStr = Null
		Next
		Response.Write (topN & " HTML页生成-OK!<br>")
		Response.Flush
		Set showPageRs = Nothing
	End Function
	Rem *********************************************下载最近页*************************************************
	Public Function Make_Down_New(sID, stype)
	
		Dim arrPage, arrMainPage, sFileName, sXml, strSQL, x, selectType
		
		arrPage = Split(ishion.ReadStylePage("Style_Down_New"), "<!--|||-->")
		arrMainPage = Split(ishion.ReadStylePage("Style_Down_Main"), "<!--|||-->")
		
		selectType = selectType & "<select name=""select"" onChange='javascript:window.open(this.options[this.selectedIndex].value,""_top"")'>" & vbCrLf
		selectType = selectType & "<option value=""../" & Replace(Replace(ishion.Setting(75), "{$s}", "0"), "{$pages}", "1") & """>全部软件</option> " & vbCrLf
		For x = 1 To UBound(Split(ishion.Setting(143), ",")) + 1
			selectType = selectType & "<option value=""../" & Replace(Replace(ishion.Setting(75), "{$s}", x), "{$pages}", "1") & """ "
			If x = sID Then
				selectType = selectType & "selected"
			End If
			selectType = selectType & ">" & Split(ishion.Setting(143), ",")(x - 1) & "</option>" & vbCrLf
		Next
		selectType = selectType & "</select>" & vbCrLf
		
		If sID = 0 Then
			strSQL = "isAuditing=1"
		Else
			
			strSQL = " ResType = '" & stype & "' and isAuditing=1"
		End If
		
		Dim Rs, showPageRs, sql, i, sColumn, currentPage, Pages, tempStr, s
		Dim fso, fout		
		
		Set showPageRs = New cls_ishion_showPage
		
		If ishion.Setting(84) Mod ishion.Setting(83) = 0 Then
			Pages = CLng(ishion.Setting(84) / ishion.Setting(85) * -1) * -1
		Else
			Pages = CLng(ishion.Setting(84) / ishion.Setting(85) * -1) * -1 + 1
		End If
		
		For currentPage = 1 To Pages
		
			If IsSqlDataBase = 1 Then
				showPageRs.DbType = "MSSQL"
			Else
				showPageRs.DbType = "AC"
			End If
			sColumn = "ID,rootID,catalogID,catalogName,ResName,ResVer,UpdateTime,ResRank,HitsTotal,ResSize,isHot,isTop,isBest,excerpt"
			showPageRs.RecType = 3
			showPageRs.RecSql = ishion.Setting(84)
			showPageRs.RecTerm = 2
			showPageRs.CookieName = "View_Down_New" & sID
			showPageRs.Order = 1
			showPageRs.PageSize = Int(ishion.Setting(85))
			showPageRs.currentPage = Int(currentPage)
			showPageRs.sql = sColumn & "$ishion_Down_Resource$" & strSQL & "$UpdateTime Desc$UpdateTime"
	
			Dim iRecCount, sqlRs
			iRecCount = showPageRs.RecCount()			
			
			sFileName = "../" & Replace(ishion.Setting(75), "{$s}", sID)
			tempStr = Replace(arrMainPage(0), "{$page_title}", ishion.Setting(0) & " - 最近更新 - " & stype) & arrMainPage(1) & arrMainPage(2)
			tempStr = tempStr & Replace(Replace(arrPage(0), "{$site_nav}", ishion.site_nav(0, "ishion_Down_catalog", stype & " 最近更新", "")), "{$select_toptype}", selectType)
			tempStr = tempStr & Replace(Replace(arrPage(1), "{$strsql}", strSQL), "{$showpage}", showPageRs.showPage(sFileName))
			tempStr = regExp_showDownRes(tempStr)
			'Response.Write iRecCount
			If iRecCount < 1 Then
				s = "<tr> <td colspan=""5"">Sorry！没有找到任何记录。</td></tr>"
				tempStr = tempStr & s
				s = Null
			Else
				Set sqlRs = showPageRs.ResultSet()
				Rs = sqlRs.GetRows(Int(ishion.Setting(85)))
				For i = 0 To UBound(Rs, 2)
					s = arrPage(2)
					If Rs(11, i) Then
						s = Replace(s, "{$dot_images}", "<img src=""../images/isTop.gif"" align=""absmiddle"">")
					ElseIf Rs(10, i) Then
						s = Replace(s, "{$dot_images}", "<img src=""../images/isHot.gif"" align=""absmiddle"">")
					ElseIf Rs(12, i) Then
						s = Replace(s, "{$dot_images}", "<img src=""../images/isBest.gif"" align=""absmiddle"">")
					Else
						s = Replace(s, "{$dot_images}", "<img src=""../images/isList.gif"" align=""absmiddle"">")
					End If
					s = Replace(s, "{$catalogurl}", "../" & Replace(Replace(ishion.Setting(73), "{$id}", Rs(2, i)), "{$pages}", "1"))
					s = Replace(s, "{$catalogname}", Rs(3, i))
					s = Replace(s, "{$softurl}", Replace(ishion.Setting(77), "{$id}", Rs(0, i)))
					s = Replace(s, "{$softname}", Rs(4, i))
					s = Replace(s, "{$softver}", Rs(5, i))
					s = Replace(s, "{$updatetime}", ishion.FormatMyDate(Rs(6, i), "{Y}-{m}-{d}"))
					s = Replace(s, "{$softrank}", Rs(7, i))
					s = Replace(s, "{$hitstotal}", Rs(8, i))
					If Rs(9, i) > 1024 Then
						s = Replace(s, "{$softsize}", Round(Rs(9, i) / 1024, 2) & " MB")
					Else
						s = Replace(s, "{$softsize}", Rs(9, i) & " KB")
					End If
					s = Replace(s, "{$excerpt}", Rs(13, i))
					tempStr = tempStr & s
					s = Null
				Next
				Rs = Null
				Set sqlRs = Nothing
			End If			
	
			tempStr = tempStr & Replace(arrPage(3), "{$showpage}", showPageRs.showPage(sFileName)) & arrMainPage(5)
			
			
			Set fso = Server.CreateObject(ishion.Setting(23))
			
			TestFilePath=Server.MapPath(MyDbPath & split(ishion.Setting(75),"/")(0))
			If Not FSO.FolderExists(TestFilePath) Then
				Set TestFolder = FSO.CreateFolder(TestFilePath)
			End If
			
			Set fout = fso.CreateTextFile(Server.MapPath(MyDbPath & Replace(Replace(ishion.Setting(75), "{$s}", sID), "{$pages}", currentPage)))
			fout.WriteLine ishion.HtmlHead() & tempStr
			fout.Close: Set fout = Nothing
			Set fso = Nothing
			tempStr = Null
		Next
		Response.Write (stype & " 最新更新HTML页生成-OK!<br>")
		Response.Flush
		Set showPageRs = Nothing
	End Function
	
	Rem *********************************************下载列表页*************************************************
	Public Function Make_Down_List(rootID, catalogID, catalogName, depth, child, orders, ResNum)
	
		Dim arrPage, arrMainPage, Rs, strSQL, sFileName, sXml
		If depth = 0 Then
			strSQL = "rootID=" & rootID
			'q = " & " & strSQL
			sFileName = Replace(ishion.Setting(72), "{$id}", rootID)
			sXml = "xml/rss_Down_r" & rootID & ".xml"
		Else
			strSQL = "catalogID=" & catalogID
			'q = " & " & strSQL
			If child > 0 Then
				strSQL = "catalogID in (select catalogID from ishion_Down_Catalog where rootID=" & rootID & " and depth>" & depth & " and orders>" & orders & ")"
			End If
			sFileName = Replace(ishion.Setting(73), "{$id}", catalogID)
			sXml = "xml/rss_Down_r" & catalogID & ".xml"
		End If
		
		Dim showPageRs, sql, i, sColumn, currentPage, Pages, tempStr, s
		Dim fso, fout
		
		arrPage = Split(ishion.ReadStylePage("Style_Down_List"), "<!--|||-->")
		arrMainPage = Split(ishion.ReadStylePage("Style_Down_Main"), "<!--|||-->")
		'currentPage = 1
		'Response.Write ResNum
		If Int(ResNum) < 1 Then  '没有记录时
			Pages = 1
			tempStr = Replace(arrMainPage(0), "{$page_title}", ishion.Setting(0) & " - " & catalogName) & arrMainPage(1) & arrMainPage(2)
			tempStr = tempStr & Replace(Replace(arrPage(0), "{$site_nav}", ishion.site_nav(catalogID, "ishion_Down_catalog", "资源列表", "")), "{$rssurl}", sXml)
			tempStr = tempStr & Replace(Replace(Replace(arrPage(1), "{$strsql}", strSQL), "{$showpage}", ""), "{$catalog_nav}", ishion.catalog_nav(rootID, catalogID, depth, "ishion_Down_catalog"))
			tempStr = tempStr & arrPage(2) & Replace(arrPage(4), "{$showpage}", "")
			tempStr = tempStr & arrMainPage(4) & arrMainPage(5) '结束
			
			
			Set fso = Server.CreateObject(ishion.Setting(23))
			Set fout = fso.CreateTextFile(Server.MapPath(MyDbPath & Replace(sFileName, "{$pages}", Pages)))
			fout.WriteLine tempStr
			fout.Close: Set fout = Nothing
			Set fso = Nothing
			tempStr = Null
		Else
			
			If ResNum Mod ishion.Setting(83) = 0 Then
				Pages = CLng(ResNum / ishion.Setting(83) * -1) * -1
			Else
				Pages = CLng(ResNum / ishion.Setting(83) * -1) * -1 + 1
			End If
		
			sColumn = "ID,rootID,catalogID,catalogName,ResName,ResVer,FontColor,FontType,ResLanguage,ResSize,ResType,ResLicence,ResRank,System,DateAndTime,UpdateTime,HitsTotal,isHot,isTop,isBest,Excerpt,SmallImg"
			Set showPageRs = New cls_ishion_showPage
			
			For currentPage = 1 To Pages
				If IsSqlDataBase = 1 Then
					showPageRs.DbType = "MSSQL"
				Else
					showPageRs.DbType = "AC"
				End If
				showPageRs.RecType = 2
				showPageRs.RecSql = Int(ResNum)
				showPageRs.RecTerm = 0
				showPageRs.CookieName = "View_down_reslist" & catalogID
				showPageRs.Order = 1
				showPageRs.PageSize = Int(ishion.Setting(83))
				showPageRs.currentPage = Int(currentPage)
				showPageRs.sql = sColumn & "$ishion_Down_Resource$" & strSQL & " and isAuditing=1$isTop Desc,UpdateTime Desc$UpdateTime"
	
				Dim iRecCount, sqlRs
				iRecCount = showPageRs.RecCount()
				
				tempStr = Replace(arrMainPage(0), "{$page_title}", ishion.Setting(0) & " - " & catalogName) & arrMainPage(1) & arrMainPage(2)
				tempStr = tempStr & Replace(Replace(arrPage(0), "{$site_nav}", ishion.site_nav(catalogID, "ishion_Down_catalog", "资源列表", "")), "{$rssurl}", sXml)
				tempStr = tempStr & Replace(Replace(Replace(arrPage(1), "{$strsql}", strSQL), "{$showpage}", showPageRs.showPage("../" & sFileName)), "{$catalog_nav}", ishion.catalog_nav(rootID, catalogID, depth, "ishion_Down_catalog"))
				tempStr = regExp_showDownRes(tempStr)
				
				If iRecCount < 1 Then
					s = "<tr> <td colspan=""5"">Sorry！没有找到任何记录。</td></tr>"
				Else
					Set sqlRs = showPageRs.ResultSet()  '返回ResultSet
					if sqlRs.eof and sqlRs.bof then Exit Function
					Rs = sqlRs.GetRows(Int(ishion.Setting(83)))
					For i = 0 To UBound(Rs, 2)
						s = arrPage(3)
						If Rs(18, i) Then
							s = Replace(s, "{$dot_images}", "<img src=""../images/isTop.gif"" align=""absmiddle"">")
						ElseIf Rs(17, i) Then
							s = Replace(s, "{$dot_images}", "<img src=""../images/isHot.gif"" align=""absmiddle"">")
						ElseIf Rs(19, i) Then
							s = Replace(s, "{$dot_images}", "<img src=""../images/isBest.gif"" align=""absmiddle"">")
						Else
							s = Replace(s, "{$dot_images}", "<img src=""../images/isList.gif"" align=""absmiddle"">")
						End If
							
						s = Replace(s, "{$softurl}", Replace(ishion.Setting(77), "{$id}", Rs(0, i)))
						s = Replace(s, "{$softname}", Rs(4, i))
						s = Replace(s, "{$softver}", Rs(5, i))
						s = Replace(s, "{$updatetime}", ishion.FormatMyDate(Rs(15, i), "{Y}-{m}-{d}"))
						s = Replace(s, "{$softrank}", Rs(12, i))
						s = Replace(s, "{$hitstotal}", Rs(16, i))
						If Rs(9, i) > 1024 Then
							s = Replace(s, "{$softsize}", Round(Rs(9, i) / 1024, 2) & " MB")
						Else
							s = Replace(s, "{$softsize}", Rs(9, i) & " KB")
						End If
						s = Replace(s, "{$excerpt}", Rs(20, i))
						s = Replace(s, "{$softtype}", Rs(10, i))
						s = Replace(s, "{$softlicence}", Rs(11, i))
						s = Replace(s, "{$system}", Rs(13, i))
						s = Replace(s, "{$smallimg}", "../" & Rs(21, i))
						tempStr = tempStr & s
						s = Null
					Next
					Rs = Null
					Set sqlRs = Nothing
				End If
				
				tempStr = tempStr & Replace(arrPage(4), "{$showpage}", showPageRs.showPage("../" & sFileName)) & arrMainPage(4) & arrMainPage(5)
				
				tempStr = regExp_showDownResImages(tempStr)
				
				Set fso = Server.CreateObject(ishion.Setting(23))
				
				TestFilePath=Server.MapPath(MyDbPath & split(sFileName,"/")(0))
				If Not FSO.FolderExists(TestFilePath) Then
					Set TestFolder = FSO.CreateFolder(TestFilePath)
				End If
				
				Set fout = fso.CreateTextFile(Server.MapPath(MyDbPath & Replace(sFileName, "{$pages}", currentPage)))
				If ishion.F469e80d32(1) = "1" Then
					fout.WriteLine ishion.HtmlHead() & tempStr
				Else
					fout.WriteLine ishion.HtmlHead() & tempStr & ishion.CopyRight
				End If
				fout.Close: Set fout = Nothing
				Set fso = Nothing
				tempStr = Null
			Next
			Make_Down_List = catalogName & "-OK!　"
			Set showPageRs = Nothing
		End If
	End Function
	Rem *********************************************文章列表页*************************************************
	Public Function Make_Cms_List(rootID, catalogID, catalogName, depth, child, orders, ResNum)
	
		Dim arrPage, arrMainPage, Rs, strSQL, sFileName, sXml
		If depth = 0 Then
			strSQL = "rootID=" & rootID
			'q = " & " & strSQL
			sFileName = Replace(ishion.Setting(97), "{$id}", rootID)
			sXml = "xml/rss_Cms_r" & rootID & ".xml"
		Else
			strSQL = "catalogID=" & catalogID
			'q = " & " & strSQL
			If child > 0 Then
				strSQL = "catalogID in (select catalogID from ishion_Cms_Catalog where rootID=" & rootID & " and depth>" & depth & " and orders>" & orders & ")"
			End If
			sFileName = Replace(ishion.Setting(98), "{$id}", catalogID)
			sXml = "xml/rss_Cms_s" & catalogID & ".xml"
		End If
		
		Dim showPageRs, sql, i, sColumn, currentPage, Pages, tempStr, s
		Dim fso, fout
		
		arrPage = Split(ishion.ReadStylePage("Style_Cms_List"), "<!--|||-->")
		arrMainPage = Split(ishion.ReadStylePage("Style_Cms_Main"), "<!--|||-->")
		'currentPage = 1
		If ResNum = 0 Then  '没有记录时
			Pages = 1
			tempStr = Replace(arrMainPage(0), "{$page_title}", ishion.Setting(0) & " - " & catalogName) & arrMainPage(1) & arrMainPage(2)
			tempStr = tempStr & Replace(Replace(arrPage(0), "{$site_nav}", ishion.site_nav(catalogID, "ishion_Cms_catalog", "文章列表", "")), "{$rssurl}", sXml)
			tempStr = tempStr & Replace(Replace(Replace(arrPage(1), "{$strsql}", strSQL), "{$showpage}", ""), "{$catalog_nav}", ishion.catalog_nav(rootID, catalogID, depth, "ishion_Cms_catalog"))
			tempStr = tempStr & arrPage(2) & Replace(arrPage(4), "{$showpage}", "")
			tempStr = tempStr & arrMainPage(4) '结束
			
			
			Set fso = Server.CreateObject(ishion.Setting(23))
			Set fout = fso.CreateTextFile(Server.MapPath(MyDbPath & Replace(sFileName, "{$pages}", Pages)))
			fout.WriteLine tempStr
			fout.Close: Set fout = Nothing
			Set fso = Nothing
			tempStr = Null
		Else
			
			If ResNum Mod ishion.Setting(103) = 0 Then
				Pages = CLng(ResNum / ishion.Setting(103) * -1) * -1
			Else
				Pages = CLng(ResNum / ishion.Setting(103) * -1) * -1 + 1
			End If
		
			sColumn = "ID,catalogID,catalogName,dTitle,Title,FontColor,FontType,Excerpt,RedirectUrl,Writer,nFrom,DateAndTime,Hits,isHot,isTop,isBest,isPic,isAuditing,UserName"
			Set showPageRs = New cls_ishion_showPage
			
			For currentPage = 1 To Pages
			   ' showPageRs.Conn = ConnStr
				If IsSqlDataBase = 1 Then
					showPageRs.DbType = "MSSQL"
				Else
					showPageRs.DbType = "AC"
				End If
				showPageRs.RecType = 2
				showPageRs.RecSql = Int(ResNum)
				showPageRs.RecTerm = 2
				showPageRs.CookieName = "View_Cms_reslist" & catalogID
				showPageRs.Order = 1
				showPageRs.PageSize = Int(ishion.Setting(103))
				showPageRs.currentPage = Int(currentPage)
				showPageRs.sql = sColumn & "$ishion_Cms_Resource$" & strSQL & " and isAuditing=1$isTop Desc,DateAndTime Desc$DateAndTime"
	
				Dim iRecCount, sqlRs
				iRecCount = showPageRs.RecCount()				
				
				tempStr = Replace(arrMainPage(0), "{$page_title}", ishion.Setting(0) & " - " & catalogName) & arrMainPage(1) & arrMainPage(2)
				tempStr = tempStr & Replace(Replace(arrPage(0), "{$site_nav}", ishion.site_nav(catalogID, "ishion_Cms_catalog", "资源列表", "")), "{$rssurl}", sXml)
				tempStr = tempStr & Replace(Replace(Replace(arrPage(1), "{$strsql}", strSQL), "{$showpage}", showPageRs.showPage("../" & sFileName)), "{$catalog_nav}", ishion.catalog_nav(rootID, catalogID, depth, "ishion_Cms_catalog"))
				tempStr = regExp_showCmsRes(tempStr)
				
				If iRecCount < 1 Then
					s = "<tr> <td colspan=""5"">Sorry！没有找到任何记录。</td></tr>"
				Else
					Set sqlRs = showPageRs.ResultSet()  '返回ResultSet
					if sqlRs.eof and sqlRs.bof then Exit Function
					Rs = sqlRs.GetRows(Int(ishion.Setting(103)))
					For i = 0 To UBound(Rs, 2)
						s = arrPage(3)
						If Rs(14, i) Then
							s = Replace(s, "{$dot_images}", "<img src=""../images/isTop.gif"" align=""absmiddle"">")
						ElseIf Rs(13, i) Then
							s = Replace(s, "{$dot_images}", "<img src=""../images/isHot.gif"" align=""absmiddle"">")
						ElseIf Rs(15, i) Then
							s = Replace(s, "{$dot_images}", "<img src=""../images/isBest.gif"" align=""absmiddle"">")
						Else
							s = Replace(s, "{$dot_images}", "<img src=""../images/isList.gif"" align=""absmiddle"">")
						End If
						s = Replace(s, "{$catalogurl}", "../" & Replace(Replace(ishion.Setting(78), "{$id}", Rs(1, i)), "{$pages}", "1"))
						s = Replace(s, "{$catalogname}", Rs(2, i))
						s = Replace(s, "{$articleurl}", Replace(ishion.Setting(101), "{$id}", Rs(0, i) & "_1"))
						s = Replace(s, "{$title}", Rs(4, i))
						s = Replace(s, "{$updatetime}", ishion.FormatMyDate(Rs(11, i), "{Y}-{m}-{d}"))
						s = Replace(s, "{$hits}", Rs(12, i))
						s = Replace(s, "{$excerpt}", Rs(7, i))
						tempStr = tempStr & s
						s = Null
					Next
					Rs = Null
					Set sqlRs = Nothing
				End If
				
				tempStr = tempStr & Replace(arrPage(4), "{$showpage}", showPageRs.showPage("../" & sFileName)) & arrMainPage(4)
				tempStr = regExp_showCmsResImages(tempStr)
				
				Set fso = Server.CreateObject(ishion.Setting(23))
				Set fout = fso.CreateTextFile(Server.MapPath(MyDbPath & Replace(sFileName, "{$pages}", currentPage)))
				If ishion.F469e80d32(1) = "1" Then
					fout.WriteLine ishion.HtmlHead() & tempStr
				Else
					fout.WriteLine ishion.HtmlHead() & tempStr & ishion.CopyRight
				End If
	
				fout.Close: Set fout = Nothing
				Set fso = Nothing
				tempStr = Null
			Next
			Make_Cms_List = catalogName & "-OK!　"
			Set showPageRs = Nothing
		End If
	End Function
	Rem *********************************************下载信息页*************************************************
	Public Function Make_Down_Info(ID)
		
	
		Dim arrPage, arrMainPage, Rs, s, tempStr
		If ID = "" Then Exit Function
		Set Rs = ishion.Execute("select * from ishion_Down_Resource where ID=" & ID)
		If (Rs.EOF And Rs.BOF) Then
			Set Rs = Nothing
			Exit Function
		End If
		arrPage = Split(ishion.ReadStylePage("Style_Down_Info"), "<!--|||-->")
		arrMainPage = Split(ishion.ReadStylePage("Style_Down_Main"), "<!--|||-->")
		tempStr = Replace(arrPage(0), "{$site_nav}", ishion.site_nav(Rs("catalogID"), "ishion_Down_catalog", Rs("ResName") & " " & Rs("ResVer"), ""))
		
		s = Replace(arrPage(1), "{$id}", ID)
		s = Replace(s, "{$softname}", Rs("ResName"))
		s = Replace(s, "{$softver}", Rs("ResVer"))
		If Rs("ResSize") > 1024 Then
			s = Replace(s, "{$softsize}", Round(Rs("ResSize") / 1024, 2) & " MB")
		Else
			s = Replace(s, "{$softsize}", Rs("ResSize") & " KB")
		End If
		s = Replace(s, "{$softlanguage}", Rs("ResLanguage"))
		s = Replace(s, "{$softtype}", Rs("ResType"))
		s = Replace(s, "{$softlicence}", Rs("ResLicence"))
		s = Replace(s, "{$catalogid}", Rs("catalogID"))
		s = Replace(s, "{$catalogname}", Rs("catalogname"))
		s = Replace(s, "{$system}", Rs("system"))
		If Rs("previewimg") <> "" Then
			s = Replace(s, "{$previewimg}", "<B>界面预览：</B><a href=""../Viewimg.asp?p=" & Rs("Previewimg") & """ target=""_blank""><img src=""../images/screen.gif""  border=""0"" align=""absmiddle""></a><br>")
		Else
			s = Replace(s, "{$previewimg}", "")
		End If
		If Rs("SmallImg") <> "" And (Not IsNull(Rs("SmallImg"))) Then
			s = Replace(s, "{$smallimg}", "<img src=""../" & Rs("SmallImg") &""">")
		Else
			s = Replace(s, "{$smallimg}", "")
		End If
		s = Replace(s, "{$dateandtime}", Rs("dateandtime"))
		s = Replace(s, "{$updatetime}", Rs("updatetime"))
		s = Replace(s, "{$username}", Rs("username"))
		s = Replace(s, "{$softrank}", Rs("resrank"))    
		
		s = Replace(s, "{$userclass}",(Split(ishion.Setting(140), ",")(Rs("UserClass"))))  '????
		If Rs("RegUrl") <> "" Then
			s = Replace(s, "{$regurl}", "<B>软件注册：</B><a href=""" & Rs("regurl") & """ target=""_blank"">" & ishion.cutStr(Rs("regurl"),25) & "</a><br>")
		Else
			s = Replace(s, "{$regurl}", "")
		End If
		If Rs("authoremail") <> "" Then
			s = Replace(s, "{$authoremail}", "<B>联 系 人：</B><a href=""mailto:" & Rs("authoremail") & """>" & Rs("authoremail") & "</a><br>")
		Else
			s = Replace(s, "{$authoremail}", "")
		End If
		If Rs("AuthorUrl") <> "" Then
			s = Replace(s, "{$authorurl}", "<B>开 发 商：</B><a href=""" & Rs("authorurl") & """ target=""_blank"">" & ishion.cutStr(Rs("authorurl"),25) & "</a><br>")
		Else
			s = Replace(s, "{$authorurl}", "")
		End If
		s = Replace(s, "{$hitstoday}", Rs("hitstoday"))
		s = Replace(s, "{$hitsweek}", Rs("hitsweek"))
		s = Replace(s, "{$hitsmonth}", Rs("HitsMonth"))
		s = Replace(s, "{$hitstotal}", Rs("hitstotal"))
		s = Replace(s, "{$content}", Rs("content"))
		
		If Rs("UserClass") = 0 Then
			If ishion.setting(82) = "1" then
				s = Replace(s, "{$downaddress}", "<img src=""../images/d_download.gif"" align=""absmiddle"" border=""0""><a onclick='window.open(""../ViewDownloadUrl.asp?ID=" & ID & """)' href=""javascript:"">点击打开下载页面(Download Now) </a><br>")
			Else
				If ishion.Setting(80) = 1 Then
					s = Replace(s, "{$downaddress}", showDownloadAddress(Rs("ID"), ishion.Setting(81), 1))
				Else
					s = Replace(s, "{$downaddress}", showDownloadAddress(Rs("ID"), ishion.Setting(81), 0))
				End If
			End If
		Else
			s = Replace(s, "{$downaddress}", "<img src=""../images/d_download.gif"" align=""absmiddle"" border=""0""><a onclick='window.open(""../VipDownload.asp?ID=" & ID & """)' href=""javascript:"">点此进入会员下载页面</a><br>")
		End If
		tempStr = Replace(arrMainPage(0), "{$page_title}", ishion.Setting(0) & " - " & Rs("ResName") & " " & Rs("ResVer")) & arrMainPage(1) & arrMainPage(2) & tempStr & s
		s = Null
		
		
		'相关软件
		If Rs("mutualitydown") <> "" Then
			tempStr = tempStr & Replace(arrPage(2), "{$mutualitydown}", ishion.showMutualityDownRes(Rs("mutualitydown"),45))
		End If
		
		'相关文章
		If Rs("mutualitycms") <> "" Then
			tempStr = tempStr & Replace(arrPage(3), "{$mutualitycms}", ishion.showMutualityCmsRes(Rs("mutualitycms"),45))
		End If
		
		'用户评论
		If ishion.Setting(88) Then
			's = Replace(arrPage(4),"{$id}",id)
			s = Replace(arrPage(5), "{$comment}", comment_down(ID, Rs("commentNum"), Rs("Grade")))
		Else
			s = Replace(arrPage(5), "{$comment}", "")
		End If
		tempStr = tempStr & Replace(arrPage(4), "{$softname}", Rs("ResName")) & s
		s = Null
		
		tempStr = tempStr & arrPage(6) & arrMainPage(5)
		arrPage = Null
		arrMainPage = Null
		
		
		tempStr = regExp_showDownRes(tempStr)
		
		If ID Mod 5 = 0 Then
			Make_Down_Info = ID & "-OK!..　"
		Else
			Make_Down_Info = ""
		End If
		'Response.Write( Rs("ResName") & "" & Rs("ResVer") & "<br>")
		Response.Flush
		Set Rs = Nothing
		'Exit Function
		
		Dim fso, fout
		Set fso = Server.CreateObject(ishion.Setting(23))
		
		TestFilePath=Server.MapPath(MyDbPath & split(ishion.Setting(77),"/")(0))
		If Not FSO.FolderExists(TestFilePath) Then
			Set TestFolder = FSO.CreateFolder(TestFilePath)
		End If
		
		Set fout = fso.CreateTextFile(Server.MapPath(MyDbPath & Replace(ishion.Setting(77), "{$id}", ID)))
		fout.WriteLine ishion.HtmlHead() & tempStr
		fout.Close: Set fout = Nothing
		Set fso = Nothing
		tempStr = Null
		
	End Function
	Rem *********************************************文章信息页*************************************************
	Public Function Make_Cms_Info(ID)
	
		Dim arrPage, arrMainPage, Rs, MyPage, s, tempStr, i, fso, fout
		If ID = "" Then Exit Function
		Set MyPage = New cls_article_Page
		Set Rs = ishion.Execute("select * from ishion_Cms_Resource where ID=" & ID)
		If (Rs.EOF And Rs.BOF) Then
			Set Rs = Nothing
			Exit Function
		End If
		arrPage = Split(ishion.ReadStylePage("Style_Cms_Info"), "<!--|||-->")
		arrMainPage = Split(ishion.ReadStylePage("Style_Cms_Main"), "<!--|||-->")
		tempStr = Replace(arrMainPage(0), "{$page_title}", ishion.Setting(0) & " - " & Rs("title")) & arrMainPage(1) & arrMainPage(2)
		tempStr = tempStr & Replace(arrPage(0), "{$site_nav}", ishion.site_nav(Rs("catalogID"), "ishion_Cms_catalog", Rs("Title"), ""))
		
		If Rs("PaginationType") = 0 Then '不分页
			s = Replace(arrPage(1), "{$title}", Rs("title"))
			s = Replace(s, "{$dateandtime}", Rs("DateAndTime"))
			s = Replace(s, "{$writer}", Rs("Writer"))
			s = Replace(s, "{$hits}", Rs("Hits"))
			s = Replace(s, "{$nfrom}", "<a href=""" & Split(Rs("nFrom"), "|")(1) & """ target=""_blank"">" & Split(Rs("nFrom"), "|")(0) & "</a>")
			s = Replace(s, "{$content}", Rs("Content"))
			s = Replace(s, "{$showpage}", "")
			tempStr = tempStr & s
			
			'相关文章
			If Rs("mutualitycms") <> "" Then
				tempStr = tempStr & Replace(arrPage(2), "{$article}", ishion.showMutualityCmsRes(Rs("mutualitycms"),45))
			End If
			'相关软件
			If Rs("mutualitydown") <> "" Then
				tempStr = tempStr & Replace(arrPage(3), "{$software}", ishion.showMutualityDownRes(Rs("mutualitydown"),45))
			End If
			
			'用户评论
			If ishion.Setting(114) Then
			's = Replace(arrPage(4),"{$id}",id)
				s = Replace(arrPage(4), "{$comment}", comment_Cms(ID, Rs("commentNum"), Rs("Grade")))
				tempStr = tempStr & Replace(s, "{$title}", Rs("title"))
				s = Null
			End If
			tempStr = tempStr & Replace(arrPage(5), "{$catalogid}", Rs("catalogID")) & arrMainPage(4) '结束
			arrPage = Null
			arrMainPage = Null
		
			tempStr = regExp_showCmsRes(tempStr)
			
			If ID Mod 5 = 0 Then
				Make_Cms_Info = ID & "-OK!..　"
			Else
				Make_Cms_Info = ""
			End If
			'Response.Write( Rs("ResName") & "" & Rs("ResVer") & "<br>")
			'Response.Flush
			Set Rs = Nothing
			Set MyPage = Nothing
			'Exit Function
	
			Set fso = Server.CreateObject(ishion.Setting(23))
				Set fout = fso.CreateTextFile(Server.MapPath(MyDbPath & Replace(ishion.Setting(101), "{$id}", ID & "_1")))
				fout.WriteLine tempStr
				fout.Close: Set fout = Nothing
			Set fso = Nothing
			tempStr = Null
		
		Else
			MyPage.PageType = Rs("PaginationType")
			If Rs("MaxCharPerPage")> 0 then MyPage.MaxPerPage = Rs("MaxCharPerPage")
			MyPage.FileName = "../" & Replace(ishion.Setting(101), "{$id}", ID & "_{Page}")			
			
			For i = 1 To MyPage.ResultPageNum
				MyPage.Page = i
				MyPage.Body = Rs("Content")
				s = arrPage(1)
				s = Replace(s, "{$title}", Rs("title"))
				s = Replace(s, "{$dateandtime}", Rs("DateAndTime"))
				s = Replace(s, "{$writer}", Rs("Writer"))
				s = Replace(s, "{$hits}", Rs("Hits"))
				s = Replace(s, "{$nfrom}", "<a href=""" & Split(Rs("nFrom"), "|")(1) & """ target=""_blank"">" & Split(Rs("nFrom"), "|")(0) & "</a>")
				s = Replace(s, "{$content}", MyPage.ResultBody)
				s = Replace(s, "{$showpage}", MyPage.showPage())
				'相关文章
				If Rs("mutualitycms") <> "" and (Not isNull(Rs("mutualitycms"))) Then
					'Response.Write(Rs("mutualitycms"))
					s = s & Replace(arrPage(2), "{$article}", ishion.showMutualityCmsRes(Rs("mutualitycms"),45))
				End If
				'相关软件
				If Rs("mutualitydown") <> "" And (Not isNull(Rs("mutualitydown"))) Then
					s = s & Replace(arrPage(3), "{$software}", ishion.showMutualityDownRes(Rs("mutualitydown"),45))
				End If
				
				'用户评论
				If ishion.Setting(114) Then
					Dim strcomment
					strcomment = Replace(arrPage(4), "{$comment}", comment_Cms(ID, Rs("commentNum"), Rs("Grade")))
					strcomment = Replace(strcomment, "{$title}", Rs("title"))
					s = s & strcomment
					strcomment = Null
				End If
				s = s & Replace(arrPage(5), "{$catalogid}", Rs("catalogID")) & arrMainPage(4)
	
			
				s = regExp_showCmsRes(s)
				
				If ID Mod 5 = 0 Then
					Make_Cms_Info = ID & "-OK!..　"
				Else
					Make_Cms_Info = ""
				End If
				'Response.Write( Rs("ResName") & "" & Rs("ResVer") & "<br>")
				'Response.Flush
	
				'Exit Function
				
				Set fso = Server.CreateObject(ishion.Setting(23))
					Set fout = fso.CreateTextFile(Server.MapPath(MyDbPath & Replace(ishion.Setting(101), "{$id}", ID & "_" & i)))
					fout.WriteLine ishion.HtmlHead() & tempStr & s
					fout.Close: Set fout = Nothing
				Set fso = Nothing
				s = Null
			Next
			arrPage = Null
			arrMainPage = Null
			tempStr = Null
			Set Rs = Nothing
			Set MyPage = Nothing
		End If
	End Function
	
	Private Function regExp_showNews(strContent)
		If strContent = "" Then
			Exit Function
		End If
		Dim regEx, Key, Matchs, arrRegExp, str, s
		str = strContent
		Set regEx = New RegExp
			regEx.IgnoreCase = True
			regEx.Global = True
			regEx.Pattern = "<!--showNews:([\S\s]*?)-->"
			Set Matchs = regEx.Execute(str)
			If Matchs.Count > 0 Then
				For Each Key In Matchs
					arrRegExp = Split(Key.SubMatches(0), "|")
					'Response.Write(Key.SubMatches(0)) & "<br>"
					s = ishion.showNews(arrRegExp(0), arrRegExp(1), arrRegExp(2), arrRegExp(3))
					str = Replace(str, "<!--showNews:" & Key.SubMatches(0) & "-->", s)
					s = Null
					arrRegExp = Null
				Next
				Key = Null
			End If
			Set Matchs = Nothing
		Set regEx = Nothing
		regExp_showNews = str
		str = Null
	End Function

	Private Function regExp_showDownRes(strContent)
		If strContent = "" Then
			Exit Function
		End If
		Dim regEx, Key, Matchs, arrRegExp, str, s
		str = strContent
		Set regEx = New RegExp
			regEx.IgnoreCase = True
			regEx.Global = True
			regEx.Pattern = "<!--showDownRes:([\S\s]*?)-->"
			Set Matchs = regEx.Execute(str)
			If Matchs.Count > 0 Then
				For Each Key In Matchs
					arrRegExp = Split(Key.SubMatches(0), "|")
					'Response.Write(Key.SubMatches(0)) &"#"& arrRegExp(0)&"#"& arrRegExp(1)&"#"& arrRegExp(2)&"#"& arrRegExp(3)&"#"&  arrRegExp(4)&"#"& arrRegExp(5)&"<br>"
					s = ishion.showDownRes(arrRegExp(0), arrRegExp(1), arrRegExp(2), arrRegExp(3), arrRegExp(4), arrRegExp(5))
					str = Replace(str, "<!--showDownRes:" & Key.SubMatches(0) & "-->", s)
					s = Null
					arrRegExp = Null
				Next
				Key = Null
			End If
			Set Matchs = Nothing
		Set regEx = Nothing
		regExp_showDownRes = str
		str = Null
	End Function
	Private Function regExp_showCmsRes(strContent)
		If strContent = "" Then
			Exit Function
		End If
		Dim regEx, Key, Matchs, arrRegExp, str, s
		str = strContent
		Set regEx = New RegExp
			regEx.IgnoreCase = True
			regEx.Global = True
			regEx.Pattern = "<!--showCmsRes:([\S\s]*?)-->"
			Set Matchs = regEx.Execute(str)
			If Matchs.Count > 0 Then
				For Each Key In Matchs
					arrRegExp = Split(Key.SubMatches(0), "|")
					'Response.Write(Key.SubMatches(0)) & "<br>"
					s = ishion.showCmsRes(arrRegExp(0), arrRegExp(1), arrRegExp(2), arrRegExp(3), arrRegExp(4), arrRegExp(5))
					str = Replace(str, "<!--showCmsRes:" & Key.SubMatches(0) & "-->", s)
					s = Null
					arrRegExp = Null
				Next
				Key = Null
			End If
			Set Matchs = Nothing
		Set regEx = Nothing
		regExp_showCmsRes = str
		str = Null
	End Function
	Private Function regExp_AdvshowDownRes(strContent)
		If strContent = "" Then
			Exit Function
		End If
		Dim regEx, Key, Matchs, arrRegExp, str, s
		str = strContent
		Set regEx = New RegExp
			regEx.IgnoreCase = True
			regEx.Global = True
			regEx.Pattern = "<!--AdvshowDownRes:([\S\s]*?)-->"
			Set Matchs = regEx.Execute(str)
			If Matchs.Count > 0 Then
				For Each Key In Matchs
					arrRegExp = Split(Key.SubMatches(0), "|")
					'Response.Write(Key.SubMatches(0)) & "<br>"
					s = ishion.showDownResAdv(arrRegExp(0), arrRegExp(1), arrRegExp(2), arrRegExp(3), arrRegExp(4), arrRegExp(5), arrRegExp(6), arrRegExp(7))
					str = Replace(str, "<!--AdvshowDownRes:" & Key.SubMatches(0) & "-->", s)
					s = Null
					arrRegExp = Null
				Next
				Key = Null
			End If
			Set Matchs = Nothing
		Set regEx = Nothing
		regExp_AdvshowDownRes = str
		str = Null
	End Function
	Private Function regExp_AdvshowCmsRes(strContent)
		If strContent = "" Then
			Exit Function
		End If
		Dim regEx, Key, Matchs, arrRegExp, str, s
		str = strContent
		Set regEx = New RegExp
			regEx.IgnoreCase = True
			regEx.Global = True
			regEx.Pattern = "<!--AdvshowCmsRes:([\S\s]*?)-->"
			Set Matchs = regEx.Execute(str)
			If Matchs.Count > 0 Then
				For Each Key In Matchs
					arrRegExp = Split(Key.SubMatches(0), "|")
					'Response.Write(Key.SubMatches(0)) & "<br>"
					s = ishion.showCmsResAdv(arrRegExp(0), arrRegExp(1), arrRegExp(2), arrRegExp(3), arrRegExp(4), arrRegExp(5), arrRegExp(6), arrRegExp(7))
					str = Replace(str, "<!--AdvshowCmsRes:" & Key.SubMatches(0) & "-->", s)
					s = Null
					arrRegExp = Null
				Next
				Key = Null
			End If
			Set Matchs = Nothing
		Set regEx = Nothing
		regExp_AdvshowCmsRes = str
		str = Null
	End Function
	Private Function regExp_showDownResImages(strContent)
		If strContent = "" Then
			Exit Function
		End If
		Dim regEx, Key, Matchs, arrRegExp, str, s
		str = strContent
		Set regEx = New RegExp
			regEx.IgnoreCase = True
			regEx.Global = True
			regEx.Pattern = "<!--showDownResImages:([\S\s]*?)-->"
			Set Matchs = regEx.Execute(str)
			If Matchs.Count > 0 Then
				For Each Key In Matchs
					arrRegExp = Split(Key.SubMatches(0), "|")
					'Response.Write(Key.SubMatches(0)) & "<br>"
					s = ishion.showDownResImages(arrRegExp(0), arrRegExp(1), arrRegExp(2), arrRegExp(3), arrRegExp(4), arrRegExp(5), arrRegExp(6))
					str = Replace(str, "<!--showDownResImages:" & Key.SubMatches(0) & "-->", s)
					s = Null
					arrRegExp = Null
				Next
				Key = Null
			End If
			Set Matchs = Nothing
		Set regEx = Nothing
		regExp_showDownResImages = str
		str = Null
	End Function
	Private Function regExp_showCmsResImages(strContent)
		If strContent = "" Then
			Exit Function
		End If
		Dim regEx, Key, Matchs, arrRegExp, str, s
		str = strContent
		Set regEx = New RegExp
			regEx.IgnoreCase = True
			regEx.Global = True
			regEx.Pattern = "<!--showCmsResImages:([\S\s]*?)-->"
			Set Matchs = regEx.Execute(str)
			If Matchs.Count > 0 Then
				For Each Key In Matchs
					arrRegExp = Split(Key.SubMatches(0), "|")
					'Response.Write(Key.SubMatches(0)) & "<br>"
					s = ishion.showCmsResImages(arrRegExp(0), arrRegExp(1), arrRegExp(2), arrRegExp(3), arrRegExp(4), arrRegExp(5), arrRegExp(6))
					str = Replace(str, "<!--showCmsResImages:" & Key.SubMatches(0) & "-->", s)
					s = Null
					arrRegExp = Null
				Next
				Key = Null
			End If
			Set Matchs = Nothing
		Set regEx = Nothing
		regExp_showCmsResImages = str
		str = Null
	End Function
	
	Private Function regExp_showCmsResImagesTwo(strContent)
		If strContent = "" Then
			Exit Function
		End If
		Dim regEx, Key, Matchs, arrRegExp, str, s
		str = strContent
		Set regEx = New RegExp
			regEx.IgnoreCase = True
			regEx.Global = True
			regEx.Pattern = "<!--showCmsResImagesTwo:([\S\s]*?)-->"
			Set Matchs = regEx.Execute(str)
			If Matchs.Count > 0 Then
				For Each Key In Matchs
					arrRegExp = Split(Key.SubMatches(0), "|")
					'Response.Write(Key.SubMatches(0)) & "<br>"
					s = ishion.showCmsResImagesTwo(arrRegExp(0), arrRegExp(1), arrRegExp(2), arrRegExp(3), arrRegExp(4), arrRegExp(5), arrRegExp(6), arrRegExp(7))
					str = Replace(str, "<!--showCmsResImagesTwo:" & Key.SubMatches(0) & "-->", s)
					s = Null
					arrRegExp = Null
				Next
				Key = Null
			End If
			Set Matchs = Nothing
		Set regEx = Nothing
		regExp_showCmsResImagesTwo = str
		str = Null
	End Function
	
	Private Function regExp_showCmsResExcerptImages(strContent)
		If strContent = "" Then
			Exit Function
		End If
		Dim regEx, Key, Matchs, arrRegExp, str, s
		str = strContent
		Set regEx = New RegExp
			regEx.IgnoreCase = True
			regEx.Global = True
			regEx.Pattern = "<!--showCmsResExcerptImages:([\S\s]*?)-->"
			Set Matchs = regEx.Execute(str)
			If Matchs.Count > 0 Then
				For Each Key In Matchs
					arrRegExp = Split(Key.SubMatches(0), "|")
					'Response.Write(Key.SubMatches(0)) & "<br>"
					s = ishion.showCmsResExcerptImages(arrRegExp(0), arrRegExp(1), arrRegExp(2), arrRegExp(3), arrRegExp(4), arrRegExp(5), arrRegExp(6), arrRegExp(7))
					str = Replace(str, "<!--showCmsResExcerptImages:" & Key.SubMatches(0) & "-->", s)
					s = Null
					arrRegExp = Null
				Next
				Key = Null
			End If
			Set Matchs = Nothing
		Set regEx = Nothing
		regExp_showCmsResExcerptImages = str
		str = Null
	End Function

	Private Function regExp_showDownResStat(strContent)
		If strContent = "" Then
			Exit Function
		End If
		Dim regEx, Key, Matchs, arrRegExp, str, s
		str = strContent
		Set regEx = New RegExp
			regEx.IgnoreCase = True
			regEx.Global = True
			regEx.Pattern = "<!--showDownResStat:([\S\s]*?)-->"
			Set Matchs = regEx.Execute(str)
			If Matchs.Count > 0 Then
				For Each Key In Matchs
					arrRegExp = Split(Key.SubMatches(0), "|")
					'Response.Write(Key.SubMatches(0)) & "<br>"
					s = showDownResStat(arrRegExp(0), arrRegExp(1), arrRegExp(2))
					str = Replace(str, "<!--showDownResStat:" & Key.SubMatches(0) & "-->", s)
					s = Null
					arrRegExp = Null
				Next
				Key = Null
			End If
			Set Matchs = Nothing
		Set regEx = Nothing
		regExp_showDownResStat = str
		str = Null
	End Function
	Private Function showDownResStat(strStat, strWhere, divisor)
		If strStat = "" Then strStat = "count(*)"
		If divisor = "" Or CLng(divisor) = 0 Then divisor = 1
		If strWhere = "" Then
			showDownResStat = ishion.Execute("select " & strStat & " from ishion_Down_Resource")(0) \ divisor
		Else
			showDownResStat = ishion.Execute("select " & strStat & " from ishion_Down_Resource where " & strWhere & "")(0) \ divisor
		End If
	End Function
	Private Function regExp_showCmsResStat(strContent)
		If strContent = "" Then
			Exit Function
		End If
		Dim regEx, Key, Matchs, arrRegExp, str, s
		str = strContent
		Set regEx = New RegExp
			regEx.IgnoreCase = True
			regEx.Global = True
			regEx.Pattern = "<!--showCmsResStat:([\S\s]*?)-->"
			Set Matchs = regEx.Execute(str)
			If Matchs.Count > 0 Then
				For Each Key In Matchs
					arrRegExp = Split(Key.SubMatches(0), "|")
					'Response.Write(Key.SubMatches(0)) & "<br>"
					s = showCmsResStat(arrRegExp(0), arrRegExp(1), arrRegExp(2))
					str = Replace(str, "<!--showCmsResStat:" & Key.SubMatches(0) & "-->", s)
					s = Null
					arrRegExp = Null
				Next
				Key = Null
			End If
			Set Matchs = Nothing
		Set regEx = Nothing
		regExp_showCmsResStat = str
		str = Null
	End Function
	Private Function showCmsResStat(strStat, strWhere, divisor)
		If strStat = "" Then strStat = "count(*)"
		If divisor = "" Or CLng(divisor) = 0 Then divisor = 1
		If strWhere = "" Then
			showCmsResStat = ishion.Execute("select " & strStat & " from ishion_Cms_Resource")(0) \ divisor
		Else
			showCmsResStat = ishion.Execute("select " & strStat & " from ishion_Cms_Resource where " & strWhere & "")(0) \ divisor
		End If
	End Function
	Private Function regExp_showSiteLinks(strContent)
		If strContent = "" Then
			Exit Function
		End If
		Dim regEx, Key, Matchs, arrRegExp, str, s
		str = strContent
		Set regEx = New RegExp
			regEx.IgnoreCase = True
			regEx.Global = True
			regEx.Pattern = "<!--showSiteLinks:([\S\s]*?)-->"
			Set Matchs = regEx.Execute(str)
			If Matchs.Count > 0 Then
				For Each Key In Matchs
					arrRegExp = Split(Key.SubMatches(0), "|")
					'Response.Write(Key.SubMatches(0)) & "<br>"
					s = showSiteLinks(arrRegExp(0), arrRegExp(1))
					str = Replace(str, "<!--showSiteLinks:" & Key.SubMatches(0) & "-->", s)
					s = Null
					arrRegExp = Null
				Next
				Key = Null
			End If
			Set Matchs = Nothing
		Set regEx = Nothing
		regExp_showSiteLinks = str
		str = Null
	End Function
	Public Function showSiteLinks(showType,showNum)
		dim tRs,s,link_i,link_ii
		link_i=0
		s = "<table width=""100%"" border=""0"" align=""center"" cellpadding=""3"" cellspacing=""1""><tr align=""center"" bgcolor=""#F6F6F6""> "& vbcrlf
		if showType=1 then
			set tRs = ishion.Execute("select top "&Int(showNum)&" * from ishion_SiteLinks where LinkType=1 order by isHot Desc,orders	asc,Hits Desc")
			If Not(tRs.eof and tRs.bof) then
				do while not tRs.eof
				s = s & "<td><a href="""&tRs("SiteURL")&""" target=_blank title="""&Trim(tRs("Description"))&"""><img src="""&tRs("SiteLogo")&""" width=""88"" height=""31"" border=""0""></a></td>"& vbcrlf
				link_i = link_i + 1
				if link_i mod 8 = 0 then  s = s & "</tr><tr align=""center"" bgcolor=""#F6F6F6"">"& vbcrlf
				tRs.movenext
				loop 
				If link_i mod 8 > 0 then 
					for link_ii = 1 to (8 - (link_i mod 8))
						s = s & "<td><img src=""../images/link.gif"" width=""88"" height=""31"" border=""0""></td>"& vbcrlf
					next
				End if
			End if
			Set tRs = Nothing 
		Else
			Set tRs = ishion.Execute("select top "&Int(showNum)&" * from ishion_SiteLinks where LinkType=0 order by isHot Desc,orders	asc,Hits Desc")
			If Not(tRs.eof and tRs.bof) then
				do while not tRs.eof
					s = s & "<td><a href="""&tRs("SiteURL")&""" target=_blank title="""&Trim(tRs("Description"))&"""><font color=000000>"&tRs("SiteName")&"</font></a></td>"& vbcrlf
					link_i = link_i + 1
					if link_i mod 8 = 0 then  s = s & "</tr><tr align=""center"" bgcolor=""#F6F6F6"">"& vbcrlf
				tRs.movenext
				loop 
				if link_i mod 8 > 0 then 
					for link_ii = 1 to (8 - (link_i mod 8))
						s = s & "<td><font color=000000>您的链接</font></td>"& vbcrlf
					next
				end if
			end if
			Set tRs = Nothing
		End if
		s = s & "</tr></table>"
		showSiteLinks = s
		s = Null
	End function
	'下载地址
	Private Function showDownloadAddress(ID, brNum, show)
		Dim sRs, aRs, s, arrDownloadName, arrDownloadURL, i
		If ishion.Setting(89) = "1" then
			Set sRs = ishion.Execute("select * from ishion_Down_Address where Special<2 and ResourceID=" & ID & " order by Special")
		Else
			Set sRs = ishion.Execute("select * from ishion_Down_Address where Special=0 and ResourceID=" & ID & " order by ID")
		End IF
		arr=split(sRs("URL"),"$")
		If Not (sRs.EOF And sRs.BOF) Then
			Do While Not sRs.EOF
			If sRs("SiteID") > 0 Then '使用预定义
				's = s & "<a href=""Download.asp"""
				Set aRs = ishion.Execute("select ID,DownloadName,DownloadURL,isLB from ishion_Down_SiteSetting where ID = " & sRs("SiteID"))
				If aRs(3) Then '显示全部分站
					s = s & ("<img src=""../images/d_download.gif"" align=""absmiddle"" border=""0""> <b>下载“" & sRs("Name") & "”</b><br>")
					For i = 0 To UBound(arr)-1
						arrd=split(arr(i),",")
					    arrDownloadName = arrd(1)
					    arrDownloadURL = "http://count.skycn.com/softdownload.php?id=4073&url="&arrd(0)
						If show Then
							s = s & "·<a href=""../Download.asp?ID=" & sRs("ID") & "&URL1=" & arrDownloadURL & sRs("URL") & """>" & arrDownloadName & "</a>　"
						Else
							s = s & "·<a href=""../Download.asp?ID=" & sRs("ID") & "&sID=" & i & """>" & arrDownloadName & "</a>　"
						End If
						If ((i + 1) Mod brNum) = 0 Then s = s & "<br>"
					Next
				Else
					If show Then '在明文显示下载地址是强制显示全部分站
						For i = 0 To UBound(arrDownloadName)
							s = s & "·<a href=""../Download.asp?ID=" & sRs("ID") & "&URL=" & arrDownloadURL(i) & sRs("URL") & """>" & arrDownloadName(i) & "</a>　"
						's = s & "<img src=""images/d_download.gif"" align=""absmiddle"" border=""0""> <a href=""Download.asp?ID=" & sRs("ID") & " & sID=" & sRs("SiteID") & " & URL=" & sRs("URL") & """>" & sRs("Name") & "</a><br>"
						If ((i + 1) Mod brNum) = 0 Then s = s & "<br>"
						Next
					Else
						s = s & "<img src=""../images/d_download.gif"" align=""absmiddle"" border=""0""> <a href=""../Download.asp?ID=" & sRs("ID") & """>" & sRs("Name") & "</a><br>"
					End If
				End If
				Set aRs = Nothing
			Else '不使用预定义
				If show Then
					s = s & "<img src=""../images/d_download.gif"" align=""absmiddle"" border=""0""> <a href=""../Download.asp?ID=" & sRs("ID") & "&URL=" & sRs("URL") & """>" & sRs("Name") & "</a><br>"
				Else
					s = s & "<img src=""../images/d_download.gif"" align=""absmiddle"" border=""0""> <a href=""../Download.asp?ID=" & sRs("ID") & """>" & sRs("Name") & "</a><br>"
				End If
			End If
			sRs.MoveNext
			Loop
			End If
		Set sRs = Nothing
		showDownloadAddress = s
		s = Null
	End Function
	Private Function comment_down(ID, commentNum, Grade)
		Dim reval, commentRs, i
		i = commentNum
		reval = reval & "<TABLE width=""100%"" border=""0"" cellPadding=""2"" cellSpacing=""1"" bgColor=""#cccccc"" style=""FONT-SIZE: 9pt"">" & vbCrLf
		reval = reval & "              <TR>" & vbCrLf
		reval = reval & "                <TD width=""80"" align=""middle"" bgColor=""#efefef""><input type=""submit"" name=""Submit"" value=""发表评论"" onclick=""spanComment.style.display=''; comment.content.focus(); return false;""></TD>" & vbCrLf
		reval = reval & "                <TD noWrap align=""center"" bgColor=""#efefef"">评论人</TD>" & vbCrLf
		reval = reval & "                <TD noWrap align=middle bgColor=""#efefef"">评论内容摘要(共 <FONT color=red>" & commentNum & "</FONT> 条，<A href=""../comment_down.asp?id=" & ID & """><FONT " & vbCrLf
		reval = reval & "color=#3366cc>查看完整内容</FONT></A>) 得分 <FONT color=red>" & Grade & "</FONT> 分</TD>" & vbCrLf
		reval = reval & "                <TD align=middle bgColor=#efefef>发表时间</TD>" & vbCrLf
		reval = reval & "              </TR>" & vbCrLf
		If commentNum <> 0 And commentNum <> "" Then
			Set commentRs = ishion.Execute("select top 7 ID,Content,UserName,Email,dateandtime,Graded from ishion_Down_Comment where ResourceID=" & ID & " order by dateandtime desc")
			If Not (commentRs.EOF And commentRs.BOF) Then
				Do While Not commentRs.EOF
				reval = reval & "              <TR bgColor=#ffffff>" & vbCrLf
				reval = reval & "                <TD width=""80"" align=right noWrap><NOBR><FONT color=red>" & i & "</FONT> 楼</NOBR> <NOBR>[<A " & vbCrLf
				reval = reval & "onclick=""spanComment.style.display=''; comment.content.focus(); comment.content.value='回复 " & i & " 楼(" & commentRs(2) & ")：'; return false;"" href=""javascript:""><FONT color=#3366cc>回复</FONT></A>]</NOBR><BR></TD>" & vbCrLf
				reval = reval & "                <TD style=""WORD-BREAK: break-all; WORD-WRAP: break-word"" align=center width=50><FONT color=green>" & commentRs(2) & "</FONT></TD>" & vbCrLf
				reval = reval & "                <TD style=""WORD-BREAK: break-all; WORD-WRAP: break-word"">" & ishion.cutStr(commentRs(1), 180) & "</TD>" & vbCrLf
				reval = reval & "                <TD noWrap align=middle><A style=""BORDER-BOTTOM: #3399cc 1px dotted"" href=""../comment_down.asp?id=" & ID & "#commentID" & commentRs(0) & """><FONT color=#3366cc>" & ishion.FormatMyDate(commentRs(4), "{m}-{d} {h}:{mi}") & "</FONT></A></TD>" & vbCrLf
				reval = reval & "              </TR>" & vbCrLf
				i = i - 1
				commentRs.MoveNext
				Loop
			End If
			Set commentRs = Nothing
		End If
		reval = reval & "              <TR bgcolor=""#FFFFFF"" id=""spanComment"" style=""display:none"">" & vbCrLf
		reval = reval & "                <TD colSpan=4><script language=""javascript"" src=""../js/comment.js""></script>" & vbCrLf
		reval = reval & "               <script language=""javascript"">show_commentForm(" & ID & ")</script>" & vbCrLf
		reval = reval & "               </TD>" & vbCrLf
		reval = reval & "              </TR>" & vbCrLf
		reval = reval & "</TABLE>" & vbCrLf
		comment_down = reval
		reval = Null
	End Function
	Private Function comment_Cms(ID, commentNum, Grade)
		Dim reval, commentRs, i
		i = commentNum
		reval = reval & "<TABLE width=""100%"" border=""0"" cellPadding=""2"" cellSpacing=""1"" bgColor=""#cccccc"" style=""FONT-SIZE: 9pt"">" & vbCrLf
		reval = reval & "              <TR>" & vbCrLf
		reval = reval & "                <TD width=""80"" align=""middle"" bgColor=""#efefef""><input type=""submit"" name=""Submit"" value=""发表评论"" onclick=""spanComment.style.display=''; comment.content.focus(); return false;""></TD>" & vbCrLf
		reval = reval & "                <TD noWrap align=""center"" bgColor=""#efefef"">评论人</TD>" & vbCrLf
		reval = reval & "                <TD noWrap align=middle bgColor=""#efefef"">评论内容摘要(共 <FONT color=red>" & commentNum & "</FONT> 条，<A href=""../comment_Cms.asp?id=" & ID & """><FONT " & vbCrLf
		reval = reval & "color=#3366cc>查看完整内容</FONT></A>) 得分 <FONT color=red>" & Grade & "</FONT> 分</TD>" & vbCrLf
		reval = reval & "                <TD align=middle bgColor=#efefef>发表时间</TD>" & vbCrLf
		reval = reval & "              </TR>" & vbCrLf
		If commentNum <> 0 And commentNum <> "" Then
			Set commentRs = ishion.Execute("select top 7 ID,Content,UserName,Email,dateandtime,Graded from ishion_Cms_Comment where ResourceID=" & ID & " order by dateandtime desc")
			If Not (commentRs.EOF And commentRs.BOF) Then
				Do While Not commentRs.EOF
				reval = reval & "              <TR bgColor=#ffffff>" & vbCrLf
				reval = reval & "                <TD width=""80"" align=right noWrap><NOBR><FONT color=red>" & i & "</FONT> 楼</NOBR> <NOBR>[<A " & vbCrLf
				reval = reval & "onclick=""spanComment.style.display=''; comment.content.focus(); comment.content.value='回复 " & i & " 楼(" & commentRs(2) & ")：'; return false;"" href=""javascript:""><FONT color=#3366cc>回复</FONT></A>]</NOBR><BR></TD>" & vbCrLf
				reval = reval & "                <TD style=""WORD-BREAK: break-all; WORD-WRAP: break-word"" align=center width=50><FONT color=green>" & commentRs(2) & "</FONT></TD>" & vbCrLf
				reval = reval & "                <TD style=""WORD-BREAK: break-all; WORD-WRAP: break-word"">" & ishion.cutStr(commentRs(1), 180) & "</TD>" & vbCrLf
				reval = reval & "                <TD noWrap align=middle><A style=""BORDER-BOTTOM: #3399cc 1px dotted"" href=""../comment_Cms.asp?id=" & ID & "#commentID" & commentRs(0) & """><FONT color=#3366cc>" & ishion.FormatMyDate(commentRs(4), "{m}-{d} {h}:{mi}") & "</FONT></A></TD>" & vbCrLf
				reval = reval & "              </TR>" & vbCrLf
				i = i - 1
				commentRs.MoveNext
				Loop
			End If
			Set commentRs = Nothing
		End If
		reval = reval & "              <TR bgcolor=""#FFFFFF"" id=""spanComment"" style=""display:none"">" & vbCrLf
		reval = reval & "                <TD colSpan=4><script language=""javascript"" src=""../js/comment_cms.js""></script>" & vbCrLf
		reval = reval & "               <script language=""javascript"">show_commentForm(" & ID & ")</script>" & vbCrLf
		reval = reval & "               </TD>" & vbCrLf
		reval = reval & "              </TR>" & vbCrLf
		reval = reval & "</TABLE>" & vbCrLf
		comment_Cms = reval
		reval = Null
	End Function

End Class %>

