// --- R�f�rences bas de page accueil -------------------
(function($) {
	$(function() { //on DOM ready
		$("#scroller").simplyScroll({
			autoMode: 'loop'
		});
	});
})(jQuery);

// --- Slider haut de page accueil ----------------------
$(function() {
        $("div#pubs").jFlow({
            slides: "#slides",
            width: "600px",
            height: "286px"
        });
});

// --- Divs main suppersos�s (r�cup�ration de la hauteur) -------
$(document).ready(function(){
    resizeHeight();
    setTimeout(function(){resizeHeight();}, 2000);
});

function resizeHeight()
{
    var hauteur = ($("#main").height());
    $("#main2").height(hauteur);
    $("#main_wrap").height(hauteur);
}

// ----- Paragraphes cach�s milieu accueil -----------------

		
// ----- Bouton haut de page ---------------------------------
        $(window).scroll(function() {
      if($(window).scrollTop() == 0){
        $('#scrollToTop').fadeOut("fast");
      } else {
        if($('#scrollToTop').length == 0){
          $('body').append('<div id="scrollToTop">'+
            '<a href="#">Haut de page</a>'+
            '</div>');
        }
        $('#scrollToTop').fadeIn("fast");
      }
    });
    
    $('#scrollToTop a').live('click', function(event){
  event.preventDefault();
  $('html,body').animate({scrollTop: 0}, 'slow');
});


// ----- tooltips -----------------------------------------------
this.tooltip = function(){	
	/* CONFIG */		
		xOffset = 10;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("a.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

$(document).ready(function(){
    $('.click').click(function()
    {
        $('.click').removeClass('current');
        $('.conteneur').slideUp('normal');
        
        if($(this).next().is(':hidden') == true)
        {
            $(this).addClass('current');
            $(this).next().slideDown('normal');
	} 
    });	
    $('.conteneur').hide();
});
