function vote_callback(data){green="#95FF83"
red="#FF6358"
color=data.success?green:red;var poll_id="#poll-"+data.poll_id;message=$(poll_id+" > .poll-footer > .poll-message")
message.text(data.message);message.show("slow");message.animate({backgroundColor:color},1000).animate({backgroundColor:"white"},1000);if(data.success){for(var i in data.results){$("#votes-choice_"+i).html(data.results[i]);var percentage=Math.round(100*(data.results[i]/data.total));$("#percent-choice_"+i).html(percentage);$("#poll_bar_"+i).width(percentage+"%")}
$(poll_id+" > .poll-form").hide("slow");$(poll_id+" > .poll-results").show("slow");}}
$(document).ready(function(){$(".poll-results").hide();$(".show-form").hide();$(".show-results").click(function(){$(this).parent().prevAll(".poll-results").slideToggle();$(this).parent().prevAll(".poll-form").slideToggle();$(this).hide();$(this).siblings(".show-form").show();});$(".show-form").click(function(){$(this).parent().prevAll(".poll-form").slideToggle();$(this).parent().prevAll(".poll-results").slideToggle();$(this).hide();$(this).siblings(".show-results").show();});$(".poll-submit").submit(function(){form_data={}
form_data['choice']=$(this).children(":input:radio:checked").val();var url=$(this).parent().siblings(".poll-info").text().trim()
$.post(url,form_data,vote_callback,'json');return false;});});
