<!--#include file="conn.asp"-->
<%
dim voteArr,voteItemArr,catalogid,catalogtitle
catalogid=Clng(request.queryString("id"))
'投票参数
set rs=server.CreateObject("adodb.recordset")
rs.open "select title from t_survey_catalog where id="&catalogid,conn,3,1
if not rs.eof then
	catalogtitle=rs(0)
end if
rs.close
set rs=nothing
'投票数组
Set rs = Server.CreateObject("Adodb.RecordSet")				 
	rs.Open "Select id,title from t_survey_vote where catalogid="&catalogid&" order by id asc",conn,3,1
	if not rs.eof then
		voteArr=rs.GetRows()
	else
		response.Write("没有找到记录")
		response.End()
	end if
	rs.close
	set rs=nothing
%>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title><%=catalogtitle%></title>
</head>
<style type="text/css">
td,p,li,select,input {font-size:12px}
.l13 {line-height:130%}
.l15 {line-height:150%}
.f14 {font-size:14.9px;}
.fl {font-size:14.9px;line-height:130%}
A:hover {color: ff0000;}
td{word-break:break-all;}
</style>
<body bgcolor=#f9cd34 topmargin=0 marginheight=0 leftmargin=0 marginwidth=0>
<center>
<table width=700 border=0 cellpadding=0 cellspacing=0 align="center" bgcolor="#FFF2BB">
<tr><td>
<table width=80% border=0 cellpadding=5 cellspacing=0 align="center" bgcolor="#FFF2BB">
<tr><td height='8'></td></tr>
<tr>
  <td class=fl><%=catalogtitle%></td>
</tr>
<tr><td class=f14>共有<font color=#fc0a0b><%=conn.execute("select votenum from t_survey_stat where catalogid="&catalogid&"")(0)%></font>人参加</td></tr>
</table>
<%
'开始按vote循环
for votei=0 to ubound(voteArr,2)
%>
  <tr><td>
	<table width=80% border=0 cellpadding=0 cellspacing=0 bgcolor=#b18a02 align='center'>
<tr><td>
		<table width=100% border=0 cellpadding=3 cellspacing=1 align=center>
		<tr bgcolor=#f9dc34 align=center>
<td class=f14 colspan='4' align=left style='padding-left:5px'><%=voteArr(1,votei)%></td>
		</tr><tr bgcolor=#ffffff align=center>
		<td width=52 class=f14>&nbsp;</td><td width=291 height=20 class=f14>选项</td><td width=133 class=f14>比例</td><td width=55 class=f14>票数</td></tr>
		<%
		'开始按voteitem 循环
		voteItemTotal=conn.execute("select sum(clicks) from t_survey_item where voteid="&voteArr(0,votei))(0)
		if(voteItemTotal=0) then
			voteItemTotal=1
		end if
		Set rs = Server.CreateObject("Adodb.RecordSet")				 
		rs.Open "Select id,itemName,clicks from t_survey_item where voteid="&voteArr(0,votei),conn,3,1
		if not rs.eof then
			voteItemArr=rs.GetRows()
			rs.close
			set rs=nothing
			for i=0 to ubound(voteItemArr,2)
		%>
		<tr bgcolor=#ffffff align=center><td class=f14><%=i+1%></td><td class=f14 height=20 align=left><font color=#0262cd><%=voteItemArr(1,i)%></font></td>
		<td class=f14 align=left> <table border=0><tr>
		<td align=left width=47><font color=#0262cd><%=FormatNumber(CCur(voteItemArr(2,i)/voteItemTotal)*100,2)%>%</font></td><td width="60" align=left><img src='images/14dc_bg.gif' width=<%=Cint(FormatNumber(voteItemArr(2,i)/voteItemTotal,2)*30)%> height=10></td></tr>
		</table>
		<td class=f14 align=left><div align="center"><font color=#0262cd><%=voteItemArr(2,i)%></font></div></td></tr>
		<%
			next
		else
			rs.close
			set rs=nothing
		end if
		'结束按voteitem 循环
		%>
		</table>
</td></tr>
</table>
</td></tr>
<tr><td height=19>&nbsp;</td></tr>
<%
next
'结束vote循环
%>
</table>
<br>
</body>
</html>
<%
call connclose()
%>