[TWIG]
<script type="text/javascript">
	var vajax = new sack();
	function make_vote(mode) {
		var form = document.getElementById('voteForm');
		var choice = -1;

		// Return true (to run normal mode) if AJAX failed
		if (vajax.failed)
			return true;

		for (i = 0; i < form.elements.length; i++) {
			var elem = form.elements[i];
			if (elem.type == 'radio') {
				if (elem.checked == true) {
					choice = elem.value;
				}
			}
		}

		var voteid = form.voteid.value;
		if (mode && (choice < 0)) {
			alert('{{ lang.theme.vote_option }}');
			return false;
		}

		if (mode) {
			vajax.setVar("mode", "vote");
			vajax.setVar("choice", choice);
		} else {
			vajax.setVar("mode", "show");
		}
		vajax.setVar("style", "ajax");
		vajax.setVar("voteid", voteid);
		vajax.setVar("list", 0);
		vajax.requestFile = "{post_url}";
		vajax.method = 'POST';
		vajax.element = 'voting_ng';
		vajax.runAJAX();
		return false;
	}
	vajax.onComplete = function () {

		$('.answer').each(function () {
			var el = $(this);
			var prsEl = el.find('.answer-progress');
			var width = prsEl.data('width');
			prsEl.animate({width: width}, 1500);
		});

	};
</script>
<div class="sidebarblock" id="voting_ng">
	<h3>{{ lang.theme.vote_title }}</h3>
	<div class="divline"></div>
	<div class="blocktxt">
		<p>{votename}</p>
		<form action="{post_url}" method="post" id="voteForm" class="form">
			<input type=hidden name=action value=vote />
			<input type=hidden name=voteid value="{voteid}" />
			<input type=hidden name=referer value="{REFERER}" />
			<table class="poll">
				{votelines}
			</table>
			<button class="btn btn-primary btn-block" type="submit" onclick="return make_vote(1);">{{ lang.theme.vote_button }}</button>
			<button class="btn btn-outline-primary btn-block" type="button" onclick="return make_vote(0);">{{ lang.theme.vote_results }}</button>
		</form>
	</div>
</div>
[/TWIG]