<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp"-->
<%
Dim Rs, SQL, stype, i, DownloadClass_Ads, ii
Dim Style_CSS, HtmlTempStr, NowStats, HtmlTitle
Dim SoftTypeSrt, SoftSize, SoftTime, SoftName, SortName
Dim CurrentPage, totalnumber, maxperpage, tempPcount, bookmark
Dim SoftImg, isCommend, SoftReadme, showpage
Set DownloadClass_Ads = New Adcolumn_Cls
Set Rs = Server.CreateObject("ADODB.Recordset")
If Not IsEmpty(Request.Querystring("page")) Then
	CurrentPage = CInt(Request.Querystring("page"))
Else
	CurrentPage = 1
End If
DownsysClass.LoadTemplates ("")
Style_CSS = Replace(Replace(DownsysClass.Style_CSS, "{$SetupDir}", DownsysClass.SetupDir), "{$PicUrl}", DownsysClass.TempDir)
HtmlTempStr = DownsysClass.mainhtml(0) & DownsysClass.mainhtml(1) & DownsysClass.mainhtml(2) & DownsysClass.mainhtml(3)
HtmlTempStr = Replace(HtmlTempStr, "{$NavMenu}", DownsysClass.SortingMenu)
HtmlTempStr = Replace(HtmlTempStr, "{$Style_CSS}", Style_CSS)
maxperpage = CInt(DownsysClass.mainset(31))
SQL = "select top " & CInt(DownsysClass.mainset(30)) & " * from NC_softinfo where isLock=0 and iscommend=1 or softimg<>'' order by softTime desc,SoftID desc"
Rs.Open SQL, Conn, 1, 1
If Not (Rs.EOF And Rs.bof) Then
	totalnumber = Rs.recordcount

	If (totalnumber Mod maxperpage) = 0 Then
		tempPcount = totalnumber \ maxperpage
	Else
		tempPcount = totalnumber \ maxperpage + 1
	End If

	Rs.MoveFiRst
	If CurrentPage > tempPcount Then CurrentPage = tempPcount
	If CurrentPage < 1 Then CurrentPage = 1
	Rs.Move (CurrentPage - 1) * maxperpage
	bookmark = Rs.bookmark
	i = 0
	HtmlTempStr = HtmlTempStr & DownsysClass.mainhtml(11)
	Do While Not Rs.EOF And i < CLng(maxperpage)
		HtmlTempStr = HtmlTempStr & DownsysClass.mainhtml(12)
		If Not IsNull(Rs("softimg")) And Rs("softimg") <> "" Then
			SoftImg = "<img src=""" & Rs("softimg") & """  width='" & DownsysClass.mainset(41) & "'  height='" & DownsysClass.mainset(42) & "' border=0>" & vbCrLf
		Else
			SoftImg = "<img src=""" & DownsysClass.SetupDir & "images/NoPic.jpg""  width='" & DownsysClass.mainset(41) & "'  height='" & DownsysClass.mainset(42) & "' border=0>" & vbCrLf
		End If
		If Rs("isCommend") = 1 Then
			isCommend = "<font color=red>推荐</font>"
		Else
			isCommend = " "
		End If
		If Rs("SoftSize") > 1024 Then
			SoftSize = Round(Rs("SoftSize") / 1024, 2) & " MB"
		Else
			SoftSize = Rs("SoftSize") & " KB "
		End If
		If Rs("SoftTime") >= Date Then
			SoftTime = "<FONT color=red>" & FormatDateTime(Rs("SoftTime"), 2) & "</FONT >"
		Else
			SoftTime = FormatDateTime(Rs("SoftTime"), 2)
		End If
		SoftName = "<a href='" & DownsysClass.SetupDir & "Software.Asp?id=" & Rs("softid") & "'>" & Rs("SoftName") & Rs("SoftVer") & "</A> "
		SoftReadme = DownsysClass.CutString(Rs("Content"), CInt(DownsysClass.mainset(32)))
		HtmlTempStr = Replace(HtmlTempStr, "{$Grades}", Rs("Grades"))
		HtmlTempStr = Replace(HtmlTempStr, "{$SoftSize}", SoftSize)
		HtmlTempStr = Replace(HtmlTempStr, "{$SoftName}", SoftName)
		HtmlTempStr = Replace(HtmlTempStr, "{$SoftTime}", SoftTime)
		HtmlTempStr = Replace(HtmlTempStr, "{$Commend}", isCommend)
		HtmlTempStr = Replace(HtmlTempStr, "{$SoftReadme}", SoftReadme)
		HtmlTempStr = Replace(HtmlTempStr, "{$SoftPic}", SoftImg)
		HtmlTempStr = Replace(HtmlTempStr, "{$Hits}", Rs("Hits"))
		HtmlTempStr = Replace(HtmlTempStr, "{$RunSystem}", Rs("RunSystem"))
		HtmlTempStr = Replace(HtmlTempStr, "{$Impower}", Rs("impower"))
		Rs.movenext
		i = i + 1
		If i >= maxperpage Then Exit Do
	Loop
End If
Rs.Close
showpage = AspShowPage(maxperpage, totalnumber, CurrentPage)
HtmlTempStr = HtmlTempStr & DownsysClass.mainhtml(13)
HtmlTempStr = Replace(HtmlTempStr, "{$ShowPage}", showpage)
HtmlTempStr = HtmlTempStr & DownsysClass.mainhtml(4)
HtmlTempStr = Replace(HtmlTempStr, "{$TopMeun}", DownsysClass.mainset(10))
HtmlTempStr = Replace(HtmlTempStr, "{$NowStats}", "推荐软件")
HtmlTempStr = Replace(HtmlTempStr, "{$Title}", "推荐软件")
HtmlTempStr = Replace(HtmlTempStr, "{$Width}", DownsysClass.mainset(0))
HtmlTempStr = Replace(HtmlTempStr, "{$FootMeun}", DownsysClass.mainset(11))
HtmlTempStr = Replace(HtmlTempStr, "{$Adcolumn(0)}", DownloadClass_Ads.RunScriptAds(7))
HtmlTempStr = Replace(HtmlTempStr, "{$Adcolumn(1)}", DownloadClass_Ads.BannerAds(7))
HtmlTempStr = Replace(HtmlTempStr, "{$Adcolumn(2)}", DownloadClass_Ads.AdsColumn(7, 2))
HtmlTempStr = Replace(HtmlTempStr, "{$Adcolumn(3)}", DownloadClass_Ads.AdsColumn(7, 3))
HtmlTempStr = Replace(HtmlTempStr, "{$Adcolumn(6)}", DownloadClass_Ads.AdsColumn(7, 7))
HtmlTempStr = Replace(HtmlTempStr, "{$Adcolumn(4)}", DownloadClass_Ads.ScriptFloatAds(7))
HtmlTempStr = Replace(HtmlTempStr, "{$Adcolumn(5)}", DownloadClass_Ads.ScriptFixedAds(7))
Set Rs = Nothing
Response.Write HtmlTempStr

Private Function AspShowPage(maxperpage, totalnumber, CurrentPage)
	Dim n, HtmlString
	If totalnumber Mod maxperpage = 0 Then
		n = totalnumber \ maxperpage
	Else
		n = totalnumber \ maxperpage + 1
	End If
	HtmlString = HtmlString & "<table cellspacing=1 width='100%' border=0><form method=Post onChange=""submit()""><tr><td align=center> " & vbCrLf
	HtmlString = HtmlString & "<font color='red'>推荐软件</font> " & vbCrLf
	If CurrentPage < 2 Then
		HtmlString = HtmlString & "" & totalnumber & "个&nbsp;&nbsp;首 页&nbsp;&nbsp;上一页&nbsp;&nbsp;"
	Else
		HtmlString = HtmlString & "" & totalnumber & "个&nbsp;&nbsp;<a href=?page=1>首 页</a>&nbsp;&nbsp;"
		HtmlString = HtmlString & "<a href=?page=" & CurrentPage - 1 & ">上一页</a>&nbsp;&nbsp;"
	End If

	If n - CurrentPage < 1 Then
		HtmlString = HtmlString & "下一页&nbsp;&nbsp;尾 页 " & vbCrLf
	Else
		HtmlString = HtmlString & "<a href=?page=" & (CurrentPage + 1) & ">下一页</a>"
		HtmlString = HtmlString & "&nbsp;&nbsp;<a href=?page=" & n & ">尾 页</a>" & vbCrLf
	End If
	HtmlString = HtmlString & "&nbsp;页次：<strong><font color=red>" & CurrentPage & "</font>/" & n & "</strong>页"
	HtmlString = HtmlString & "&nbsp;<b>" & maxperpage & "</b>个/页" & vbCrLf
	HtmlString = HtmlString & "&nbsp;转到："
	HtmlString = HtmlString & "<select name='page' size='1' style=""font-size: 9pt"" onChange='javascript:window.open(this.options[this.selectedIndex].value,""_top"")'>" & vbCrLf
	For ii = 1 To n
		HtmlString = HtmlString & "&nbsp;<option value='?page=" & ii & "' "
		If CurrentPage = CInt(ii) Then
			HtmlString = HtmlString & "selected "
		End If
		HtmlString = HtmlString & ">第" & ii & "页</option>"
	Next
	HtmlString = HtmlString & "&nbsp;</select> " & vbCrLf
	HtmlString = HtmlString & "</td></tr></FORM></table>" & vbCrLf
	AspShowPage = HtmlString
End Function

Set DownloadClass_Ads = Nothing
CloseConn
%>
