<!-- poll block -->

{assign var='lang_site' value=$smarty.const.RL_LANG_CODE}

{if $poll}
	<div class="poll-container" id="poll_container_{$poll.ID}">
		{if $poll.voted}
			{if $poll.Random == 1 || $block.Header == 0}
				<header class="poll-header"><b>{$poll.name.$lang_site}</b></header>
			{/if}
			
			<ul class="poll-votes">
				{include file=$smarty.const.RL_PLUGINS|cat:'polls'|cat:$smarty.const.RL_DS|cat:'results.tpl'}
			</ul>
			
			<div class="poll-total">{$lang.total_votes}: <b>{$poll.total}</b></div>
		{else}
			{if $poll.Random == 1 || $block.Header == 0}
				<header class="poll-header"><b>{$poll.name.$lang_site}</b></header>
			{/if}

			<div class="poll-inquirer">
				<ul class="poll-answer">
				{foreach from=$poll.items item='poll_item'}
					<li>
						<span style="background: {$poll_item.Color};"></span>
						<label><input type="radio" name="poll_{$poll.Key}" value="{$poll_item.Key}" /> {$poll_item.name.$lang_site}</label>
					</li>
				{/foreach}
				</ul>

				<div class="poll-nav">
					<div class="two-inline {$text_dir}">
						<div><input type="button" value="{$lang.vote}" id="vote_button_{$poll.ID}" /></div>
						<div class="ralign"><span class="link">{$lang.polls_view_results}</span></div>
					</div>
				</div>
			</div>

			<div class="poll-results hide">
				<ul class="poll-votes" id="poll_results_{$poll.ID}">
					{include file=$smarty.const.RL_PLUGINS|cat:'polls'|cat:$smarty.const.RL_DS|cat:'results.tpl'}
				</ul>

				<div class="poll-total">{$lang.total_votes}: <b>{$poll.total}</b></div>

				<div class="poll-results-nav ralign">
					<span class="link">{$lang.polls_back_for_vote}</span>
				</div>
			</div>
		{/if}

		<script id="pollItem" type="text/x-jquery-tmpl">
		{literal}

		${($data.lang_votes = '{/literal}{$lang.votes}{literal}'),''}

		<li>
		    <div>${name.en} (<b>${Votes}</b> ${lang_votes})</div>
		    <div style="width: {{if percent < 10}}10{{else percent >= 10 && percent < 70}}${percent*1.25}{{else}}${percent}{{/if}}%; background: ${Color};color: {{if Color == '#ffffff'}}#000000{{else}}#ffffff{{/if}};">
		        ${percent}%
		    </div>
		</li>

		{/literal}
		</script>
	</div>
{else}
	{$lang.polls_not_created}
{/if}

<!-- poll block end -->