jQuery(function ($) {
$(document).ready(function(){
  var opened=false;
  
  $('a.close').click(function(){
    if(opened){
      $("#outils").animate({"top": "-=238px"},"slow" );
    } else {
        $("#outils").animate({"top": "+=238px"},"slow" ); 
    }
    opened = opened ? false : true;
  });
  
 $("a.facebook").hover(function() { 
        $(this).animate({ "marginTop": "-15px" }, 200);
    },function(){ 
        $(this).animate({ "marginTop": "0px" }, 300);
    });
    
 $("#twitter").hover(function() { 
        $("#twitter").animate({ "marginTop": "-15px" }, 200); 
    },function(){ 
        $("#twitter").animate({ "marginTop": "0px" }, 300);
    });
      
  
 $("#viadeo").hover(function() { 
        $("#viadeo").animate({ "marginTop": "-15px" }, 200);
    },function(){ 
        $("#viadeo").animate({ "marginTop": "0px" }, 300); 
    });

     
  var autowidth = $('#menu_content ul.parent> li').length;
  $('#menu_content').css({'width' : + 125*autowidth +'px'});
  
  $('#menu ul.parent li > ul').css({'display':'none'});
  
  $('#menu ul.parent li').hover(function() { $('ul', this).fadeIn('normal');}, function() { $('ul', this).fadeOut();});
  
  $('#inner').innerfade({
  speed : 'slow',
  animationtype : 'fade',
  type : 'random',
  timeout : 7000
  });
  
  $("#slider").easySlider({
    auto: true,
    continuous: true,
    speed: 1000,
    pause: 10000,
    prevId: 		'fleche_G',
    nextId: 		'fleche_D',
    prevText: 		'gauche',
    nextText: 		'droite'
  });

  //Get all the LI from the #tabMenu UL
  $('#tabMenu > li').click(function(){
        
    //remove the selected class from all LI    
    $('#tabMenu > li').removeClass('selected');
    
    //Reassign the LI
    $(this).addClass('selected');
    
    //Hide all the DIV in .boxBody
    $('.boxBody div').hide();
    
    //Look for the right DIV in boxBody according to the Navigation UL index, therefore, the arrangement is very important.
    $('.boxBody div:eq(' + $('#tabMenu > li').index(this) + ')').fadeIn('1500');
    
  }).mouseover(function() {

    //Add and remove class, Personally I dont think this is the right way to do it, anyone please suggest    
    $(this).addClass('mouseover');
    $(this).removeClass('mouseout');   
    
  }).mouseout(function() {
    
    //Add and remove class
    $(this).addClass('mouseout');
    $(this).removeClass('mouseover');    
    
  });

  //Mouseover with animate Effect for Category menu list
  $('.boxBody #category li').mouseover(function() {

    //Change background color and animate the padding
    $(this).css('backgroundColor','#888');
    $(this).children().fadeOut();
  }).mouseout(function() {
    
    //Change background color and animate the padding
    $(this).css('backgroundColor','');
    $(this).children().fadeIn();
  });  
	
  //Mouseover effect for Posts, Comments, Famous Posts and Random Posts menu list.
  $('.boxBody li').click(function(){
    window.location = $(this).find("a").attr("href");
  }).mouseover(function() {
    $(this).css('backgroundColor','#888');
  }).mouseout(function() {
    $(this).css('backgroundColor','');
  });  	

});
});

