<!--#include file="conn.asp"-->
<!-- #include file="inc/const.asp" -->
<!--#include file="inc/dv_clsother.asp"-->
<%
Dim YearArray(),TempArray1(),TempArray2(),TempArray3()
Dim YearCount,TempCount1,TempCount2,TempCount3
Dim Jump,JumpSplit
Dim Range1,Range2,Range3,WhereAdd
Dim SumCount,MaxCount1,MaxCount2,MaxCount3
Dim AllBBS
Dim TopicOrReply,DatePartTag,HourPart

If Not Dvbbs.Master Then Response.Redirect "showerr.asp?ErrCodes=<li>您没有查看本论坛统计资料的权限，请<a href=login.asp>登录</a>或者同管理员联系。&action=OtherErr"
Dvbbs.LoadTemplates("")
Dvbbs.Stats="统计资料"
Dvbbs.Nav()
Dvbbs.ShowErr()
If Dvbbs.BoardID>0 Then
	Dvbbs.Head_var 1,"","",""
Else
	Dvbbs.Head_var 2,"",0,0
End If
AllBBS=Split(AllPostTable(),"|")
If IsSqlDataBase = 1 Then
	DatePartTag=""
	TopicOrReply="Case When ParentID>0 Then 'R' Else 'T' End"
	HourPart="hh"
Else
	DatePartTag="'"
	TopicOrReply="IIF(ParentID>0,'R','T')"
	HourPart="h"
End If
call main()
Dvbbs.ActiveOnline()
Dvbbs.Footer()

Sub Main()
	Dim TemplateHTML_1,TemplateHTML_2,TemplateHTML_3
	Dim TempStr,TempStr2,TempDetail,i,YearJumpList
	
	Jump=request("Jump")
	If Jump="" Then Jump="all"
	JumpSplit=Split(Jump,"-")
	If Jump="all" Then
		Range1=""
		Range2="年份"
		Range3="每年"
		WhereAdd="2>1"
	Else
		For i=0 To UBound(JumpSplit)
			If Not IsNumeric(JumpSplit(i)) Then Response.Redirect "showerr.asp?ErrCodes=<li>参数错误。&action=OtherErr"
			JumpSplit(i)=CInt(JumpSplit(i))
		Next
		If UBound(JumpSplit)=0 Then
			Range1=JumpSplit(0)&"年"
			Range2="月份"
			Range3="每月"
			WhereAdd="DatePart("&DatePartTag&"yyyy"&DatePartTag&",DateAndTime)="&JumpSplit(0)
		ElseIf UBound(JumpSplit)=1 Then
			Range1=JumpSplit(0)&"年"&JumpSplit(1)&"月"
			Range2="日期"
			Range3="每日"
			WhereAdd="DatePart("&DatePartTag&"yyyy"&DatePartTag&",DateAndTime)="&JumpSplit(0)&" AND DatePart("&DatePartTag&"m"&DatePartTag&",DateAndTime)="&JumpSplit(1)
		ElseIf UBound(JumpSplit)=2 Then
			Range1=JumpSplit(0)&"年"&JumpSplit(1)&"月"&JumpSplit(2)&"日"
			Range2=""
			Range3=""
			WhereAdd="DatePart("&DatePartTag&"yyyy"&DatePartTag&",DateAndTime)="&JumpSplit(0)&" AND DatePart("&DatePartTag&"m"&DatePartTag&",DateAndTime)="&JumpSplit(1)&" AND DatePart("&DatePartTag&"d"&DatePartTag&",DateAndTime)="&JumpSplit(2)
		Else
			Response.Redirect "showerr.asp?ErrCodes=<li>参数错误。&action=OtherErr"
		End If
	End If
	TemplateHTML_1="<table cellpadding=6 cellspacing=1 align=center class=tableborder1>" & _
		"<form method=POST action=?><tr><td valign=top align=right class=tabletitle2>" & _
		"<select name='boardid' onchange='javascript:JumpMenu()'></select>&nbsp;" & _
		"<select name='Jump' onChange='javascript:JumpMenu()'>{$YearJumpList}</select></td></tr></form></table>"
	TemplateHTML_2="<br><table cellpadding=6 cellspacing=1 align=center class=tableborder1>" & _
		"<tr valign=middle><th colspan=5>--==&lt;{$AnalysisTitle}&gt;==--</th></tr>" & _
		"<tr height=20 align=center><td nowrap class=tablebody2><b>{$AnalysisRange}</b></td><td nowrap class=tablebody2><b>帖子数</b></td><td nowrap class=tablebody2><b>主题数</b></td><td nowrap class=tablebody2><b>回复数</b></td><td nowrap class=tablebody2>&nbsp;</td></tr>" & _
		"{$AnalysisDetail}</table>"
	TemplateHTML_3="<tr height=20 align=center>" & _
		"<td nowrap class=tablebody1>{$DetailRange}</td>" & _
		"<td nowrap class=tablebody1>{$DetailPost}</td>" & _
		"<td nowrap class=tablebody1>{$DetailTopic}</td>" & _
		"<td nowrap class=tablebody1>{$DetailReply}</td>" & _
		"<td align=left class=tablebody1><img src='Skins/Default/bar/bar1.gif' border='0' width='{$DetailTopicWidth}' alt='主题数：{$DetailTopic}' height='11'><img src='Skins/Default/bar/bar2.gif' border='0' width='{$DetailReplyWidth}' alt='回复数：{$DetailReply}' height='11'></td></tr>"
	Response.Write "<script language=javascript>"
	Response.Write "function JumpMenu() {"
	Response.Write "var JumpObj,boardidObj;"
	Response.Write "JumpObj=document.all.Jump;"
	Response.Write "boardidObj=document.all.boardid;"
	Response.Write "location=""?Jump="" + JumpObj.options[JumpObj.selectedIndex].value + ""&boardid="" + boardidObj.options[boardidObj.selectedIndex].value;}"
	Response.Write "</script>"
	Response.Flush()
	Call Done1()
	TempStr=TemplateHTML_1
	YearJumpList="<option value='all'"
	If Jump="all" Then
		YearJumpList=YearJumpList&" selected"
	End If
	YearJumpList=YearJumpList&">合计："&SumCount&"</option>"
	For i=0 To YearCount-1
		YearJumpList=YearJumpList&"<option value='"&YearArray(0,i)&"'"
		If Jump<>"all" then
			If CInt(JumpSplit(0))=YearArray(0,i) Then
				YearJumpList=YearJumpList&" selected"
			End If
		End If
		YearJumpList=YearJumpList&">"&YearArray(0,i)&"："&YearArray(1,i)&"</option>"
	Next
	TempStr=Replace(TempStr,"{$YearJumpList}",YearJumpList)
	Response.Write TempStr
	Response.Flush()
	If UBound(JumpSplit)<2 Then
		TempStr=TemplateHTML_2
		TempStr=Replace(TempStr,"{$AnalysisTitle}",Range1&Range3&"发表的帖子数")
		TempStr=Replace(TempStr,"{$AnalysisRange}",Range2)
		TempDetail=""
		For i=0 To TempCount1-1
			TempStr2=TemplateHTML_3
			TempStr2=Replace(TempStr2,"{$DetailRange}","<a href='?Jump="&TempArray1(0,i)&"&boardid="&Dvbbs.BoardID&"'><u>"&TempArray1(0,i)&"</u></a>")
			TempStr2=Replace(TempStr2,"{$DetailPost}",CStr(TempArray1(1,i)+TempArray1(2,i)))
			TempStr2=Replace(TempStr2,"{$DetailTopic}",CStr(TempArray1(1,i)))
			TempStr2=Replace(TempStr2,"{$DetailReply}",CStr(TempArray1(2,i)))
			TempStr2=Replace(TempStr2,"{$DetailTopicWidth}",CStr(400*TempArray1(1,i)\MaxCount1))
			TempStr2=Replace(TempStr2,"{$DetailReplyWidth}",CStr(400*TempArray1(2,i)\MaxCount1))
			TempDetail=TempDetail&TempStr2
		Next
		TempStr=Replace(TempStr,"{$AnalysisDetail}",TempDetail)
		Response.Write TempStr
		Response.Flush()
		Call Done2()
		TempStr=TemplateHTML_2
		TempStr=Replace(TempStr,"{$AnalysisTitle}",Range1&"每周发表的帖子数")
		TempStr=Replace(TempStr,"{$AnalysisRange}","星期")
		TempDetail=""
		For i=0 To TempCount2-1
			TempStr2=TemplateHTML_3
			TempStr2=Replace(TempStr2,"{$DetailRange}",TempArray2(0,i))
			TempStr2=Replace(TempStr2,"{$DetailPost}",CStr(TempArray2(1,i)+TempArray2(2,i)))
			TempStr2=Replace(TempStr2,"{$DetailTopic}",CStr(TempArray2(1,i)))
			TempStr2=Replace(TempStr2,"{$DetailReply}",CStr(TempArray2(2,i)))
			TempStr2=Replace(TempStr2,"{$DetailTopicWidth}",CStr(400*TempArray2(1,i)\MaxCount2))
			TempStr2=Replace(TempStr2,"{$DetailReplyWidth}",CStr(400*TempArray2(2,i)\MaxCount2))
			TempDetail=TempDetail&TempStr2
		Next
		TempStr=Replace(TempStr,"{$AnalysisDetail}",TempDetail)
		Response.Write TempStr
		Response.Flush()
	End If
	Call Done3()
	TempStr=TemplateHTML_2
	TempStr=Replace(TempStr,"{$AnalysisTitle}",Range1&"每小时发表的帖子数")
	TempStr=Replace(TempStr,"{$AnalysisRange}","小时")
	TempDetail=""
	For i=0 To TempCount3-1
		TempStr2=TemplateHTML_3
		TempStr2=Replace(TempStr2,"{$DetailRange}",TempArray3(0,i))
		TempStr2=Replace(TempStr2,"{$DetailPost}",CStr(TempArray3(1,i)+TempArray3(2,i)))
		TempStr2=Replace(TempStr2,"{$DetailTopic}",CStr(TempArray3(1,i)))
		TempStr2=Replace(TempStr2,"{$DetailReply}",CStr(TempArray3(2,i)))
		TempStr2=Replace(TempStr2,"{$DetailTopicWidth}",CStr(400*TempArray3(1,i)\MaxCount3))
		TempStr2=Replace(TempStr2,"{$DetailReplyWidth}",CStr(400*TempArray3(2,i)\MaxCount3))
		TempDetail=TempDetail&TempStr2
	Next
	TempStr=Replace(TempStr,"{$AnalysisDetail}",TempDetail)
	Response.Write TempStr
	response.write "<script>"
	response.write "BoardJumpListSelect(" & Dvbbs.BoardID & ",""boardid"",""所有版面"","""",0);"
	response.write "</script>"

End Sub

Sub Done1()
	Dim TempValue,LastValue,CurValue,Rs,SQL,i
	
	If Jump="all" Then
		SQL=""
		For i=0 To UBound(AllBBS)
			If SQL<>"" Then SQL=SQL&" UNION ALL "
			If Dvbbs.BoardID=0 Then
				SQL=SQL&"SELECT DatePart("&DatePartTag&"yyyy"&DatePartTag&",DateAndTime) AS T_Year,"&TopicOrReply&" AS T_Type,COUNT(*) AS T_Count FROM "&AllBBS(i)&" GROUP BY DatePart("&DatePartTag&"yyyy"&DatePartTag&",DateAndTime),"&TopicOrReply&""
			Else
				SQL=SQL&"SELECT DatePart("&DatePartTag&"yyyy"&DatePartTag&",DateAndTime) AS T_Year,"&TopicOrReply&" AS T_Type,COUNT(*) AS T_Count FROM "&AllBBS(i)&" WHERE BoardID in (select boardid from Dv_Board where boardid="&Dvbbs.BoardID&" or parentstr='"&Dvbbs.BoardID&"' OR ParentStr Like '"&Dvbbs.BoardID&",%') GROUP BY DatePart("&DatePartTag&"yyyy"&DatePartTag&",DateAndTime),"&TopicOrReply&""
			End If
		Next
		SQL=SQL&" ORDER BY 1,2 DESC"
		YearCount=0
		SumCount=0
	Else
		SQL=""
		For i=0 To UBound(AllBBS)
			If SQL<>"" Then SQL=SQL&" UNION ALL "
			If Dvbbs.BoardID=0 Then
				SQL=SQL&"SELECT DatePart("&DatePartTag&"yyyy"&DatePartTag&",DateAndTime) AS T_Year,COUNT(*) AS T_Count FROM "&AllBBS(i)&" GROUP BY DatePart("&DatePartTag&"yyyy"&DatePartTag&",DateAndTime)"
			Else
				SQL=SQL&"SELECT DatePart("&DatePartTag&"yyyy"&DatePartTag&",DateAndTime) AS T_Year,COUNT(*) AS T_Count FROM "&AllBBS(i)&" WHERE BoardID in (select boardid From Dv_Board where boardid="&Dvbbs.BoardID&" or parentstr='"&Dvbbs.BoardID&"' OR ParentStr Like '"&Dvbbs.BoardID&",%') GROUP BY DatePart("&DatePartTag&"yyyy"&DatePartTag&",DateAndTime)"
			End If
		Next
		SQL=SQL&" ORDER BY 1"
		Set rs=Dvbbs.Execute(SQL)
		YearCount=0
		SumCount=0
		LastValue=0
		Do While not (rs.Eof or rs.bof)
			CurValue=rs(0)
			If CurValue<>LastValue Then
				ReDim Preserve YearArray(1,YearCount)
				YearArray(0,YearCount)=CurValue
				YearArray(1,YearCount)=0
				YearCount=YearCount+1
				LastValue=CurValue
			End If
			YearArray(1,YearCount-1)=YearArray(1,YearCount-1)+rs(1)
			SumCount=SumCount+rs(1)
			rs.MoveNext
		Loop
		rs.close
		If UBound(JumpSplit)=0 Then
			SQL=""
			For i=0 To UBound(AllBBS)
				If SQL<>"" Then SQL=SQL&" UNION ALL "
				If Dvbbs.BoardID=0 Then
					SQL=SQL&"SELECT DatePart("&DatePartTag&"m"&DatePartTag&",DateAndTime) AS T_Month,"&TopicOrReply&" AS T_Type,COUNT(*) AS T_Count FROM "&AllBBS(i)&" Where "&WhereAdd&" GROUP BY DatePart("&DatePartTag&"m"&DatePartTag&",DateAndTime),"&TopicOrReply&""
				Else
					SQL=SQL&"SELECT DatePart("&DatePartTag&"m"&DatePartTag&",DateAndTime) AS T_Month,"&TopicOrReply&" AS T_Type,COUNT(*) AS T_Count FROM "&AllBBS(i)&" WHERE BoardID in (select boardid From Dv_Board where boardid="&Dvbbs.BoardID&" or parentstr='"&Dvbbs.BoardID&"' OR ParentStr Like '"&Dvbbs.BoardID&",%') AND "&WhereAdd&" GROUP BY DatePart("&DatePartTag&"m"&DatePartTag&",DateAndTime),"&TopicOrReply&""
				End If
			Next
			SQL=SQL&" ORDER BY 1,2 Desc"
		ElseIf UBound(JumpSplit)=1 Then
			SQL=""
			For i=0 To UBound(AllBBS)
				If SQL<>"" Then SQL=SQL&" UNION ALL "
				If Dvbbs.BoardID=0 Then
					SQL=SQL&"SELECT DatePart("&DatePartTag&"d"&DatePartTag&",DateAndTime) AS T_Day,"&TopicOrReply&" AS T_Type,COUNT(*) AS T_Count FROM "&AllBBS(i)&" Where "&WhereAdd&" GROUP BY DatePart("&DatePartTag&"d"&DatePartTag&",DateAndTime),"&TopicOrReply&""
				Else
					SQL=SQL&"SELECT DatePart("&DatePartTag&"d"&DatePartTag&",DateAndTime) AS T_Day,"&TopicOrReply&" AS T_Type,COUNT(*) AS T_Count FROM "&AllBBS(i)&" WHERE BoardID in (select boardid From Dv_Board where boardid="&Dvbbs.BoardID&" or parentstr='"&Dvbbs.BoardID&"' OR ParentStr Like '"&Dvbbs.BoardID&",%') AND "&WhereAdd&" GROUP BY DatePart("&DatePartTag&"d"&DatePartTag&",DateAndTime),"&TopicOrReply&""
				End If
			Next
			SQL=SQL&" ORDER BY 1,2 Desc"
		ElseIf UBound(JumpSplit)=2 Then
		End If
	End If
	If UBound(JumpSplit)<2 Then
		Set rs=Dvbbs.Execute(SQL)
		TempCount1=0
		MaxCount1=0
		LastValue=0
		Do While not (rs.Eof or rs.bof)
			CurValue=rs(0)
			If CurValue<>LastValue Then
				ReDim Preserve TempArray1(2,TempCount1)
				If Jump="all" Then
					TempArray1(0,TempCount1)=CurValue
				Else
					TempArray1(0,TempCount1)=JumpSplit(0)&"-"
					If UBound(JumpSplit)>1 Then
					ElseIf UBound(JumpSplit)>0 Then
						TempArray1(0,TempCount1)=TempArray1(0,TempCount1)&JumpSplit(1)&"-"&CurValue
					Else
						TempArray1(0,TempCount1)=TempArray1(0,TempCount1)&CurValue
					End If
				End If
				TempArray1(1,TempCount1)=0
				TempArray1(2,TempCount1)=0
				If Jump="all" then
					ReDim Preserve YearArray(1,YearCount)
					YearArray(0,YearCount)=CurValue
					YearArray(1,YearCount)=0
					YearCount=YearCount+1
				End If
				LastValue=CurValue
				TempCount1=TempCount1+1
			End If
			If rs(1)="T" Then
				TempArray1(1,TempCount1-1)=TempArray1(1,TempCount1-1)+rs(2)
			Else
				TempArray1(2,TempCount1-1)=TempArray1(2,TempCount1-1)+rs(2)
			End If
			If TempArray1(1,TempCount1-1)+TempArray1(2,TempCount1-1)>MaxCount1 Then MaxCount1=TempArray1(1,TempCount1-1)+TempArray1(2,TempCount1-1)
			If Jump="all" then
				YearArray(1,YearCount-1)=YearArray(1,YearCount-1)+rs(2)
				SumCount=SumCount+rs(2)
			End If
			rs.MoveNext
		Loop
		rs.close
	End If
	Set rs=nothing
End Sub

Sub Done2()
	Dim TempValue,LastValue,CurValue,Rs,SQL,i
	
	If Jump="all" Then
		SQL=""
		For i=0 To UBound(AllBBS)
			If SQL<>"" Then SQL=SQL&" UNION ALL "
			If Dvbbs.BoardID=0 Then
				SQL=SQL&"SELECT DatePart("&DatePartTag&"w"&DatePartTag&",DateAndTime) AS T_WeekDay,"&TopicOrReply&" AS T_Type,COUNT(*) AS T_Count FROM "&AllBBS(i)&" GROUP BY DatePart("&DatePartTag&"w"&DatePartTag&",DateAndTime),"&TopicOrReply&""
			Else
				SQL=SQL&"SELECT DatePart("&DatePartTag&"w"&DatePartTag&",DateAndTime) AS T_WeekDay,"&TopicOrReply&" AS T_Type,COUNT(*) AS T_Count FROM "&AllBBS(i)&" WHERE BoardID in (select boardid From Dv_Board where boardid="&Dvbbs.BoardID&" or parentstr='"&Dvbbs.BoardID&"' OR ParentStr Like '"&Dvbbs.BoardID&",%') GROUP BY DatePart("&DatePartTag&"w"&DatePartTag&",DateAndTime),"&TopicOrReply&""
			End If
		Next
		SQL=SQL&" ORDER BY 1,2 Desc"
	Else
		If UBound(JumpSplit)<2 Then
			SQL=""
			For i=0 To UBound(AllBBS)
				If SQL<>"" Then SQL=SQL&" UNION ALL "
				If Dvbbs.BoardID=0 Then
					SQL=SQL&"SELECT DatePart("&DatePartTag&"w"&DatePartTag&",DateAndTime) AS T_WeekDay,"&TopicOrReply&" AS T_Type,COUNT(*) AS T_Count FROM "&AllBBS(i)&" Where "&WhereAdd&" GROUP BY DatePart("&DatePartTag&"w"&DatePartTag&",DateAndTime),"&TopicOrReply&""
				Else
					SQL=SQL&"SELECT DatePart("&DatePartTag&"w"&DatePartTag&",DateAndTime) AS T_WeekDay,"&TopicOrReply&" AS T_Type,COUNT(*) AS T_Count FROM "&AllBBS(i)&" WHERE BoardID in (select boardid From Dv_Board where boardid="&Dvbbs.BoardID&" or parentstr='"&Dvbbs.BoardID&"' OR ParentStr Like '"&Dvbbs.BoardID&",%') AND "&WhereAdd&" GROUP BY DatePart("&DatePartTag&"w"&DatePartTag&",DateAndTime),"&TopicOrReply&""
				End If
			Next
			SQL=SQL&" ORDER BY 1,2 Desc"
		End If
	End If
	If UBound(JumpSplit)<2 Then
		Set rs=Dvbbs.Execute(SQL)
		TempCount2=0
		MaxCount2=0
		LastValue=""
		Do While not (rs.Eof or rs.bof)
			CurValue=GetWeekDay(rs(0))
			If CurValue<>LastValue Then
				ReDim Preserve TempArray2(2,TempCount2)
				TempArray2(0,TempCount2)=CurValue
				TempArray2(1,TempCount2)=0
				TempArray2(2,TempCount2)=0
				LastValue=CurValue
				TempCount2=TempCount2+1
			End If
			If rs(1)="T" Then
				TempArray2(1,TempCount2-1)=TempArray2(1,TempCount2-1)+rs(2)
			Else
				TempArray2(2,TempCount2-1)=TempArray2(2,TempCount2-1)+rs(2)
			End If
			If TempArray2(1,TempCount2-1)+TempArray2(2,TempCount2-1)>MaxCount2 Then MaxCount2=TempArray2(1,TempCount2-1)+TempArray2(2,TempCount2-1)
			rs.MoveNext
		Loop
		rs.close
	End If
	Set rs=nothing
End Sub

Sub Done3()
	Dim TempValue,LastValue,CurValue,Rs,SQL,i
	
	If Jump="all" Then
		SQL=""
		For i=0 To UBound(AllBBS)
			If SQL<>"" Then SQL=SQL&" UNION ALL "
			If Dvbbs.BoardID=0 Then
				SQL=SQL&"SELECT DatePart("&DatePartTag&HourPart&DatePartTag&",DateAndTime) AS T_Hour,"&TopicOrReply&" AS T_Type,COUNT(*) AS T_Count FROM "&AllBBS(i)&" GROUP BY DatePart("&DatePartTag&HourPart&DatePartTag&",DateAndTime),"&TopicOrReply&""
			Else
				SQL=SQL&"SELECT DatePart("&DatePartTag&HourPart&DatePartTag&",DateAndTime) AS T_Hour,"&TopicOrReply&" AS T_Type,COUNT(*) AS T_Count FROM "&AllBBS(i)&" WHERE BoardID in (select boardid From Dv_Board where boardid="&Dvbbs.BoardID&" or parentstr='"&Dvbbs.BoardID&"' OR ParentStr Like '"&Dvbbs.BoardID&",%') GROUP BY DatePart("&DatePartTag&HourPart&DatePartTag&",DateAndTime),"&TopicOrReply&""
			End If
		Next
		SQL=SQL&" ORDER BY 1,2 Desc"
	Else
		For i=0 To UBound(AllBBS)
			If SQL<>"" Then SQL=SQL&" UNION ALL "
			If Dvbbs.BoardID=0 Then
				SQL=SQL&"SELECT DatePart("&DatePartTag&HourPart&DatePartTag&",DateAndTime) AS T_Hour,"&TopicOrReply&" AS T_Type,COUNT(*) AS T_Count FROM "&AllBBS(i)&" Where "&WhereAdd&" GROUP BY DatePart("&DatePartTag&HourPart&DatePartTag&",DateAndTime),"&TopicOrReply&""
			Else
				SQL=SQL&"SELECT DatePart("&DatePartTag&HourPart&DatePartTag&",DateAndTime) AS T_Hour,"&TopicOrReply&" AS T_Type,COUNT(*) AS T_Count FROM "&AllBBS(i)&" WHERE BoardID in (select boardid From Dv_Board where boardid="&Dvbbs.BoardID&" or parentstr='"&Dvbbs.BoardID&"' OR ParentStr Like '"&Dvbbs.BoardID&",%') AND "&WhereAdd&" GROUP BY DatePart("&DatePartTag&HourPart&DatePartTag&",DateAndTime),"&TopicOrReply&""
			End If
		Next
		SQL=SQL&" ORDER BY 1,2 Desc"
	End If
	Set rs=Dvbbs.Execute(SQL)
	TempCount3=0
	MaxCount3=0
	LastValue=""
	Do While not (rs.Eof or rs.bof)
		CurValue=Right("00"&rs(0),2)&":00 - "&Right("00"&(rs(0)+1),2)&":00"
		If CurValue<>LastValue Then
			ReDim Preserve TempArray3(2,TempCount3)
			TempArray3(0,TempCount3)=CurValue
			TempArray3(1,TempCount3)=0
			TempArray3(2,TempCount3)=0
			LastValue=CurValue
			TempCount3=TempCount3+1
		End If
		If rs(1)="T" Then
			TempArray3(1,TempCount3-1)=TempArray3(1,TempCount3-1)+rs(2)
		Else
			TempArray3(2,TempCount3-1)=TempArray3(2,TempCount3-1)+rs(2)
		End If
		If TempArray3(1,TempCount3-1)+TempArray3(2,TempCount3-1)>MaxCount3 Then MaxCount3=TempArray3(1,TempCount3-1)+TempArray3(2,TempCount3-1)
		rs.MoveNext
	Loop
	rs.close
	Set rs=nothing
End Sub

Function GetWeekDay(CurWeekDay)
	select case CurWeekDay
	case 1
		GetWeekDay="星期日"
	case 2
		GetWeekDay="星期一"
	case 3
		GetWeekDay="星期二"
	case 4
		GetWeekDay="星期三"
	case 5
		GetWeekDay="星期四"
	case 6
		GetWeekDay="星期五"
	case 7
		GetWeekDay="星期六"
	End select
End Function

Function AllPostTable()
	Dim Trs
	Set Trs=Dvbbs.Execute("select * from [Dv_TableList]")
	AllPostTable=""
	Do While Not TRs.EOF
		If AllPostTable=""  Then 
			AllPostTable=TRs("TableName")
		Else
			AllPostTable=AllPostTable&"|"&TRs("TableName")
		End If
		TRs.MoveNext
	Loop 
	Trs.Close 
End Function 
%>
