var timer;
var time = 2000;
var compteur = 1;
var total = 5;
var timer_fondu;
var time_fondu = 50;
var ecart_fondu = 0.1;
var coeff = -1;
var op = 1;

window.onload = function()
{
	timer = setTimeout('fondu()', time);
}

function fondu()
{
	timer_fondu = setTimeout('fondu2()', time_fondu);
	
}

function fondu2() 
{
	var conteneur = document.getElementById( "diaporama_roller" );
	var image = document.getElementById( "conteneur_roller" );
	op = op + coeff * ecart_fondu;
	opIE = 100 * op
	image.style.opacity = op;
	image.style.filter = 'alpha(opacity='+opIE+')';
	
	if ( op > 1 )
	{
		coeff = -1;
		timer = setTimeout('fondu()', time);
	}
	else if ( op < 0 )
	{
		compteur = compteur + 1;
		if ( compteur > total )
		{
			compteur = 1;	
		}
		image.style.backgroundImage = 'url(images/roller_' + compteur + '.jpg)';
		
		coeff = 1;
		timer_fondu = setTimeout('fondu2()', time_fondu);
	}
	else 
	{
		timer_fondu = setTimeout('fondu2()', time_fondu);
	}
}
