timerActu = null;
idActu = 1;


$(document).ready(function() {
	redimCitationsReferences();
	
	$("#accueil-g").wslide({
		width: 440,
		height: 300,
		horiz: true,
		duration: 1000,
		autolink: 'actu-pagination'
	});
	
	$("#actu-pagination a").click(function() {
		clearTimeout(timerActu);
	});
	
	defilerActu();
});

function redimCitationsReferences() {
	var h = 0;
	
	$(".bloc-bleu").each(function() {
		if ($(this).height() > h) h = $(this).height();
	});
	
	$(".bloc-bleu").height(h);
}

function defilerActu() {
	afficherActu(idActu);

	if (idActu+1 > $("#accueil-g ul#liste-actu li").length) idActu = 1;
	else idActu++;

	timerActu = setTimeout(function() {
		defilerActu();
	}, 8000);
}

function afficherActu(i) {
	$("#actu-pagination a:eq(" + (i-1) +")").click();
}
