<!--#include file="../common/conn.asp"-->
<%
	strTop=GetQueryString("top")
	if strTop <> "" then
		strTop=" Top " & strTop
	else
		strTop=" Top 1 "
	end if
	
	
	strAdmin=GetQueryString("admin")
	SQLQuestion	=	"SELECT " & strTop & " * FROM web_vote Where m_id=" & WebUserID & " And ParentID=0 Order by ID Desc"

	rs.open SQLQuestion,conn,1,1
	if rs.recordcount<=0 then
		response.Write("document.write('<br>没有任何投票可显示！<br>');")
		response.End()
	end if
	
%>
document.write("  <table width='100%' border='0' cellspacing='1' cellpadding='5'>\n");
document.write("<form action='admin/vote/show.asp' method='post' name='voteform' target='_blank'>\n");
document.write("  <input name='QuestionID' type='hidden' id='QuestionID'>\n");
document.write("  <input name='AnswerID' type='hidden' id='AnswerID'>\n");
<% 
	for i=1 to rs.recordcount
%>
	document.write("    <tr<% if GetVariable("color") <> "" then response.Write(" bgcolor=#" & GetVariable("color"))%>>\n"); 
	document.write("      <td><font color=#990000><b><%= rs("Topic")%></b></font></td>\n");
	document.write("    </tr>\n");
	document.write("    <tr> \n");
	document.write("      <td>\n");
	<%
	SQLAnswer	=	"SELECT * FROM web_vote Where ParentID=" & trim(rs("ID"))
	Set rsAnswer=	Server.CreateObject("ADODB.RecordSet")
	rsAnswer.open SQLAnswer,conn,1,1
	for j=1 to rsAnswer.recordcount
	%>
		document.write("　<input style='border:0' type=radio name='Answer<%=rs("ID")%>' value=<%=rsAnswer("ID")%>><%=rsAnswer("Topic")%><br>\n");
	<%
		rsAnswer.movenext
	next
	rsAnswer.close
	%>
	document.write("	  </td>\n");
	document.write("    </tr>\n");
	document.write("    <tr>\n");
	document.write("      <td align='center'><input type='button' name='Submit' value='投票' onClick='changeVote(<%=rs("ID")%>)'>\n");
	document.write("        <input type='button' name='Submit2' value='结果' onClick='showvote(<%=rs("ID")%>)'></td>\n");
	document.write("    </tr>\n");
<%
	rs.movenext
next
%>
	document.write("</form>\n");
	document.write("  </table>\n");





function showvote(intID)
{
	window.open("admin/vote/show.asp?QuestionID=" + intID);
}
function changeVote(intID)
{
	voteform.QuestionID.value=intID;
	eval("var objAnswerID=voteform.Answer" + intID);
	var strAnswerID=0;
	for(i=0;i<objAnswerID.length;i++){
		if (objAnswerID[i].checked) {
			strAnswerID=objAnswerID[i].value;
			break;
		}
	}
	voteform.AnswerID.value=strAnswerID;
	voteform.submit();
}
