
function vote(poll_id, nobars) {
	$selection = $(".pollContainer" + poll_id + " input:checked");
	$pollContainer = $('.pollContainer' + poll_id);
	
	if ($selection.length > 0) {
	
		$pollContainer.animate( { 'opacity': 0 }, "slow", function() {
		
			choice_id = $selection[0].value;
			
			$.get("/polls/vote/",
			    { 'poll': poll_id, 'choice': choice_id, 'cmd': 'vote', 'ajax': 'true', 'nobars': nobars },
				function(data){
					$pollContainer.replaceWith(data).animate({ 'opacity': 1 }, "slow");
				}
			);
			
		});
        
	} else {
	
		// Handle unchecked value
		$("#pollVoteStatus" + poll_id).html("<span style='color: red;'>Please select a choice before voting</span>");
		
	}
}
