<%if {topic.Special}==1%>
<!--投票区开始-->
<div class="pollpanel">
	<h4>
	投票：<strong>{topic.title}</strong>
	<%if {pollinfo.multiple}==1%>
	- 多选(最多可选{pollinfo.maxchoices}项)
	<%/if%>
	- 截止时间：{pollinfo.expiration}
	</h4>
	<table border="0" cellpadding="0" cellspacing="0" summary="pollpanel">
	<%loop polloption Polls.GetPollOptionList(topicid)%>
	<tbody>
	<tr>
		<%if {allowvote}%>
		<td class="selector">
			<%if {pollinfo.multiple}==1%>
				<input type="checkbox" name="pollitemid" value="{polloption[polloptionid]}" onclick='checkbox(this)'/>
			<%else%>
				<input type="radio" name="pollitemid"  value="{polloption[polloptionid]}"  />
			<%/if%>
		</td>
		<%/if%>
		<td colspan="2">
			{polloption[_id]}. {polloption[name]}
		</td>
	</tr>
	<%if {showpollresult}%>
	<tr>
		<%if {allowvote}%>
		<td> </td>
		<%/if%>
		<td class="optionvessel">
			<div class="optionbar">
			<%set (int){styleid}={polloption[_id]} % 10%>
				<div class="polloptionbar <%if {polloption[value]}!="0"%>pollcolor{styleid}<%/if%>" style="width:{polloption[percentwidth]}px"></div>
			</div>
		</td>
		<td>
			<strong>{polloption[value]}</strong>票 / {polloption[percent]}
		</td>
	</tr>
	<%/if%>
	</tbody>
	<%/loop%>
	<script language="javascript">
	var max_obj = {pollinfo.maxchoices};
	var p = 0;
	
	function checkbox(obj) {
		if(obj.checked) {
			p++;
			for (var i = 0; i < $('postsform').elements.length; i++) {
				var e = $('postsform').elements[i];
				if(p == max_obj) {
					if(e.name.match('pollitemid') && !e.checked) {
						e.disabled = true;
					}
				}
			}
		} else {
			p--;
			for (var i = 0; i < $('postsform').elements.length; i++) {
				var e = $('postsform').elements[i];
				if(e.name.match('pollitemid') && e.disabled) {
					e.disabled = false;
				}
			}
		}
	}	   
	 
	function displayvoter(objid) {
		if(objid.style.display == 'block') {
		   objid.style.display = 'none';
		}
		else {
		   objid.style.display = 'block';
		}
	}	    
	</script>
	<tr>
		<td colspan="2">
			<%if {usergroupinfo.allowvote}==1%>
				<%if {allowvote}%>
					<button  name="Submit" onclick="$('postsform').action='poll.aspx?topicid={topicid}';$('postsform').submit();" >马上投票</button>
				<%else%>							
					提示: 您已经投过票或者投票已经过期
				<%/if%>			
			<%else%>
				抱歉,您所在的用户组没有参与投票的权限,请注册或登录!
			<%/if%>
		 </td>
	</tr>
	<%if {voters}!=""&&(pollinfo.Allowview==1||pollinfo.Uid==userid||ismoder==1)%>   
	<tbody>
	<tr>
		<td colspan="2">
			<button type="button" onclick="showWindow('mods', 'misc.aspx?action=viewvote&tid={topicid}');return false;" class="pn"/><span>查看投票用户名单>></span></button>
		</td>
	</tr>
	</tbody>
	<%/if%>
	<%if {showpollresult}&&{config.silverlight}==1%>
	<tbody>
		<tr>
		<td colspan="2"><iframe src="silverlight/piechart/index.html?topicid={topicid}&bg=FFFFFF" allowtransparency="yes" width="95%" height="425" border="0" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" ></iframe>
		</td>
		</tr>
	</tbody>
	<%/if%>
	</table>
</div>
<%/if%>