LANG_EXT="";POLL_TOTAL_VOTES="Total des votes:";POLL_ERR_NOVOTE="Sélectionnez votre choix avant de voter";POLL_DEFAULT_VOTE_COLOR="#3399FF";POLL_VISITOR_VOTE_COLOR="#FF9900";POLL_SHOW_TOTAL_VOTES=true;POLL_FADING="slow";POLL_PREVIEW_MODE=false;POLL_PREVIEW_MSG="Les sondages ne sont pas fonctionnels en aperçu local. Pour voter et voir les résultats du sondage vous devez publier votre site.";POLL_TITLES=new Array();POLL_COOKIES=new Array();POLL_TITLES["1"]="Sondage";POLL_COOKIES["1"]=true;var OPT_ID=0;var OPT_TITLE=1;var OPT_VOTES=2;var votedID=0;pollUID="";function pollFormProcess(event){event.preventDefault();var id=$("input[name='poll']:checked").attr("value");if(id==null||id==""||id=="undefined"){alert(POLL_ERR_NOVOTE);}else if(POLL_PREVIEW_MODE){alert(POLL_PREVIEW_MSG);}else{$("#poll-container").fadeOut(POLL_FADING,function(){$(this).empty();votedID=id;$.getJSON("../_iserv/poll/poll"+LANG_EXT+".php?uid="+pollUID+"&vote="+id,pollLoadResults);if(POLL_COOKIES[pollUID]){$.cookie('vote_'+pollUID,id,{expires:365,path:'/'});}else $.cookie('vote_'+pollUID,null,{expires:0,path:'/'});});}}function pollShowResults(){if(POLL_PREVIEW_MODE){alert(POLL_PREVIEW_MSG);}else{$("#poll-container").fadeOut(POLL_FADING,function(){$(this).empty();$.getJSON("../_iserv/poll/poll"+LANG_EXT+".php?uid="+pollUID+"&vote=none",pollLoadResults);});}return false;}function pollAnimateResults(){$("#poll-results div").each(function(){var percentage=$(this).next().text();$(this).css({width:"0%"}).animate({width:percentage},POLL_FADING);});}function pollLoadResults(data){var total_votes=0;var firstline=true;var percent,color;for(id in data)total_votes=total_votes+parseInt(data[id][OPT_VOTES]);var results_html='<div id="poll-results">';if(POLL_TITLES[pollUID]!='')results_html+='<h2>'+POLL_TITLES[pollUID]+'</h2>';results_html+='<dl class="poll-graph">';for(id in data){percent=Math.round((parseInt(data[id][OPT_VOTES])/parseInt(total_votes))*100);color=(data[id][OPT_ID]==votedID)?POLL_VISITOR_VOTE_COLOR:POLL_DEFAULT_VOTE_COLOR;if(!firstline){results_html+='<br style="clear:both;height:10px;" />';}else firstline=false;results_html+='<dt class="bar-title">'+data[id][OPT_TITLE]+'</dt><dd class="bar-container" style="border-style:solid;border-width:1px;"><div id="bar'+data[id][OPT_ID]+'" style="width:0%;background-color:'+color+';">&nbsp;</div><strong style="line-height:20px;font-family:Tahoma;font-size:12px;">'+percent+'%</strong></dd>';}results_html+='</dl><br/>';if(POLL_SHOW_TOTAL_VOTES)results_html+='<p>'+POLL_TOTAL_VOTES+' '+total_votes+'</p></div>';$("#poll-container").append(results_html).fadeIn(POLL_FADING,function(){pollAnimateResults();});}
