<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp"-->
<!--#include file="inc/dv_clsother.asp"-->
<!--#include file="inc/dv_ubbcode.asp"-->
<!--#include file="inc/ubblist.asp"-->
<%
Dvbbs.LoadTemplates("dispbbs")
Dim AnnounceID,ReplyID,Star,Skin,followup
Dim CanReply,IsTop,IsVote,TopicCount,PollID,TotaluseTable,ViewNum,Topic,TopicMode
Dim PostBuyUser,abgcolor,bgcolor,UserName
Chk_Topic_Err
Dvbbs.Showerr()
Dvbbs.Nav()
Dvbbs.Showerr()
Dvbbs.Head_var 1,Dvbbs.Board_Data(4,0),"",""
GetBoardPermission
Dvbbs.ActiveOnline()
Dim Page
Dim action
Dim TopicNum,n,SplitPageNum
Dim EmotPath
EmotPath=Split(Dvbbs.Forum_emot,"|||")(0)		'emÐÄÇéÂ·¾¶
action=Request("action")
Page=Request("Page")
If isNumeric(Page) = 0 or Page="" Then Page=1
Page=Clng(Page)
Show_Topic_Top()
Dvbbs.ShowErr()
Dim dv_ubb
Set dv_ubb=new Dvbbs_UbbCode
Show_Topic_Body
Set dv_ubb=Nothing
If Skin=1 Then showtree()
If CanReply Then Show_Topic_FastRe
If Dvbbs.UserID>0 Then Show_Topic_ManageAction
Dvbbs.NewPassword()
Dvbbs.Footer()

Function Chk_Topic_Err
	AnnounceID=Request("ID")
	If AnnounceID="" Or Not IsNumeric(AnnounceID) Then Dvbbs.AddErrCode(30)
	ReplyID=Request("ReplyID")
	If ReplyID="" Or Not IsNumeric(ReplyID) Then ReplyID=AnnounceID
	Star=Request("Star")
	If Star="" Or Not IsNumeric(Star) Then Star=1
	Star=Clng(Star)
	Skin=Request("Skin")
	If Skin="" Or Not IsNumeric(Skin) Then Skin=Dvbbs.Board_setting(24)
	If Dvbbs.ErrCodes<>"" Then Exit Function
	'Dvbbs.Execute("update dv_topic set hits=hits+1 where topicid="&Announceid)
	Dim SQl,Rs
	Dim LockTopic,MyCanReply
	Set Rs=Server.CreateObject("Adodb.RecordSet")
	SQL="Select title,istop,isbest,PostUserName,PostUserid,hits,isvote,child,pollid,LockTopic,PostTable,BoardID,TopicMode from dv_topic where topicID="&Announceid
	If Not IsObject(Conn) Then ConnectionDatabase
	Rs.Open SQL,Conn,1,3
	Dvbbs.SqlQueryNum=Dvbbs.SqlQueryNum+1
	'Set Rs=Dvbbs.Execute(SQL)
	If Not(Rs.BOF and Rs.EOF) then
		If Rs(11)<>Dvbbs.BoardID Then Dvbbs.AddErrCode(29)
		Rs(5)=Rs(5)+1
		Rs.Update
		Topic=Rs(0)
		istop=rs(1)
		isVote=rs(6)
		TopicCount=rs(7)+1
		pollid=rs(8)
		Locktopic=rs(9)
		TotalUseTable=rs(10)
		TopicMode=rs(12)
		ViewNum=Rs(5)+1
		If rs(3)=Dvbbs.Membername then
			'Call readRe()
			MyCanReply=Dvbbs.GroupSetting(4)
		Else
			MyCanReply=Dvbbs.GroupSetting(5)
			If CInt(Dvbbs.GroupSetting(0))=0  Then Dvbbs.GroupSetting(2)=0 
			If Cint(Dvbbs.GroupSetting(2))=0 Then Dvbbs.AddErrcode(31)
		End If
		If Len(Topic) > Cint(Dvbbs.Board_Setting(25)) And Not TopicMode>0 Then
			Topic=Left(Topic,Dvbbs.Board_Setting(25))&"..."
		End If
		If TopicMode>0 Then
			If TopicMode=1 Then
				Topic = Replace(Topic,"<!--","&lt;!--")
				If InStr(Topic,"script") >0 Or InStr(Topic,"&#")>0 Then Topic=Server.htmlencode(Topic)			
			Else
				Topic=Dvbbs_TopicMode(Server.htmlencode(Topic),TopicMode)
			End If
		Else
			Topic=Server.HtmlEncode(Topic)
		End If
		Dvbbs.Stats=Topic
	Else
		Dvbbs.AddErrcode(32)
	End If
	Rs.Close
	Set Rs=Nothing
	CanReply=False
	If ((Not Cint(Dvbbs.Board_Setting(0))=1) And Cint(mycanreply)=1 And Cint(locktopic)=0) Or (Dvbbs.master Or Dvbbs.superboardmaster Or Dvbbs.boardmaster) Then
		CanReply=True
	End If
End Function

Function Show_Topic_Top()
	 
	Dim TempStr,MyTempStr
	If (Dvbbs.Board_Setting(43)="0" And Dvbbs.Board_Setting(0)="0") Or (Dvbbs.Board_Setting(43)="0" And Dvbbs.Board_Setting(0)="1" And (Dvbbs.Master Or Dvbbs.SuperBoardMaster Or Dvbbs.BoardMaster)) Then
		MyTempStr=Split(template.html(1),"||")
		TempStr=Replace(MyTempStr(0),"{$pic_newpost}",Dvbbs.mainpic(7))
		TempStr=Replace(TempStr,"{$pic_newvote}",Dvbbs.mainpic(8))
		If Dvbbs.Forum_ChanSetting(0)=1 And Dvbbs.Forum_ChanSetting(7)=1 Then
			TempStr=TempStr & MyTempStr(1)
		End If
	Else
		If Dvbbs.Board_Setting(0)="1" Then TempStr=template.Strings(0)
	End If
	TempStr=Replace(template.html(0),"{$topicpostinfo}",TempStr)
	TempStr=Replace(TempStr,"{$width}",Dvbbs.mainsetting(0))
	TempStr=Replace(TempStr,"{$boardid}",Dvbbs.BoardID)
	TempStr=Replace(TempStr,"{$page}",page)
	TempStr=Replace(TempStr,"{$replyid}",ReplyID)
	TempStr=Replace(TempStr,"{$star}",Star)
	TempStr=Replace(TempStr,"{$announceid}",AnnounceID)
	TempStr=Replace(TempStr,"{$viewnum}",ViewNum)
	Dim Skinpic,Skinname,nskin
	If Skin="1" Then
		nskin=0
		Skinpic=template.pic(1)
		Skinname=template.Strings(2)
	Else
		nskin=1
		Skinpic=template.pic(0)
		Skinname=template.Strings(1)
	End If
	TempStr=Replace(TempStr,"{$skin}",nskin)
	TempStr=Replace(TempStr,"{$skinname}",skinname)
	TempStr=Replace(TempStr,"{$skinpic}",skinpic)
	TempStr=Replace(TempStr,"{$topic}",Topic)
	If IsVote=1 Then
		TempStr=Replace(TempStr,"{$voteinfo}",Show_Topic_Vote)
	Else
		TempStr=Replace(TempStr,"{$voteinfo}","")
	End If
	Response.Write TempStr
End Function

Function Show_Topic_Body()
	Dim SQL,Rs,i
	Dim TopicPageList,Pcount
	Dim layer
	TopicPageList=Dvbbs.Board_Setting(27)
	Response.Write "<Script Language=JavaScript>"
	Response.Write  template.html(4)
	Response.Write  "var TempStr='"&Replace(Replace(Replace(Replace(Replace(template.html(2),"\","\\"),"'","\'"),VbCrLf,"\n"),chr(13),""),"{$boardtype}",Dvbbs.Board_Data(1,0))&"';"
	Response.Write  "var sTempStr='"&Replace(Replace(Replace(Replace(template.html(3),"\","\\"),"'","\'"),VbCrLf,"\n"),chr(13),"")&"';"
	Response.Write  "sTempStr=sTempStr.split(""||"");"
	Response.Write  "var alertcolor='"&Dvbbs.mainsetting(1)&"';"
	Response.Write  "var Board_Setting27='"&TopicPageList&"';"
	Response.Write  "var fontsize='"&Dvbbs.Board_Setting(28)&"';"
	Response.Write  "var lineheight='"&Dvbbs.Board_Setting(29)&"';"
	Response.Write  "var Forum_Setting42='"&Dvbbs.Forum_Setting(42)&"';"
	Response.Write  "var facesetting='"&Dvbbs.Forum_Setting(53)&"';"
	Response.Write  "var votemoney='"&Dvbbs.GroupSetting(47)&"';"
	Response.Write  "var Forum_ChanSetting0='"&Dvbbs.Forum_ChanSetting(0)&"';"
	Response.Write  "var Forum_ChanSetting5='"&Dvbbs.Forum_ChanSetting(5)&"';"
	Response.Write  "var Forum_ChanSetting6='"&Dvbbs.Forum_ChanSetting(6)&"';"
	Response.Write  "var Forum_ChanSetting7='"&Dvbbs.Forum_ChanSetting(7)&"';"
	Response.Write  "var topfloor='"&template.Strings(3)&"';"
	Response.Write  "var floor='"&template.Strings(4)&"';"
	Response.Write  "var lockuserinfo1='"&template.Strings(5)&"';"
	Response.Write  "var lockuserinfo2='"&template.Strings(7)&"';"
	Response.Write  "var noviewbest='"&template.Strings(6)&"';"
	Response.Write  "var actioninfo1='"&template.Strings(8)&"';"
	Response.Write  "var actioninfo2='"&template.Strings(9)&"';"
	Response.Write  "var GroupSetting41='"&Dvbbs.GroupSetting(41)&"';"
	Response.Write  "var TopicMode='"&TopicMode&"';"
	Response.Write  "var mainsetting='"&Dvbbs.mainhtml(0)&"';"
	Response.Write  "var mainsetting=mainsetting.split(""||"");"
	Response.Write  "var TopicNum='"&TopicCount&"';"
	SQL="B.AnnounceID,B.BoardID,B.UserName,B.Topic,B.dateandtime,B.body,B.Expression,B.ip,B.RootID,B.signflag,B.isbest,B.PostUserid,B.layer,b.isagree,U.useremail,U.UserIM,U.UserMobile,U.Usersign,U.userclass,U.Usertitle,U.Userwidth,U.Userheight,U.UserPost,U.Userface,U.JoinDate,U.userWealth,U.userEP,U.userCP,U.Userbirthday,U.Usersex,u.UserGroup,u.LockUser,u.userPower,U.titlepic,U.UserGroupID,U.LastLogin,B.PostBuyUser,U.UserHidden,U.IsChallenge,B.Ubblist,B.LockTopic"
	If cint(skin)=1 and Clng(replyid)=Clng(Announceid) Then
		SQL="Select top 1 "&SQL&" From "&TotalUseTable&" B Inner Join [dv_user] U On U.UserID=B.PostUserID Where B.BoardID="&Dvbbs.BoardID&" And B.RootID="&AnnounceID&"  Order By B.Announceid"
	ElseIf cint(skin)=1 Then
		SQL="Select "&SQL&" From "&TotalUseTable&" B Inner Join [dv_user] U On U.UserID=B.PostUserID Where B.BoardID="&Dvbbs.BoardID&" And B.AnnounceID="&replyID
	Else
		Dim AnnounceIDlists
		AnnounceIDlists=AnnounceIDlist()
		'SQL="Select "&SQL&" From "&TotalUseTable&" B Inner Join [dv_user] U On U.UserID=B.PostUserID Where B.AnnounceID in ("&AnnounceIDlists&") and B.BoardID="&Dvbbs.BoardID&" And B.RootID="&Announceid&" Order By B.AnnounceID"
		SQL="Select "&SQL&" From "&TotalUseTable&" B Inner Join [dv_user] U On U.UserID=B.PostUserID Where B.AnnounceID in ("&AnnounceIDlists&") Order By B.AnnounceID"
	End If
	Set Rs=Server.CreateObject("Adodb.RecordSet")
	'Response.Write SQL
	Rs.Open SQL,Conn,1
	Dvbbs.SqlQueryNum=Dvbbs.SqlQueryNum+1
	If Rs.EOF And Rs.BOF Then
		Dvbbs.AddErrCode(33)
		Exit Function
	End If

	If Not(Rs.EOF And Rs.BOF) Then
		followup = Rs("AnnounceID")
		If TopicCount mod Cint(TopicPageList)=0 then
			Pcount= TopicCount \ Cint(TopicPageList)
		Else
			Pcount= TopicCount \ Cint(TopicPageList)+1
		End If
		Rs.MoveFirst
		If star > Pcount Then star = Pcount
		If star < 1 Then star = 1				
		'If Cint(skin) <> 1 Then Rs.Move (star-1) * TopicPageList
		Response.Write  "var star='"&star&"';"
		'AnnounceID=0,BoardID=1,UserName=2,Topic=3,dateandtime=4,body=5,
		'Expression=6,ip=7,RootID=8,signflag=9,isbest=10,PostUserid=11,
		'layer=12,isagree=13,useremail=14,homepage=15,oicq=16,sign=17,
		'userclass=18,title=19,width=20,height=21,article=22,face=23,JoinDate=24,
		'userWealth=25,userEP=26,userCP=27,birthday=28,sex=29,UserGroup=30,LockUser=31,
		'userPower=32,titlepic=33,UserGroupID=34,LastLogin=35,PostBuyUser=36,Ubblists=39,LockTopic=40
		Dim k,rndnum,TopicAddata,Topic_Ads,UserSign,TopicBody
		K=0
		Dim MyTempStr
		SQL=Rs.GetRows(TopicPageList)

		For i=0 To Ubound(SQL,2)
			UserName=Dvbbs.HtmlEncode(SQL(2,i))
			If SQL(40,i)=2 Then
			Response.Write "actioninfo3='"&template.Strings(16)&"';"
			Else
			Response.Write "actioninfo3='"&template.Strings(15)&"';"
			End If
			If bgcolor="tablebody1" Then
				bgcolor="tablebody2"
				abgcolor="tablebody1"
			Else
				bgcolor="tablebody1"
				abgcolor="tablebody2"
			End If
			ReplyID=SQL(0,i)
			PostBuyUser=SQL(36,i)
			If Dvbbs.Forum_ChanSetting(5)=1 Then
				If Dvbbs.Forum_AdLoop3<>"" Then
					Randomize
					rndnum=Cint((i3-1)*rnd+1)
					If rndnum=0 Then rndnum=1
					TopicAddata=Ad_3(rndnum-1)
					Topic_Ads=SimJsReplace(TopicAddata)
					TopicAddata=""
				Else
					Topic_Ads=""
				End If
			Else
				Topic_Ads=""
			End If
			UserSign=""
			If Not Isnull(SQL(17,i)) Or Not SQL(17,i)="" Then
				If SQL(9,i)=1 and SQL(31,i)=0 and Cint(Dvbbs.forum_setting(42))=1 Then
					If InStr(SQL(17,i),"]")>0 Or InStr(Lcase(SQL(17,i)),"http://")>0 Or InStr(Lcase(SQL(17,i)),"www.")>0 Then
						UserSign = SimJsReplace(dv_ubb.Dv_SignUbbCode(SQL(17,i),SQL(34,i)))
					Else
						UserSign = SimJsReplace(dv_ubb.DviHTMLEncode(SQL(17,i)))
					End If
				End If
			End If
			Ubblists=SQL(39,i)
			If Not (SQL(31,i)=2 Or (SQL(10,i)=1 And CInt(Dvbbs.GroupSetting(41))=0) Or SQL(31,i)=1) Then
				'If InStr(SQL(5,i),"]")>0 Or InStr(Lcase(SQL(5,i)),"http://")>0 Or InStr(Lcase(SQL(5,i)),"www.")>0 Then
					If InStr(Ubblists,",39,") > 0  Then
						TopicBody = SimJsReplace(dv_ubb.Dv_UbbCode(SQL(5,i),SQL(34,i),1,0))
					Else
						TopicBody = SimJsReplace(dv_ubb.Dv_UbbCode(SQL(5,i),SQL(34,i),1,1))
					End If
				'Else
				'	TopicBody = SimJsReplace(dv_ubb.DviHTMLEncode(SQL(5,i)))
				'End If				
			End If
			SQL(13,i)=Replace(Lcase(SQL(13,i))&"","[isubb]","")
			Response.Write "document.write (dvbbs_show_topic("
			Response.Write SQL(0,i)
			Response.Write ","
			Response.Write Dvbbs.BoardID
			Response.Write ","
			MyTempStr = "'"&SimJsReplace(SQL(2,i))&"','"
			If i=0 And Star=1 Then
				If TopicMode>0 Then
					If TopicMode=1 Then
						If InStr(Lcase(SQL(3,i)),"script") >0 Or InStr(SQL(3,i),"&#")>0 Then
							MyTempStr = MyTempStr & SimJsReplace(Server.HtmlEncode(SQL(3,i)&""))
						Else
							MyTempStr = MyTempStr & SimJsReplace(SQL(3,i))
						End If
					Else
						MyTempStr = MyTempStr & SimJsReplace(Server.HtmlEncode(SQL(3,i)&""))
					End If
				Else
					MyTempStr = MyTempStr & SimJsReplace(Server.HtmlEncode(SQL(3,i)&""))
				End If
			Else
				MyTempStr = MyTempStr & SimJsReplace(server.htmlencode(SQL(3,i)&""))
			End If
			MyTempStr = MyTempStr & "','"&SimJsReplace(SQL(13,i))&"','"&SimJsReplace(SQL(14,i))&"','"&SimJsReplace(SQL(15,i))&"','"&SimJsReplace(SQL(16,i))&"','"&SimJsReplace(server.htmlencode(SQL(23,i)&""))&"','"&Topic_Ads&"','"&SimJsReplace(SQL(19,i))&"','"&UserSign&"','"&SQL(30,i)&"','"&TopicBody&"'"
			MyTempStr = Dvbbs.ChkBadWords(MyTempStr)
			MyTempStr = Replace(Replace(Replace(Replace(MyTempStr,chr(13),""),chr(10),"\n"),VbCrLf,"\n"),"<!--","&lt;!--")
			Response.Write MyTempStr
			Response.Write ",'"
			Response.Write SQL(4,i)
			Response.Write "','"
			Response.Write SQL(6,i)
			Response.Write "','"
			If Cint(Dvbbs.GroupSetting(30))=0 Then
				Response.Write  "*.*.*.*"
			Else
				Response.Write  SQL(7,i)
			End If
			Response.Write  "',"
			Response.Write AnnounceID
			Response.Write ","
			Response.Write SQL(9,i)
			Response.Write ","
			Response.Write SQL(10,i)
			Response.Write ","
			Response.Write SQL(11,i)
			Response.Write ","
			Response.Write SQL(12,i)
			Response.Write ",'"
			Response.Write SQL(18,i)
			Response.Write "','"
			Response.Write SQL(20,i)
			Response.Write "','"
			Response.Write SQL(21,i)
			Response.Write "','"
			Response.Write SQL(22,i)
			Response.Write "','"
			Response.Write FormatDateTime(SQL(24,i),2)
			Response.Write "','"
			Response.Write SQL(25,i)
			Response.Write "','"
			Response.Write SQL(26,i)
			Response.Write "','"
			Response.Write SQL(27,i)
			Response.Write "','"
			Response.Write SQL(28,i)
			Response.Write "','"
			Response.Write SQL(29,i)
			Response.Write "',"
			Response.Write SQL(31,i)
			Response.Write ",'"
			Response.Write SQL(32,i)
			Response.Write "','"
			Response.Write SQL(33,i)
			Response.Write "',"
			Response.Write SQL(34,i)
			Response.Write ",'"
			Response.Write SQL(35,i)
			Response.Write "','"
			Response.Write SQL(38,i)
			Response.Write "',"
			Response.Write i
			Response.Write ",'"
			Response.Write bgcolor
			Response.Write "','"
			If SQL(37,i)=1 Or DateDiff("s",SQL(35,i),Now())>Cint(dvbbs.Forum_Setting(8))*60 Then
				Response.Write  "0"
			Else
				Response.Write  "1"
			End If
			Response.Write "','"
			Response.Write SQL(40,i)
			Response.Write  "'));"
			Response.Write  chr(10)
			UbbLists=""
		Next
		SQL=Null
		MyTempStr = template.html(5)
		MyTempStr = Replace(MyTempStr,"{$width}",Dvbbs.mainsetting(0))
		MyTempStr = Replace(MyTempStr,"{$boardid}",Dvbbs.BoardID)
		MyTempStr = Replace(MyTempStr,"{$replyid}",ReplyID)
		MyTempStr = Replace(MyTempStr,"{$announceid}",AnnounceID)
		MyTempStr = Replace(MyTempStr,"{$skin}",Skin)
		MyTempStr = Replace(MyTempStr,"{$page}",Page)
		MyTempStr = Replace(MyTempStr,"{$topicnum}",TopicCount)
		MyTempStr = Replace(MyTempStr,"{$boardjump}",Dvbbs.BoardJumpList)
		Response.Write MyTempStr
	End If
	Response.Write  "</Script>"
	Rs.Close
	Set Rs=Nothing
End Function

Function Show_Topic_FastRe()
	Dim TempStr
	Response.Write "<Script Language=JavaScript>"
	Response.Write "var Board_Setting5='"&Dvbbs.Board_Setting(5)&"';"
	Response.Write "var Board_Setting6='"&Dvbbs.Board_Setting(6)&"';"
	Response.Write "var Board_Setting7='"&Dvbbs.Board_Setting(7)&"';"
	Response.Write "var Board_Setting8='"&Dvbbs.Board_Setting(8)&"';"
	Response.Write "var Board_Setting9='"&Dvbbs.Board_Setting(9)&"';"
	Response.Write "var Board_Setting16='"&Dvbbs.Board_Setting(16)&"';"
	Response.Write "var Board_Setting44='"&Dvbbs.Board_Setting(44)&"';"
	Response.Write "var Forum_Setting3='"&Dvbbs.Forum_Setting(3)&"';"
	Response.Write "var Forum_PostFace='"&Dvbbs.Forum_PostFace&"';"
	Response.Write "var Forum_PostFace=Forum_PostFace.split(""|||"");"
	Response.Write "</Script>"
	TempStr = template.html(6)
	TempStr = Replace(TempStr,"{$topic}",Topic)
	TempStr = Replace(TempStr,"{$boardid}",Dvbbs.BoardID)
	TempStr = Replace(TempStr,"{$membername}",Dvbbs.Membername)
	TempStr = Replace(TempStr,"{$memberword}",Dvbbs.Memberword)
	TempStr = Replace(TempStr,"{$followup}",followup)
	TempStr = Replace(TempStr,"{$announceid}",AnnounceID)
	TempStr = Replace(TempStr,"{$star}",Star)
	TempStr = Replace(TempStr,"{$totalusetable}",TotalUseTable)
	Response.Write TempStr
	TempStr = ""
	Response.Cookies("Dvbbs")=""
End Function

Function Show_Topic_ManageAction()
	Dim TempStr
	TempStr = template.html(7)
	TempStr = Replace(TempStr,"{$width}",Dvbbs.mainsetting(0))
	TempStr = Replace(TempStr,"{$boardid}",Dvbbs.BoardID)
	TempStr = Replace(TempStr,"{$announceid}",AnnounceID)
	TempStr = Replace(TempStr,"{$replyid}",ReplyID)
	If IsTop > 0 Then
		TempStr = Replace(TempStr,"{$topstr}",template.Strings(10))
	Else
		TempStr = Replace(TempStr,"{$topstr}",template.Strings(11))
	End If
	Response.Write TempStr
	TempStr = ""
End Function

Function Show_Topic_Vote()
	Dim TempStr,Rs,Trs
	Set Rs=Dvbbs.Execute("Select * From Dv_Vote Where VoteID="&PollID)
	If Not (Rs.Eof And Rs.Bof) Then
		Response.Write "<Script Language=JavaScript>"
		Response.Write "var vote='"&Rs("vote")&"';"
		Response.Write "var votenum='"&Rs("votenum")&"';"
		Response.Write "var votetype='"&Rs("votetype")&"';"
		Response.Write "var voters='"&Rs("voters")&"';"
		Response.Write "</Script>"
		TempStr = template.html(8)
		TempStr = Replace(TempStr,"{$topic}",Topic)
		TempStr = Replace(TempStr,"{$announceid}",AnnounceID)
		TempStr = Replace(TempStr,"{$votetype}",Rs("votetype"))
		If Dvbbs.UserID=0 Or datediff("d",rs("timeout"),Now())>0 Then
			TempStr = Replace(TempStr,"{$uservoteinfo}",Split(template.html(9),"||")(0))
		Else
			Set Trs=Dvbbs.Execute("Select Count(*) From Dv_voteuser Where voteid="&PollID&" And userid="&Dvbbs.userid)
			If Trs(0)=0 Then 
				TempStr = Replace(TempStr,"{$uservoteinfo}",Split(template.html(9),"||")(1))
			Else
				TempStr = Replace(TempStr,"{$uservoteinfo}",Split(template.html(9),"||")(2))
			End If
			Set Trs=Nothing 
		End  If
		TempStr = Replace(TempStr,"{$timeout}",Rs("timeout"))
		TempStr = Replace(TempStr,"{$boardid}",Dvbbs.BoardID)
		TempStr = Replace(TempStr,"{$voteid}",PollID)
		TempStr = Replace(TempStr,"{$uarticle}",Rs("UArticle")&"")
		TempStr = Replace(TempStr,"{$uep}",Rs("UEP")&"")
		TempStr = Replace(TempStr,"{$ucp}",Rs("UCP")&"")
		TempStr = Replace(TempStr,"{$upower}",Rs("UPower")&"")
		TempStr = Replace(TempStr,"{$umoney}",Rs("UWealth")&"")
		'Response.Write TempStr
		Show_Topic_Vote = TempStr
		TempStr = ""
	End If
	Set Rs=Nothing
End Function

Function SimJsReplace(str)
	If IsNull(str) Or str="" Then Exit Function
	str=Replace(str,"\","\\")
	str=Replace(str,"'","\'")
	SimJsReplace=str
End Function
Function Dvbbs_TopicMode(str,tmode)
	Select Case tmode
	Case "1"
		Dvbbs_TopicMode=str
	Case "2"
		Dvbbs_TopicMode="<font color=red>"&Dvbbs.Htmlencode(str)&"</font>"
	Case "3"
		Dvbbs_TopicMode="<font color=blue>"&Dvbbs.Htmlencode(str)&"</font>"
	Case "4"
		Dvbbs_TopicMode="<font color=green>"&Dvbbs.Htmlencode(str)&"</font>"
	Case Else
		Dvbbs_TopicMode=Dvbbs.HtmlEncode(str)
	End Select
End Function
Sub Showtree()
	template.html(10) = Replace(template.html(10),"{$boardid}",Dvbbs.BoardID)
	template.html(10) = Replace(template.html(10),"{$replyid}",ReplyID)
	template.html(10) = Replace(template.html(10),"{$announceid}",AnnounceID)
	template.html(10) = Replace(template.html(10),"{$openid}",followup)
	Response.Write template.html(10)
End Sub
Function AnnounceIDlist()
	Dim Rs,SQL,i,starcount
	starcount=(Star-1)*Dvbbs.Board_Setting(27)
	SQL="Select Announceid From "&TotalUseTable&" Where BoardID="&Dvbbs.BoardID&" And RootID="&Announceid&" Order By AnnounceID"
	Set Rs=Dvbbs.Execute(SQL)
	If Not Rs.eof Then 
		Rs.move starcount
		AnnounceIDlist=Rs(0)
		Rs.movenext
		For i=1 to Dvbbs.Board_Setting(27)
			If Rs.eof Then Exit For
			AnnounceIDlist=AnnounceIDlist&","&Rs(0)
			Rs.movenext
		Next
	Else
		Dvbbs.AddErrcode(32)
		Dvbbs.Showerr()
	End If 
	Set Rs=Nothing 
End Function 
%>
