<script type="text/javascript">
<!--{if $optiontype=='checkbox'}-->
	var max_obj = $maxchoices;
	var p = 0;
	function checkbox(obj) {
		if(obj.checked) {
			p++;
			for (var i = 0; i < $('poll').elements.length; i++) {
				var e = $('poll').elements[i];
				if(p == max_obj) {
					if(e.name.match('pollanswers') && !e.checked) {
						e.disabled = true;
					}
				}
			}
		} else {
			p--;
			for (var i = 0; i < $('poll').elements.length; i++) {
				var e = $('poll').elements[i];
				if(e.name.match('pollanswers') && e.disabled) {
					e.disabled = false;
				}
			}
		}
	}
<!--{/if}-->

	//public
	function showvoters(polloptionid) {
		var obj = document.getElementById('viewvoterframe'+polloptionid);
		var url = 'misc.php?action=viewvote&tid=$tid&sid=$sid&page=1&polloptionid='+polloptionid;
		showframe(obj, url);
	}

	//public
	function showallvoters() {
		var obj = document.getElementById('viewallvoterdiv');
		var url = 'misc.php?action=viewvote&tid=$tid&sid=$sid&page=1';
		showframe(obj, url);
	}

	//private
	function showframe(obj, url) {
		if(!obj.innerHTML) {
			obj.innerHTML = '<iframe width="100%" align="center" height="30" onload="setframeheight(this)" frameborder="0" scrolling="no" src="'+url+'"></iframe>';
		}
		if(obj.innerHTML) {
			obj.style.display = obj.style.display == '' ? 'none' : '';
		}
	}

	//private
	function setframeheight(obj) {
		obj.height = obj.contentDocument ? obj.contentDocument.body.scrollHeight + 30 : obj.Document.body.scrollHeight;
	}

</script>

<form id="poll" name="poll" method="post" action="misc.php?action=votepoll&fid=$fid&tid=$tid">
<input type="hidden" name="formhash" value="{FORMHASH}">
<div class="spaceborder" style="width: {TABLEWIDTH}">
<table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="100%" align="center">
<tr><td class="header" colspan="2">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr class="smalltxt" style="color: {HEADERTEXT}"><td class="bold">{lang poll_subject}: $thread[subject]&nbsp;
<!--{if $multiple}-->{lang poll_multiple}<!--{if $maxchoices}-->: {lang poll_more_than}<!--{/if}--><!--{else}-->{lang poll_single}<!--{/if}-->
<!--{if $expiration && $expirations > $timestamp}-->{lang poll_expiration}<!--{elseif $expiration && $expirations < $timestamp}-->{lang poll_finish}<!--{/if}-->
</td><td align="right"><a href="###" onclick="showallvoters()">{lang poll_view_voters}</a>
</td></tr></table>
</td></tr>
<tbody><tr><td id="viewallvoterdiv" style="display: none;" colspan="2"  class="altbg2"></td></tr></tbody>

<!--{loop $polloptions $key $option}-->
	<tr>
	<td class="altbg1" width="18%" valign="top">
	<!--{if $allowvote}-->
		<input class="checkbox" type="$optiontype" name="pollanswers[]" value="$option[polloptionid]" <!--{if $optiontype=='checkbox'}-->onclick='checkbox(this)'<!--{/if}-->>
	<!--{/if}-->
	$option[polloption]</td>
	<!--{if !$visiblepoll}-->
	<td class="altbg2"><div class="percent"><div style="width: $option[width]"></div></div><div class="percenttxt">&nbsp;&nbsp;$option[votes] <u>($option[percent]%)</u></div><!--{if $adminid == 1}--><div style="float:right"><a href="###" onclick="showvoters($option[polloptionid])">[{lang poll_show_voter}]</a></div><div id="viewvoterframe$option[polloptionid]" style="width:100%;clear:both;display:none"></div><!--{/if}--></td>
	<!--{else}-->
	<td class="altbg2"></td>
	<!--{/if}-->
	</tr>
<!--{/loop}-->
<!--{if $visiblepoll && $allowvote}--><tr><td class="altbg1"></td><td class="altbg2">{lang poll_after_result}</td></tr><!--{/if}-->
<!--{if $allowvote}--><tr class="bottom"><td class="altbg1"></td><td class="altbg2"><input class="button" type="submit" name="pollsubmit" value="{lang submit}"></td></tr>
<!--{elseif $visiblepoll}--><tr class="bottom"><td class="altbg1"></td><td class="altbg2">{lang poll_nopermission}</td></tr><!--{/if}-->
</table></div>

<br><br></form>