% Response.Buffer = True %>
<%
Dim vQuestion
Dim vAnswers(8)
Dim vCount(8)
Dim vPercent(8)
scriptname = Request.ServerVariables("HTTP_REFERER")
'Some before doings...
'Lets get the current poll...
sID = Request.QueryString("id")
If sID = "" Then
sID = -1
End If
Dim sError
'Are we trying to vote?
If Request.Form("R1") <> "" Then
'First try to vote...
sError = PollMentor_TryToVote(sID,Request.Form("R1") )
End If
'Get active one...
Dim nRet
nRet = PollMentor_GetPollInfo( sID, sTitle, sQuestion, vAnswers, vCount )
%>
| <%=sQuestion%> ? |
<%
'First of all get max value and nLowValue
nMaxValue = 0
For nCount=1 To 8
If vAnswers(nCount)<>"" And vCount(nCount)>nMaxValue Then
nMaxValue = vCount(nCount)
End If
Next
If nMaxValue = 0 Then
nMaxValue = 1
End If
nMaxWidth = 60 'This is number of pixels for maxvalue
nTotal = 0
'1. Go through all and get total
For nCount=1 To 8
If vAnswers(nCount)<>"" Then
nTotal = nTotal + vCount(nCount)
End If
Next
If nTotal = 0 Then
nTotal = 1
End If
'2. Go through all and get percent
For nCount=1 To 8
If vAnswers(nCount)<>"" Then
' vPercent(nCount) = FormatNumber(vCount(nCount)/nTotal*100,1)
vPercent(nCount) = int(FormatNumber(vCount(nCount)/nTotal*100,1))
End If
Next
For nCount=1 To 8
If vAnswers(nCount)<>"" Then
nThisVal = FormatNumber(vCount(nCount)/nMaxValue * nMaxWidth,0)
%>
| <%=vAnswers(nCount)%> |
(<%=vPercent(nCount)%> %) |
<%=vCount(nCount)%> votes |
<%
End If
Next
%>
|
Total votes #: <%=nTotal%>
|
|
|