var curDiaporama = -1;
var timerIllustration = 0;
var timerIllustration_Delay = 8000;

$(document).ready(function () {
	//Lance les codes de chargements commun à toutes les pages
    Page_Init();
	
	//Active la lightbox
	$("a[rel^='prettyPhoto']").prettyPhoto({theme: 'facebook', opacity: 0, showTitle:false});
	
	//Charge le diaporama
	Illustration_Afficher();
});

function Page_Init() 
{
	//Mappe la police Swiss
	Cufon.replace('h1', { fontFamily: 'kozuka' });
	Cufon.replace('h2', { fontFamily: 'kozuka' });
	
    try { JS_Page_Load(); } catch (ex) { }
}

function Illustration_Afficher()
{	
	window.clearInterval(timerIllustration);
	
	//Affiche l'illustration
	curDiaporama++;
	if (curDiaporama >= tIllustration.length) { curDiaporama = 0; }
          
	var img = new Image();
	$(img).load(function () {    
        $(this).hide();  
		$('#Illustration_Photo').fadeOut("slow", function()
			{  
				$('#Illustration_Photo').empty();
				$('#Illustration_Photo').append(img);  
				$(img).show();
				$('#Illustration_Photo').fadeIn("slow");
				
				
				if (tIllustration.length > 1) { timerIllustration = window.setInterval('Illustration_Afficher()', timerIllustration_Delay) };
			}
		);			
	}).error(function () {
	}).attr('src', tIllustration[curDiaporama]);
}


