<!--#include file="inc/config.asp"-->
<!--#include file="inc/conn.asp"-->
<HTML>
<HEAD>
<TITLE>投票</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<style>
body,td,input,textarea {font-size:9pt}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
</style>

</HEAD>
<BODY>
<%
dim id,act,title,optionNum,optionType,votestatus,expiresTime,voteType
id=cint(request("id"))
if(id<1) then
	response.Write("没有找到id="&id&"的记录！")
	response.End()
end if
dim voteid,tempArr
	Set rs = Server.CreateObject("Adodb.RecordSet")				 
	rs.Open "Select top 1 * from vote where id="&id,conn,3,1
	if not rs.eof then
		title=rs("title")
		optionType=rs("optionType")
		if(optionType=0) then
			voteType="radio"
		else
			voteType="checkbox"
		end if
		if(rs("status")<>1) then
			response.Write("投票已过期或暂时关闭.")
			response.End()
		end if
		If datediff("s",now(),formatdatetime(rs("expiresTime")))<0 then
			response.Write("投票已过期.")
			response.End()
		end if
	else
		response.Write("没有找到记录")
		response.End()
	end if
	rs.close
	set rs=nothing
%>
<FORM method="POST" name="VoteForm" action="vote.asp?id=<%=id%>" style="margin:0 0 0 0;">
  <TABLE width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#666666">
<TR bgcolor="#FF9900">
  <TD height="24" colspan="2"><div align="center" class="style1">投票</div></TD>
  </TR>
<TR bgcolor="#F5F5F5">
  <TD colspan="2"><div align="center">投票标题：<%=title%></div>    </TD>
  </TR>
<%
dim voteArr
Set rs = Server.CreateObject("Adodb.RecordSet")				 
rs.Open "Select id,itemName,clicks from voteitem where voteid="&id,conn,3,1
if not rs.eof then
	voteArr=rs.GetRows()
	rs.close
	set rs=nothing
	for i=0 to ubound(voteArr,2)
%>
<TR bgcolor="#F5F5F5">
  <TD width="14%"><div align="center">选项<%=i+1%>：</div></TD>
  <TD width="86%"><div align="left">
    <input type="<%=voteType%>" name="vote" value="<%=voteArr(0,i)%>"> 
    <%=voteArr(1,i)%>&nbsp;(<%=voteArr(2,i)%>票)
</div></TD>
</TR>
<%
	next
end if
%>
<TR bgcolor="#F5F5F5">
	<TD align=right>&nbsp;	  </TD>
    <TD align=right><div align="left"> 		
        <input type=submit name=b1 value="提 交">&nbsp;&nbsp;
        <input type=button name=b2 value="查 看" onClick="window.location.href='vote_result.asp?id=<%=id%>'">       
    </div></TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
<%
call connclose()
%>