<!--#INCLUDE FILE="../HXINCLUDE/HXINCLUDEHEAD.ASP"-->
<%
action=request("action"):ColumnName="":Tablename="HX_VoteQuestion":Tablename1="HX_VoteAnswer"
if action="sendvote" then
    WS_QuestionID=request.form("WS_QuestionID"):WS_Void = Request.Form("poll"):	N_Quest = Request.Form("N_Question")
	if session("poll" & WS_QuestionID)<>"" and isnumeric(session("poll" & WS_QuestionID)) then 	PollNum = session("poll" & WS_QuestionID)
	If WS_QuestionID = "" or WS_Void = "" Then Call HX_GoBack( "请选择一个选项!","")
	if PollNum=WS_QuestionID then
		Call HX_GoBack("对不起，此项目你已经投过票了!","") 
	else
		Conn.Execute("Update HX_VoteAnswer SET WS_VoteCount = WS_VoteCount+1 Where WS_Void= " & WS_Void)
		Conn.Execute("Update HX_VoteQuestion SET WS_QuestionVote = WS_QuestionVote+1 Where WS_VQID = " & WS_QuestionID)		
		session("poll" & WS_QuestionID) = WS_QuestionID		
		response.redirect ("netvoteinfo.asp?WS_QuestionID=" & WS_QuestionID)
		response.end
	end if	
end if  
Orderby=" where WS_QuestionStartDate<= #" & Date() & "# and WS_QuestionEndDate>= #" & Date() & "# "   
response.Write "<head><meta http-equiv='Content-Type' content='text/html; charset=gb2312'><title></title><link rel=stylesheet type=text/css href='../HXinclude/HX_Style.css'></head><body topmargin='20' leftmargin='0' bottommargin='25'><table width='596'  border='0' cellspacing='1' cellpadding='0' align=center bgcolor='#613c25'><tr><td colspan='2' bgcolor=FFFBE8><table width='100%'  border='0' cellspacing='0' cellpadding='0'><tr><td height='25' background='../hximages/titleline.gif'><font class='fontmenu'>网络调查</font></td></tr></table><table width='100%'  border='0' cellpadding='0' cellspacing='1' bgcolor=613c25><tr bgcolor='#FFFBE8'><td height='24'>"
    WS_QuestionID=request("WS_QuestionID")
	if WS_QuestionID<>"" and isnumeric(WS_QuestionID) then Orderby=Orderby&" and WS_VQID="&WS_QuestionID
	set rs=WS_S.HX_SetRSD("WS_VQID,WS_QuestionTitle,WS_QuestionVote",Tablename,Orderby)
    if rs.recordcount>0 then
	 N_Quest = rs("WS_QuestionTitle"):WS_QuestionID = Cint(rs("WS_VQID"))
	  if session("poll" & WS_QuestionID)<>"" and isnumeric(session("poll" & WS_QuestionID)) then PollNum = Cint(session("poll" & WS_QuestionID))
	   set ars=WS_S.HX_SetRSD("","HX_VoteAnswer"," WHERE WS_VQID=" & WS_QuestionID)
	   C=ars.recordcount
	   ReDim A_Count(c)
		i=65
		p_total=0
		For N=1 to C
			A_Count(N)=ars("WS_VoteCount")
			WS_Void = ars("WS_Void")
			WS_AnswerTitle = ars("WS_AnswerTitle")
			p_total=p_total+A_Count(N)
        	Content1=Content1 & "[" & chr(i) & "]<input type='radio' name='poll' checked class='radio' id="&chr(i)&" value='" & WS_Void & "'><label for="&chr(i)&">"
        	Content1=Content1 & WS_AnswerTitle & "</label><br>"
		 ars.MoveNext
		 i=i+1
		Next
    call WS_S.HX_RSClose(ars) 
	i=65
	For N=1 to C
		if A_Count(N) = 0 then p_percent = 0 Else p_percent = (A_Count(N)/p_total) * 100 End If		
		Content20=Content20 & "<tr><td align='right' valign='bottom'>[" & chr(i) & "]</td></tr>"
	 	Content21=Content21 & "<tr><td valign='bottom'><img src='../HXimages/netvote/p1.gif' width='" & p_percent & "' height='8'>&nbsp; <font color='#7C96B8'>" & FormatNumber(p_percent,2) & "%&nbsp;[" & A_Count(N) & "人]</font></td></tr>"
		Content30=Content30 & "<td width='40' valign='bottom' align='center'><font color='#7C96B8'>" & FormatNumber(p_percent,2) & "%</font><br><img src='../HXimages/netvote/p2.gif' width='8' height='" & p_percent & "' vspace='1'></td>"
		Content31=Content31 & "<td width='40' align='center'>[" & chr(i) & "]</td>"
		i=i+1
	Next
 response.Write "<table width='100%' border='0' align='center' cellpadding='5' cellspacing='1' bgcolor='#BF9B73'><form action='?action=sendvote' method='post'><input type='hidden' name='WS_QuestionID' value='"&WS_QuestionID&"'><input type='hidden' name='N_Question' value='"&N_Quest&"'><tr><td colspan='2' class=td4>当前调查项目</td></tr><tr bgcolor='#F2F2F2'><td width='49%'><font color='#000000'>主题："&N_Quest&"</font></td><td width='51%'><font color='#000000'>[调查结果显示]</font><input type='radio' name='list' onclick=""L1.style.display='inline';L2.style.display='none';"" checked class='radio' style='background-color:FFFBE8;'>横向显示　<input type='radio' name='list' onclick=""L2.style.display='inline';L1.style.display='none';"" class='radio' style='background-color:FFFBE8;'>纵向显示 </td></tr><tr><td width='49%' bgcolor='#FFFBE8' valign='top'>"&Content1 &"</td><td width='51%' bgcolor='#FFFBE8'><table width='100%' ><tr><td width='48%' class='small' id='L1' height='120'><table width='100%' border='0' cellspacing='0' cellpadding='1'><tr><td valign='bottom' width='22'><table width='100%' border='0' cellspacing='0' cellpadding='0' height='120'><tr><td align='right' valign='bottom' height='18'>&nbsp;</td></tr>"&Content20&"<tr><td height='18'>&nbsp; </td></tr></table></td><td class='L1' valign='bottom'><table width='100%' border='0' cellspacing='0' cellpadding='0' height='120'><tr><td valign='bottom' height='18'>&nbsp;</td></tr>"&Content21&"<tr><td height='18'>&nbsp; </td></tr></table></td></tr></table></td><td width='52%' class='small' valign='bottom' id='L2' style='display:none;'><table border='0' cellspacing='0' cellpadding='0' class='L2'><tr><td valign='bottom' align='center' height='120' width='19'></td>"&Content30 &"<td valign='bottom' align='center' height='120' width='20'></td></tr></table><table border='0' cellspacing='0' cellpadding='0' align='left'><tr><td valign='bottom' align='center'  width='19' height='18'></td>"&Content31&"</tr></table></td></tr></table></td></tr><tr bgcolor='#F2F2F2'><td width='49%' bgcolor='#F2F2F2' valign='bottom' height='2'> <input type='submit' value=' 提 交 ' "
 If PollNum = WS_QuestionID Then response.write "disabled"
  response.Write "> <input type='reset' name='Submit3' value=' 重 选 '></td><td width='51%' height='2'>总投票数: "&p_total&"</td></tr></form></table>"
  set rs=WS_S.HX_SetRSD("WS_VQID,WS_QuestionTitle,WS_QuestionStartDate,WS_QuestionVote,WS_QuestionActive","HX_VoteQuestion"," WHERE WS_QuestionStartDate <= #" & Date() & "# AND WS_QuestionEndDate >= #" & Date() & "# and WS_VQID <> " & WS_QuestionID)
  response.Write "<br><table width='100%' border='0' align='center' cellpadding='5' cellspacing='1' bgcolor='#BF9B73'><tr><td height='21' colspan='4'><font color='#000000'>其他调查项目</font></td></tr>"
  if rs.recordcount<=0 then 
  response.Write "<tr><td colspan='4' align='center' bgcolor='#FFFBE8'>没有其他调查项目了</td></tr>"
  else
  response.Write "<tr bgcolor=FFFBE8><td width='5%'>&nbsp;</td><td width='51%' height='20' >调查主题</td><td width='15%' align='center'>参加人数</td><td width='29%'>开始日期</td></tr>"
   do until rs.eof
    response.Write "<tr><td width='5%' bgcolor='#FFFBE8' align='center'><img src='../HXIMAGES/netvote/"
	if rs("WS_QuestionActive") then response.write "poll" else response.write "poll1" end if
	response.Write ".gif' width='13' height='15'></td><td width='51%' bgcolor='#FFFBE8'><a href='netvoteinfo.asp?WS_QuestionID="&rs("WS_VQID")&"'>"&rs("WS_QuestionTitle")&"</a></td><td width='15%' bgcolor='#FFFBE8' align='center'>"&rs("WS_QuestionVote")&"</td><td width='29%' bgcolor='#FFFBE8'>["&rs("WS_QuestionStartDate")&"]</td></tr>"
  rs.MoveNext
  loop
end if
response.Write "</table>"
	 else
	   response.write "对不起，暂无调查项目"   
	 end if	 
	 response.Write "</td></tr></table></td></tr></table>"
%>