<div id="poll_stats">
	<p>
		<b>{$poll_stats.poll_info.question}</b>
	</p>
	<p>
		<font class="text_hidden">{$lang.homepage.poll_created_by}:</font>
		{if $poll_stats.poll_info.user_id > 2}
			<a href="{$server}/{$seo.viewprofile}?id={$poll_stats.poll_info.user_id}">{$poll_stats.poll_info.login}</a>
		{else}
			{$poll_stats.poll_info.login}
		{/if}
	</p>
	{counter start=0 print=false}
	{foreach from=$poll_stats.answers_info item=item}
		<p>
			{$item.text}
		</p>
		<p style="white-space: nowrap;">
			<div percent="{$item.answers_percent}" class="vote_bar" style=" background: #{$item.color}"></div>
			{$item.answers_percent_100}%
		</p>
	{/foreach}
	<p>{$lang.poll.total_answers}: {$poll_stats.poll_info.summ_answers_count}</p>
</div>
{if $settings.allow_users_create_poll == '1' && !$greybox}
<div><a href="#" onclick="addPoll();">{$lang.homepage.poll_add_poll}</a></div>
{/if}
<div><a href="{$site_root}/{$seo.poll}">{$lang.homepage.poll_view_other}</a></div>

<script type="text/javascript">
	min_width = 2;
	max_width = 110;

	initAnswersBars();
{literal}
	function initAnswersBars(){
		$(".vote_bar").each(function(){
			width = Math.round(min_width+$(this).attr('percent')*max_width);
			$(this).width(width);
		});
	}
{/literal}
</script>