<%@ Language=JScript %>
<%

var rst=new ActiveXObject("ADODB.Recordset");
rst.Open("select survey_question from survey where survey_id="+Request("survey"),appDbConnection);

%>
<HTML>
	<HEAD>
		<LINK rel="stylesheet" type="text/css" href="survey.css">
	</HEAD>
	<BODY>
		<table>
			<tr>
				<td class="sq">
					<%=rst.Fields("survey_question").Value%>
				</td>
			</tr>
		</table>
		<table border="1">
			<tr>
				<th>
					Option
				</th>
				<th>
					Percent
				</th>
				<th>
					Votes
				</th>
			</tr>
			<%
rst.Close();
rst.Open("select sum(so_votes) from survey_options where so_survey_id=" + Request("survey"),appDbConnection);
var totalVotes=rst.Fields(0).Value;
var pcntVotes;
rst.Close();
rst.Open("select so_text,so_votes from survey_options where so_survey_id=" + Request("survey") + " order by so_number asc",appDbConnection);
while(!rst.EOF) {
	Response.Write("<tr><td>" + rst.Fields("so_text") + "</td>");
	pcntVotes=Math.round(((rst.Fields("so_votes")/totalVotes)*100));
	Response.Write("<td width=\"50%\" ><img src=\"images/blue.gif\" height=5 width=" + (pcntVotes*3) + "></td>");
	Response.Write("<td>" + rst.Fields("so_votes") + "</td></tr>");
	rst.MoveNext();
}
rst.Close();
%>
			<tr>
				<td>
					Total Votes
				</td>
				<td width="50%">
					<img src="images/blue.gif" height="5" width="300">
				</td>
				<td>
					<%=totalVotes%>
				</td>
			</tr>
		</table>
		<br>
		<a href="default.aspx">Back to Surveys Screen</a>
	</BODY>
</HTML>
