/*
This Javascript file manages the rotation of the pieces of information on the right side.
It is called by "common.php".
*/


var news_speed = 8000// the news' rotation speed
var l; // "l" will be equal to the number of news.
var d; // "d" will be between 0 and "l-1"
var text_news = new Array(); // to stock the information texts
var link_news = new Array(); // to stock the addresses reached by clicking on the information texts
var version_news = navigator.appVersion.substring(0,1);


function randomInt_news(mini, maxi)
	{
		var nb = mini + (maxi+1-mini)*Math.random();
		return Math.floor(nb);
	}


function StartAnim_news(d, l)
	{
		if (version_news >= 3)	{ // If the version of the browser is recent, we will lauch the turns
			// The name and id "defil_news" is very important. It will allow to change the piece of news of the <div> tag.		
			if (link_news[d]!="")
				document.write('<div id="defil_news"><a href="' + link_news[d] + '" alt="news" target="_blank" id="news_t">' + text_news[d] + '<a/></div>');
			else
				document.write('<div id="defil_news"><a href="#" alt="news" id="news_t">' + text_news[d] + '<a/></div>');			
			defil_news(l); // We lauch the turns.	
			
		}
		else	{
			if (link_news[d]!="")
				document.write('<div id="defil_news"><a href="' + link_news[d] + '" alt="news" target="_blank" id="news_t">' + text_news[d] + '<a/></div>');
			else
				document.write('<div id="defil_news"><a href="#" alt="news" id="news_t">' + text_news[d] + '<a/></div>');				
		}
	}


function defil_news(l)
	{
		if (d == l)	{
			d = 0;
		}
		if (version_news >= 3)	{
			// We change the content of the tag whose id is "vac".
			// Automatically, it will change the piece of news...
			if (link_news[d]!="")
				document.getElementById('defil_news').innerHTML = 
					'<a href="' + link_news[d] + '" alt="news" target="_blank" id="news_t">' + text_news[d] + '<a/>'
					;
			else
				document.getElementById('defil_news').innerHTML = 
					'<a href="#" alt="news" id="news_t">' + text_news[d] + '<a/>'
					;
			tempo3_news = setTimeout("defil_news(l)", news_speed);
			d++;
		}
	}
