<!-- #include file="setup.asp" -->
<%
id=int(Request("id"))

count=conn.execute("Select count(id)from [forum] where polltopic<>'' ")(0)
if count=0 then
error("<li>用户尚未在论坛中发表过议题！")
end if


select case Request("menu")

case ""
index
case "post"
post

case "result"
result

end select

sub index
top

%>
<title>社区议会</title>

<table border=0 width=97% align=center cellspacing=1 cellpadding=4 class=a2>
<tr class=a3>
<td height=25>&nbsp;<img src=images/Forum_nav.gif>&nbsp; <%ClubTree%> → <a href="vote.asp">社区议会</a></td>
</tr>
</table><br>

<SCRIPT>valigntop()</SCRIPT>
<table cellspacing="0" cellpadding="0" width="97%" align="center" border="0" class="a2">
	<tr>
		<td>
		<table cellspacing="1" cellpadding="6" width="100%" border="0">
			<tr>
				<td width="100%" height="20" align="middle" class="a1" colspan="3">
				<font face="宋体">最新议题</font></td>
			</tr>
			
<%



sql="select * from [forum] where polltopic<>'' and deltopic<>1 order by id Desc"


rs.Open sql,Conn,1

pagesetup=15 '设定每页的显示数量
rs.pagesize=pagesetup
TotalPage=rs.pagecount  '总页数
PageCount = cint(Request.QueryString("ToPage"))
if PageCount <1 then PageCount = 1
if PageCount > TotalPage then PageCount = TotalPage
if TotalPage>0 then rs.absolutepage=PageCount '跳转到指定页数

i=0
Do While Not RS.EOF and i<pagesetup
i=i+1
%>
			
			<tr bgcolor="ffffff">
				<td valign="top" align="left" width="71%">
						<img src="images/brow/top.gif" border="0"> 
						
<a onclick="min_yuzi()" target="message" href="ShowPost.asp?id=<%=rs("id")%>"><%=rs("topic")%></a>
						
						
				</td>
				<td valign="top" align="center">
						<input onclick=javascript:open('vote.asp?menu=post&id=<%=rs("id")%>','','resizable,scrollbars,width=500,height=170') type="submit" value="请投一票"></td>
				<td valign="top" align="center">
						<input  onclick=javascript:open('vote.asp?menu=result&id=<%=rs("id")%>','','resizable,scrollbars,width=500,height=170') type="submit" value="投票结果"></td>
			</tr>
			
<%

RS.MoveNext
loop
RS.Close
%>

</table></td></tr></table>
<SCRIPT>valignbottom()</SCRIPT>
<br><center>[
<script>
PageCount=<%=TotalPage%> //总页数
topage=<%=PageCount%>   //当前停留页

for (var i=1; i <= PageCount; i++) {
if (i <= topage+3 && i >= topage-3 || i==1 || i==PageCount){
if (i > topage+4 || i < topage-2 && i!=1 && i!=2 ){document.write(" ... ");}
if (topage==i){document.write(" "+ i +" ");}
else{
document.write("<a href=?topage="+i+">"+ i +"</a> ");
}
}
}
</script>
]<br>
<%
end sub

sub post

sql="select * from forum where ID="&id&""
rs.Open sql,Conn,1,3
if rs("multiplicity")=1 then
multiplicity="checkbox"
else
multiplicity="radio"
end if
content=""&content&"<form action=postvote.asp?id="&rs("id")&" method=POST><table>"
vote=split(rs("polltopic"),"|")
for i = 0 to ubound(vote)
if not vote(i)="" then
content=""&content&"<tr><td height=22>"&i+1&".<input type="&multiplicity&" value="&i&" name=postvote>"&vote(i)&"</td></tr>"
end if
next
content=""&content&"</table><center><INPUT type=submit value=' 投 票 '></form>"


%><title>请您投票</title><link href="images/skins/<%=Request.Cookies("skins")%>/bbs.css" rel="stylesheet"><%=content%><%
end sub

sub result
sql="select * from forum where ID="&id&""
rs.Open sql,Conn,1,3
if rs("multiplicity")=1 then
multiplicity="checkbox"
else
multiplicity="radio"
end if
content=""&content&"<table><tr><td><table>"

vote=split(rs("polltopic"),"|")
for i = 0 to ubound(vote)
if not vote(i)="" then
content=""&content&"<tr><td height=22 valign=bottom>"&i+1&"."&vote(i)&"</td></tr>"

end if
next
content=""&content&"</table></td><td><table>"
allticket=0
vote=split(rs("pollresult"),"|")
for i = 0 to ubound(vote)
if not vote(i)="" then
content=""&content&"<tr><td height=22 valign=bottom>票数："&vote(i)&"</td></tr>"
allticket=vote(i)+allticket
end if
next
content=""&content&"</table></td><td><table>"
vote=split(rs("pollresult"),"|")
for i = 0 to ubound(vote)
if not vote(i)="" and allticket<>0 then
content=""&content&"<tr><td height=22 valign=bottom><img src=images/bar1.gif width="&vote(i)/allticket*100&" height=10> ["&formatnumber(vote(i)/allticket*100)&"%]</td></tr>"
end if
next
content=""&content&"</table></td></tr></table></form>"
%><title>投票结果</title><link href="images/skins/<%=Request.Cookies("skins")%>/bbs.css" rel="stylesheet"><%=content%><%
end sub


htmlend
%>