function ouvreOnglet(onglet)
{	
	if (!$(onglet).hasClass("init"))	
	{
	
		$("#accordeon ul li:not(.init)").stop().animate({
			width: "58px"
		}, 150, function() {
			// Animation complete.
		});
		
		$(onglet).stop().animate({
			width: "241px"
		}, 150, function() {
			// Animation complete.
		});
		
	}
}

function fermeOnglet(onglet)
{
	if (!$(onglet).hasClass("init"))	
	{
	
		$(onglet).stop().animate({
			width: "58px"
		}, 150, function() {
			// Animation complete.
		});
		
		$(".open").stop().animate({
			width: "241px"
		}, 150, function() {
			// Animation complete.
		});
	
	}
}

$(document).ready( function()
{	
	// -----------------------------------------------------------------------------------------
	// Accordéon :
	// -----------------------------------------------------------------------------------------
		
		/*$("div.overflow").animate({
			opacity: "0.5"
		}, 20, function() {
			// Animation complete.
		});*/
		
		$("#accordeon ul li.open").children(".overflow").fadeOut("fast");
		
		$(".bgssmenu").animate({
			opacity: "0.9"
		}, 50, function() {
			// Animation complete.
		});
	
		$("#accordeon ul li").mouseenter(function(){
			ouvreOnglet(this);			
		});

		$("#accordeon ul li:not(.open)").mouseleave(function(){
			if (!$(this).hasClass("init")) // !$(this).hasClass("open")
			{
				fermeOnglet(this);
			}
		});
		
		// -----------------------------------------------------------------------------------------
	
		$("#accordeon ul li").mouseenter(function(){
			$(this).children(".bgssmenu").fadeIn("fast");
			$(this).children(".ssmenu").fadeIn("fast");
		});
		
		$("#accordeon ul li").mouseleave(function(){
			$(this).children(".bgssmenu").fadeOut("fast");
			$(this).children(".ssmenu").fadeOut("fast");
		});
	
	// -----------------------------------------------------------------------------------------
	// Scroll
	// -----------------------------------------------------------------------------------------
	
	// Permet de remonter en haut de la page :
	$("#haut_de_page a").click(function(){
		jQuery("html, body").animate({ scrollTop: 0 }, "slow");
		return false;
	});
	
	// Permet de remonter en haut de la page :
	$("a.remonte").click(function(){
		jQuery("html, body").animate({ scrollTop: 407 }, "slow");
		return false;
	});
	
	// -----------------------------------------------------------------------------------------
	// Effets sur les images des galeries de photos :
	// -----------------------------------------------------------------------------------------

	$(".galerie_photos img").mouseover(function(){
	   $(this).animate({
		opacity: 0.8
	  }, 200 );
	});

	$(".galerie_photos img").mouseout(function(){
	   $(this).animate({
		opacity: 1
	  }, 200 );
	});
	
	// -----------------------------------------------------------------------------------------
	// Corners
	// -----------------------------------------------------------------------------------------
	
	$(".tableau_de_bord, .pb_droit, .confirme, .erreur, .informations, .chargement, .ajoute, .mots_cles, .pager").corner("8px");
	$("#consultez-vos-resultats").corner("4px");
	
	// -----------------------------------------------------------------------------------------
	// LightBox
	// -----------------------------------------------------------------------------------------

	$("a.affichephoto").lightBox();
});
