[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 id="voting_ng">
	<h4>{votename}</h4>
	<form action="{post_url}" method="post" id="voteForm">
		<div style="margin: 10px 0;">
			{votelines}
		</div>
		<input type="hidden" name="mode" value="vote" />
		<input type="hidden" name="voteid" value="{voteid}" />
		<input type="hidden" name="referer" value="{REFERER}" />
		<button title="{{ lang.theme.vote_button }}" class="btn" type="submit" onclick="return make_vote(1);">{{ lang.theme.vote_button }}</button>
		<button title="{{ lang.theme.vote_results }}" class="btn" type="button" onclick="return make_vote(0);">{{ lang.theme.vote_results }}</button>
	</form>
</div>
[/TWIG]