﻿function focusNews(id, img)
{
	stop_diaporama();
	montre_home(id, img);
}
function montre_home(id)
{
	currentHomeNews = id;
	document.getElementById("img_home_news").style.backgroundImage = 'url(' + document.getElementById("img_background_"+id).src + ')';
	for(var i = 0 ; i < NbHomeNewsMax ; i++)
	if(i == id)
	{
		document.getElementById("div_home_"+i).style.display = "block";
		document.getElementById("lien_home_"+i).style.border = 'solid 2px red';
	}
	else
	{
		document.getElementById("div_home_"+i).style.display = "none";
		document.getElementById("lien_home_"+i).style.border = 'solid 2px black';
	}
}
function init_diaporama(nb_max)
{
	NbHomeNewsMax = nb_max;
	currentHomeNews = -1;
	start_diaporama();
	routineDiaporama();
}
function routineDiaporama()
{
	if(diaporamaOn == 1)
	{
		if(currentHomeNews >= NbHomeNewsMax - 1)
			currentHomeNews = -1;
		montre_home(currentHomeNews + 1);
	}
	setTimeout('routineDiaporama()',30000000);
}
function start_diaporama()
{
	diaporamaOn = 1;
}
function stop_diaporama()
{
	diaporamaOn = 0;
}