
paraDelai= 2500;
deplaceDelai= 50;
noTicker= -1;
nbTickers= 0;
posEnCours=0;
sousPosEnCours=75;
//Choisir le sens de défilement
//sensDefil="left";
sensDefil="top";

function initTicker()
{
  Tickers = document.getElementById('ticker').getElementsByTagName('P');
  nbTickers = Tickers.length;
	if (nbTickers > 0) {
		if (sensDefil == "left") {
			noTicker = 0;
			Tickers[noTicker].style.display = 'block';
			posEnCours = 0;
			sousPosEnCours=0;
			setTimeout("runTicker();",paraDelai);
			Tickers[noTicker].style.left = posEnCours + '.' + sousPosEnCours + '%';
		}
		else
			setTimeout("runTicker();",deplaceDelai);
	}
}


function runTicker()
{
	if (posEnCours == 0) {
		if (noTicker != -1) 
			Tickers[noTicker].style.display = 'none';
			
		noTicker++;
		if (noTicker >= nbTickers)
			noTicker = 0;
		
		Tickers[noTicker].style.display = 'block';
		delai = deplaceDelai;
		posEnCours = 50;
		if (sensDefil == "top") 
			posEnCours = 29;
	}
	else {
		delai = deplaceDelai;
		if (sensDefil == "top") {
			posEnCours--;
			if (posEnCours <= 0) {
				posEnCours = 0;
				delai = paraDelai;
			}
		}
		else {
			if (sousPosEnCours > 0)
				sousPosEnCours -= 25;
			else {
				posEnCours--;
				sousPosEnCours=75;
			}
			if ((posEnCours <= 0) && (sousPosEnCours==0)) {
				posEnCours = 0;
				delai = paraDelai;
			}
		}
	}
	
	if (sensDefil == "top") 
		Tickers[noTicker].style.top = posEnCours + 'px';
	else
		Tickers[noTicker].style.left = posEnCours + '.' + sousPosEnCours + '%';
	setTimeout("runTicker();", delai);
}

