// Compressed file
$(document).ready(function(){

// Plugin roundbox
  $(".roundbox").corner("round 8px");
  
// Pré-chargement des images
  var image1 = $('<img >').attr('src', 'http://www.pensees-ecrites.net/img/1stars.png');
  var image2 = $('<img >').attr('src', 'http://www.pensees-ecrites.net/img/2stars.png');
  var image3 = $('<img >').attr('src', 'http://www.pensees-ecrites.net/img/3stars.png');
  var image4 = $('<img >').attr('src', 'http://www.pensees-ecrites.net/img/4stars.png');
  var image5 = $('<img >').attr('src', 'http://www.pensees-ecrites.net/img/5stars.png');

// Gestion du menu principal  
  $("#MENU").find("div").each(function(i) {
    $(this).mouseover(function() {
      $(this).css("background-position","bottom right");
    });
    $(this).mouseout(function() {
      $(this).css("background-position","top right");
    });
  });
  
// Gestion du système de votes
  // Dans le div global, on cherche les divs de citations
  $("#GLOBAL").find("div[id^='citbox']").each(function(i) {
  
    var starwidth;
    var citkey;

    // dans les divs de citations, on cherche le div VoteStars
      // On en déduit les variables citkey et starwidth
    $(this).find("div").each(function(i) {
      if(this.id.substring(0,9) == "VoteStars") {
        starwidth = $(this).css("width");
        citkey = this.id.substring(10);
      }
    });

    var imgvote = 'vote_'+citkey;
    
    // dans les divs de citations, on cherche les maps
    $(this).find("map").each(function(i) {
      // Evenements sur la map
      $(this).mouseover(function() {
        $("#VoteStars_"+citkey).css("width","65px");
      });
      $(this).mouseout(function() {
        $("#VoteStars_"+citkey).css("width", starwidth);
      });

      // Dans la map, on identifie les areas
      $(this).find("area").each(function(i) {
       // Evenements des areas
        $(this).mouseout(function() {
          $("#"+imgvote).attr("src", "http://www.pensees-ecrites.net/img/trans.gif");
        });
        $(this).mouseover(function() {
          $("#"+imgvote).attr("src", "http://www.pensees-ecrites.net/img/"+this.id.substring(8,9)+"stars.png");
        });
      });
    });
    // dans les divs de citations, on cherche le div TheVote
    $(this).find("div").each(function(i) {
      if(this.id.substring(0,7) == "TheVote") {
        // Evenements du div
        citkey = this.id.substring(8);
        $(this).mouseover(function() {
          $("#VoteStars_"+citkey).css("width","65px");
        });
        $(this).mouseout(function() {
          $("#VoteStars_"+citkey).css("width",starwidth);
        });
      }
    });
  });

// Gestion du qui a dit
    $("#WHOSAYS_BUTT").click(function() {
      $("#WHOSAYS").slideToggle("slow");
      $("#BIOS").slideToggle("slow");
    });
    $("#BIOS_BUTT").click(function() {

//      $("#BIOS").css("display","");
//      $("#WHOSAYS").css("display","none");
      $("#BIOS").slideToggle("slow");
      $("#WHOSAYS").slideToggle("slow");
    });

  
// File End
});