$(document).ready(function() {
	var bg = $("#page #aside #focus").attr('rel');
	var bgdefault = '/v1/images/gen/bg_default.png';
	
	if(bg.length > 0) {
		$('#fond_pub').css('background-image', 'url(' + bg + ')'); // Pour charger l'image en même temps que la page
	}
	// Affichage du fond
	$('#page #aside #focus').hover(
		function() {
			var colors = $(this).attr('class').split('|');
			var liens = "#" + colors[0];
			var fond = "#" + colors[1];
			
			if(fond.length > 7) 
			{
				$('body').css('background-image', 'url(' + colors[1] + ')'); 
				$('body').css('background-repeat', 'repeat');
			}
			
			$("nav ul li:last-child a").css('color', '#fff');
			$("#page a").stop().animate({ 'color' : liens }, 100);
			if(fond.length > 7) { $('body').stop().animate({ backgroundColor: fond }, 100); }
			$('#fond_pub').stop().animate({opacity: 1});
		},
		function() {
			$("nav ul li:last-child a").css('color', '#707070');
					
			$('body').css('background-image', 'url(' + bgdefault + ')'); 
			$('body').css('background-repeat', 'repeat-x');
			
			$("#page a").stop().animate({ 'color' : '#1d5894' }, 100);
			$('body').stop().animate({ backgroundColor: "#fff" }, 200);
			$('#fond_pub').css('background-color', 'transparent');
			$('#fond_pub').stop().animate({opacity: 0});
		}
	);
});