// PAGE ACCUEIL
jQuery(function($){
        
    init_all_pages();
    
    
    $("#boite_expertise, #boite_nouvelles").click(function(){
        $(this).addClass("selected");
		var myurl = makeURL( $(this).attr("id").substring(6), "" );
		window.document.location.href = myurl;
    })
    
	$("#boite_servir_sante").click(function(){
        $(this).addClass("selected");
		var myurl = makeURL( $(this).attr("id").substring(6), "" );
		var newurl = myurl.replace("servir_sante","servir/sante");
		window.document.location.href = newurl;
    })
   
	
    
    // preLoad illustration
    $("#acc_illustration img").preload({
        // placeholder:'placeholder.jpg',
        // notFound:'notfound.jpg'
        onFinish: ill_start,
        threshold: 2
    });
     
});



	
	
function ill_start()
{
    ill_set( Math.floor(Math.random()*3) );        
}
 

function ill_set(idx)
{
    var int_timeOut = 10*1000;    
    for(var i=1; i<=3; i++)
    {
        if (i != (idx+1) )
        {
            if ( $("#content div.boite_bas").eq(i-1).hasClass("focus") )
            {
                $("#content div.boite_bas").eq(i-1).removeClass("focus");
            }
            $("#ill_"+ i).fadeOut(int_timeOut/2).css({zIndex:1});
        }
    }
    $("#ill_"+ (idx+1) ).fadeIn(int_timeOut/2).css({zIndex:500});
    $("#content div.boite_bas").eq(idx).addClass("focus");
    
    idx = (idx+1) % 3;
    setTimeout("ill_set("+idx+")", int_timeOut); 
}



