function cre_cook0(nom,contenu) {
    document.cookie = nom + "=" + escape(contenu)+"; path=/";
}
   
function lit_cook(nom) {
    var deb,fin
    deb = document.cookie.indexOf(nom + "=")
    if (deb >= 0) {
       deb += nom.length + 1
       fin = document.cookie.indexOf(";",deb)
       if (fin < 0) fin = document.cookie.length
       return unescape(document.cookie.substring(deb,fin))
       }
    return ""
}
    
function vote(id_question,url_article){
  form = "#form_" + id_question;
  div_reponses = "#reponses_" + id_question;
  div_resultats = "#resultats_" + id_question;
  div_nb_votant = "#nb_votant_" + id_question;
  
  jQuery.get("/question-du-jour/reponse.php", jQuery(form).serialize() );
    
  cre_cook0("question_id_"+id_question,"1"); 
   
  if(url_article != undefined){ 
    document.location.href = url_article;
    return "";
  }  
  else{  
    jQuery(div_reponses).hide(); 
    jQuery(div_resultats).show(); 
      
    votants = parseInt(jQuery(div_nb_votant).html()) + 1
    
    if(votants < 2)
      votants = votants + " votant"; 
    else
      votants = votants + " votants";
    
    jQuery(div_nb_votant).html(votants);
  }
  
  
}

function verifVote(id_question){
//   if( lit_cook("question_id_"+id_question) == "1"){
//     div_reponses = "#reponses_" + id_question;
//     div_resultats = "#resultats_" + id_question;  
//     jQuery(div_reponses).hide(); 
//     jQuery(div_resultats).show();
//   }
}   
