
/* ************************************************ */


function defilement_bandeau(a, b, wb ) //, w, h, c)
/*
a : rad/s
b : px
wb : px, largeur bandeau
/*
a : px/s
c : rad/s
w : largeur image
h : longueur image
*/
{
	this.style = document.getElementById('defilement_bandeau').style ;
	this.a = a ;
	this.b = b ;
	this.largeur_bandeau = wb
	this.modulo = Math.PI*this.largeur_bandeau/this.b
	this.distance_arret = this.b/Math.PI
	/*
	this.c = .2 ;
	this.width = w ;
	this.height = h ;
	*/
	

	if (ie) chemin_relatif = 'images/site/bandeau/pub/20080930_lotopassion.jpg' ;
	else chemin_relatif = 'images/site/bandeau/pub/20080930_lotopassion.png' ;

	
	this.style.backgroundImage = 'url('+chemin_relatif+')' ;
	
	defile_pub(this) ;
}
var bandeauAnimation = false ;
var bandeau_loop ;
function BandeauAnimation()
{
	bandeauAnimation = !bandeauAnimation
	if (bandeauAnimation)
	{
		bandeau_loop = setInterval('defile_pub(defilement_bandeau);', 51) ;
	}
	else
	{
		clearInterval(bandeau_loop) ;
	}
}

function defile_pub(pub) 
{
	var coeff = 100;
	chrono = new Date() ;
	t = chrono.getTime()/coeff ;
	x = fbx(pub, t) ;
	pub.style.backgroundPosition = x+'px 0px' ;
	opacity = fbo(pub, x) ;
	pub.style.opacity = opacity ;
	pub.style.filter = 'alpha(opacity='+(opacity*100)+')' ;
} 
function fbx(pub, t)
{
	alpha = (t*pub.a)%pub.modulo
	// return Math.round(pub.a*t + pub.b*(Math.cos(rad)+Math.cos(rad/2)-.5)/1.5)%pub.width ; 
	return Math.round( (alpha+Math.sin(alpha))*pub.distance_arret ) ; 
}
function fbo(pub, x)
{
	op = Math.min(1, Math.max(0,x/pub.b))
	return Math.max(op, 0) ; 
}

var defilement_bandeau = new defilement_bandeau(.18,	115,	320) //100,	600,	60) ;
BandeauAnimation() ;

liste_span = document.getElementById('texte_bandeau').getElementsByTagName('span') ;
var scan_span_num = 0 ;
var couleur = 'black' ;
var couleur2 = '#FF8500' ;
var couleur3 = '#e01413' ;
setInterval('scan_texte()',167) ;
function scan_texte()
{
	if (scan_span_num==0)
	{
		if (couleur == couleur2)
		{
			couleur = couleur3 ;
		}
		else
		{
			couleur = couleur2 ;
		}
	}
	liste_span[scan_span_num].style.color = couleur ;
	scan_span_num = (scan_span_num + 1)%liste_span.length
}