$(document).ready(function(){
    
    $('.list-pages li.current_page_item').append('<span></span>');
    
    $('table tr:nth-child(2n+1) td').addClass("td-bleu");
    $('table td:first-child').addClass("td-strong");
        
    $("#slider-idees").easySlider({
      auto: true,
      continuous: true,
      speed : 500,
      pause : 5000
    });
    
    Cufon.replace('h1, #page-sous-titre' ,{ fontFamily: 'Bebas Neue' });
    Cufon.replace('h2, h3, #footer div, #presentation .devis p, .navigation-titre', { fontFamily: 'Century Gothic' });
    
    $("#nav ul li").mouseover(function(){
        $(this).children("ul").slideDown('fast', 'backEaseOut').show();
    }).mouseleave(function(){
        $(this).children("ul").stop(true,true).slideUp('fast', 'backEaseIn');
    });
    
    $('h1').animate({ marginTop:'0', opacity:'1'}, 750, "backEaseInOut", function(){
        
       $('#page-sous-titre').animate({ marginLeft:'0', opacity:'1'}, 500, "backEaseInOut", function(){
         
            $('#page-contenu').animate({ marginLeft:'0', opacity:'1'}, 500, "backEaseInOut", function(){
                
                 $('#page-btns').animate({opacity:'1'}, 1000, "cubicEaseInOut");
            
            });
        
        });
        
    });
    
    //gestion du selected sur les parents
    $('.current_page_item').parent('ul').parent('li').children('a').addClass('selected');
    
    //changement couleur offres web
    $('#presence').mouseover(function(){$(this).addClass('border-rose');}).mouseleave(function(){$(this).removeClass('border-rose');});
    $('#dynamique').mouseover(function(){$(this).addClass('border-bleu');}).mouseleave(function(){$(this).removeClass('border-bleu');});
    $('#catalogue').mouseover(function(){$(this).addClass('border-vert');}).mouseleave(function(){$(this).removeClass('border-vert');});
    $('#ecommerce').mouseover(function(){$(this).addClass('border-orange');}).mouseleave(function(){$(this).removeClass('border-orange');});
   
    //changement couleurs header
	var colors = Array (
		'#1e2831', // bleu
		'#2f1e27', // rose
		'#23281b', // vert
		'#392d21' // orange
	);
	var x = 2000; // secondes x 1000
	var changeColor = function() {
		var rand = Math.floor((10 - 6) * Math.random());
		$("#header-extended-bg").animate({backgroundColor: colors[rand]}, 3000, "cubicEaseInOut");
	}
	var refreshing  = setInterval(changeColor, x);   
});
