var OPT_ID=0;var OPT_TITLE=1;var OPT_VOTES=2;var PROCESSOR="";var QUESTIONID="";var votedID;jQuery(document).ready(function(){PROCESSOR=jQuery("#poll").attr("action");QUESTIONID=jQuery("#poll").attr("rel").replace("question","");jQuery("#poll").submit(formProcess);if(jQuery("#poll-results").length>0){animateResults()}if(jQuery.cookie("VOTE_ID")&&jQuery.cookie("VOTE_ID")==QUESTIONID){jQuery("#poll-container").empty();votedID=jQuery.cookie("VOTE_ID");jQuery.ajax({type:"POST",url:PROCESSOR,data:"vote=none",success:function(a){jQuery("#poll-container").html(jQuery.trim(a)).fadeIn("slow",function(){animateResults()})},dataType:"html"})}});function formProcess(a){a.preventDefault();var c=jQuery("input[name='poll']:checked").attr("value");c=c.replace("opt","");var b=jQuery("#poll").attr("rel").replace("question","");jQuery("#poll-container").fadeOut("slow",function(){jQuery(this).empty();votedID=c;jQuery.ajax({url:PROCESSOR,type:"POST",data:"vote="+c,success:function(d){jQuery("#poll-container").html(jQuery.trim(d)).fadeIn("slow",function(){animateResults()})},dataType:"html"});jQuery.cookie("VOTE_ID",b,{path:"/",expires:365})})}function animateResults(){jQuery("#poll-results div").each(function(){var a=jQuery(this).next().text();jQuery(this).css({width:"100%"}).animate({width:a},"slow")})}function loadResults(c){var d=0;var b;for(id in c){d=d+parseInt(c[id][OPT_VOTES])}var a="<div id='poll-results'><h3>Poll Results</h3>\n<dl class='graph'>\n";for(id in c){b=Math.round((parseInt(c[id][OPT_VOTES])/parseInt(d))*100);if(c[id][OPT_ID]!==votedID){a=a+"<dt class='bar-title'>"+c[id][OPT_TITLE]+"</dt><dd class='bar-container'><div id='bar"+c[id][OPT_ID]+"'style='width:0%;'>&nbsp;</div><strong>"+b+"%</strong></dd>\n"}else{a=a+"<dt class='bar-title'>"+c[id][OPT_TITLE]+"</dt><dd class='bar-container'><div id='bar"+c[id][OPT_ID]+"'style='width:0%;background-color:#0066cc;'>&nbsp;</div><strong>"+b+"%</strong></dd>\n"}}a=a+"</dl><p>Total Votes: "+d+"</p></div>\n";jQuery("#poll-container").append(a).fadeIn("slow",function(){animateResults()})}function showResults(a){alert("hi");console.log(jQuery.trim(a));jQuery("#poll-container").html(jQuery.trim(a)).fadeIn("slow",function(){animateResults()})};