/**************************************
*  GUI functions tool kit 
*  required jQuery
*      
* author:  erational(http://www.erational.org)
* version: 0.3
* date:    2010.09.29 - natsu yasumi mata !
* licence: GPL 2.0    
***********************************/


$(document).ready(function(){
      // Ajout puce menu deplie (racine uniquemment)
      $("#menu ul:first").children("li").each(function(){          
           if ($(this).children("ul").length)
                $(this).addClass("puce_unfold");
     });

     
      // Lien en spip_out s'ouvre ds une nouvelle fenetre
      // voir aussi http://blog.gaboweb.com/2009/07/02/target_blank-automatique-jquery-respecter-normes-xhtml-strictes/   
      $("a.spip_out").click(function(){
          window.open(this.href);   
          return false;       
      });
      
      // clic externe nouvelle fenetre
      $("a[rel*=external]").click(function(){
              this.target= "_blank";
      });
      
      
      // sommaire: legende (FIXME: le faire uniquement sur l'element suivant)      
      $(".home .legende").hide();
         
      $(".home .have_legende").hover(function(){
              $(".home .legende").show();        
      });      
      
      // le mouseout se fait sur la legende car elle passe dessus (ouf !)
      $(".home .legende").hover(function(){        
      },function(){
          $(this).hide();      
      });
      
       $(".home .legende").click(function(){        
          window.location.replace($(this).children("a").attr("href"));          
       });
       
       
       // rubrique: accordeon       
       if ($(".art_preview").length>0) {     // perf. ne lister que si des preview
          $(".art_preview .intro").hide();
          $(".art_preview .intro").parent().addClass("art_preview_disabled");
          
          
          $(".art_preview:first .intro").show();
          $(".art_preview:first .intro").parent().removeClass("art_preview_disabled");
          
          $(".art_preview h2 a").click(function(){
                  $(".art_preview .intro").parent().addClass("art_preview_disabled");    
                  $(".art_preview .intro").slideUp('quick');                   
                  $(this).parent().parent().removeClass("art_preview_disabled");
                  $(this).parent().parent().children().slideDown('slow'); //show();
                  return false;
          });
       } 
       

     
}); 




