<!--#include file="../common/conn.asp"-->
<!--#include File="String.asp"-->
<%
	QuestionID	=	GetVariable("QuestionID")					'调查题目
	AnswerID	=	GetVariable("AnswerID")						'投票的选择

	'如果是投票
	If Session("VoteTo"&AnswerID)<>"YES" Then
		'检查调查是否已经过期
		strSQL="Select Timeout From web_vote Where ID=" & cint(QuestionID)
		rs.open strSQL,conn,1,1
		if rs("Timeout")-date<0 And AnswerID<>"" then
			'调查已经过期
			response.Write("<script language='javascript'>alert('此投票已经过期，不能再投票！');</script>")
		else
			'累加投票
			If AnswerID<>""  Then
				SQLUpdate	=	"Update web_vote Set [Count]=[Count]+1 Where ID=" & cint(AnswerID)
				conn.Execute ( SQLUpdate )
				SQLUpdate	=	"Update web_vote Set [Count]=[Count]+1 Where ID=" & cint(QuestionID)
				conn.Execute ( SQLUpdate )
				Session("VoteTo"&AnswerID)="YES"
			End If
		end if
	else
		strAlert="onload=""alert('对不起，您已经投过此票，一天只能投一次！ ')"""
	End If

	dim Title
	Title		=	"查看投票"
%>
<html>
<head>
<title><%=Title%></title>
<!-- no cache headers -->
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="no-cache">
<meta http-equiv="Expires" content="-1">
<meta http-equiv="Cache-Control" content="no-cache">
<!-- end no cache headers -->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<STYLE type="text/css">
FONT		{FONT-FAMILY: Arial,Verdana,Helvetica,sans-serif; FONT-SIZE: 12px}
BODY		{FONT-FAMILY: Arial,Verdana,Helvetica,sans-serif; CURSOR: default; FONT-SIZE: 12px; COLOR: #333333; SCROLLBAR-BASE-COLOR: #669900; SCROLLBAR-ARROW-COLOR: FFFFFF}

P			{FONT-FAMILY: Arial,Verdana,Helvetica,sans-serif; FONT-SIZE: 12px;  COLOR: #333333}
TD			{FONT-FAMILY: Arial,Verdana,Helvetica,sans-serif; FONT-SIZE: 12px;  COLOR: #333333;line-height:150%}
TR			{FONT-FAMILY: Arial,Verdana,Helvetica,sans-serif; FONT-SIZE: 12px;  COLOR: #333333}
UL			{FONT-FAMILY: Arial,Verdana,Helvetica,sans-serif; FONT-SIZE: 12px;  COLOR: #333333}
LI			{FONT-FAMILY: Arial,Verdana,Helvetica,sans-serif; FONT-SIZE: 12px;  COLOR: #333333}

FORM		{FONT-FAMILY: Arial,Verdana,Helvetica,sans-serif; FONT-SIZE: 12px}
SELECT		{FONT-FAMILY: "宋体",Arial,Verdana,Helvetica,sans-serif; BACKGROUND-COLOR: #EEEEEE; COLOR: #333333; FONT-SIZE: 12px;}
TEXTAREA	{FONT-FAMILY: Arial,Verdana,Helvetica,sans-serif; BACKGROUND-COLOR: #EEEEEE; COLOR: #333333; FONT-SIZE: 12px;}
OPTION		{FONT-FAMILY: Arial,Verdana,Helvetica,sans-serif; BACKGROUND-COLOR: #EEEEEE; COLOR: #333333; FONT-SIZE: 12px;}
INPUT		{FONT-FAMILY: Arial,Verdana,Helvetica,sans-serif; COLOR: #333333; FONT-SIZE: 12px;}

A:active	{COLOR: #FF0000;}
A:visited	{COLOR: #333333; TEXT-DECORATION: none}
A:hover		{COLOR: #FF0000;TEXT-DECORATION: underline}
A:link		{COLOR: #333333; TEXT-DECORATION: none}

.bginput		{FONT-FAMILY: "宋体",Arial,Verdana,Helvetica,sans-serif; FONT-SIZE: 12px; COLOR: #333333; HEIGHT: 18px; BACKGROUND-COLOR: #CCCCCC}
.input			{FONT-FAMILY: Arial,Verdana,Helvetica,sans-serif; FONT-SIZE: 12px; COLOR: #333333; HEIGHT: 18px; BACKGROUND-COLOR: #F9F9F9}
.baseline		{FONT-FAMILY: Arial,Verdana,Helvetica,sans-serif; BORDER-COLOR: black black #336600; BORDER-STYLE: dashed; BORDER-TOP-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 1px; BORDER-LEFT-WIDTH: 0px}
.solidbaseline	{FONT-FAMILY: Arial,Verdana,Helvetica,sans-serif; BORDER-COLOR: black black #E0E0E0; BORDER-STYLE: solid; BORDER-TOP-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 1px; BORDER-LEFT-WIDTH: 0px}
</STYLE>
</head>
<body leftmargin="0" topmargin="0" <%=strAlert%>>
	<%
	SQLQuestion	=	"SELECT * FROM web_vote Where ID="&QuestionID
	SQLAnswer	=	"SELECT * FROM web_vote Where ParentID="&QuestionID
	Set rs=conn.Execute (SQLQuestion)
	Question=rs("Topic")
	TotalCount=rs("Count")
	%>
<table width="100%" border="0" cellpadding="4" cellspacing="1" bgcolor="336600">
  <tr> 
    <td bgcolor="669900"><font color="#FFFFFF"><strong><%=Question%></strong></font></td>
  </tr>
  <tr bgcolor="#EEEEEE"> 
    <td bgcolor="#F9F9F9"> <%
	Dim Answer(10),TheCount(10),TheAnswerID(10)
	i=1
	Set rs=conn.Execute (SQLAnswer)
	AllCount=0
	While Not rs.Eof
		Answer(i)	=	rs("Topic")
		TheAnswerID(i)	=	rs("ID")
		TheCount(i)	=	rs("Count")
		AllCount=AllCount+rs("Count")
		If rs("Count")>CountMax Then 
			CountMax=rs("Count")
		End If
		i=i+1
		rs.MoveNext
	Wend
%> <div align="center"> 
        <center>
          <%=Question%>(<%=TotalCount%>人参与投票) 
          <p> 
          <table width="90%" height="52" border="0" cellpadding="2">
            <form method=POST action=Show.asp?QuestionID=<%=QuestionID%>>
              <%
	For j=1 To i-1
		If AllCount = 0 Then
			AllCount = 1
			CountMax = 1
		End If
%>
              <tr> 
                <td height="24"> 
                  <input type=radio name=AnswerID value=<%=TheAnswerID(j)%> Class=theradio>
                  <%=Answer(j)%></td>
                <td><img border="0" src="vote.gif" width="<%=150*TheCount(j)/CountMax%>" height="10"> 
                  <%=TheCount(j)%></td>
                <td><%=Left(cstr(TheCount(j)/AllCount*100),5)&"%"%></td>
              </tr>
              <%
	Next
%>
              <tr> 
                <td height="26"></td>
                <td><input type=submit value=投票 id=submit12 name=submit12></td>
                <td></td>
              </tr>
            </form>
          </table>
          <div align="center">
            <center>
            </center>
          </div>
        </center>
      </div></td>
  </tr>
</table>
</body>                                    
</html>






