window.addEventListener?window.addEventListener('load',so_init_bandeau,false):window.attachEvent('onload',so_init_bandeau);

var d=document, imgsB = new Array(), zIntervalB = null, currentB=0, pauseB=false;

function so_init_bandeau()
{
	if(!d.getElementById || !d.createElement)return;

	css = d.createElement('link');
	css.setAttribute('href','/inc/javascript/xfade/slideshow2_bandeau.css');
	css.setAttribute('rel','stylesheet');
	css.setAttribute('type','text/css');
	d.getElementsByTagName('head')[0].appendChild(css);

	imgsB = d.getElementById('bandeau_head').getElementsByTagName('img');
	for(i=1;i<imgsB.length;i++) imgsB[i].xOpacity = 0;
	imgsB[0].style.display = 'block';
	imgsB[0].xOpacity = .99;
	document.getElementById("bandeau_head").style.display="block";
	
	setTimeout(so_xfade_bandeau,10000);
}

function so_xfade_bandeau()
{
	

	cOpacity = imgsB[currentB].xOpacity;
	nIndex = imgsB[currentB+1]?currentB+1:0;
	nOpacity = imgsB[nIndex].xOpacity;

	
	
	
	cOpacity-=.05;
	nOpacity+=.05;

	imgsB[nIndex].style.display = 'block';
	imgsB[currentB].xOpacity = cOpacity;
	imgsB[nIndex].xOpacity = nOpacity;

	setOpacity(imgsB[currentB]);
	setOpacity(imgsB[nIndex]);

	if(cOpacity<=0)
	{
		imgsB[currentB].style.display = 'none';
		currentB = nIndex;
		setTimeout(so_xfade_bandeau,10000);
	}
	else
	{
		setTimeout(so_xfade_bandeau,50);
	}

	function setOpacity(obj)
	{
		if(obj.xOpacity>.99)
		{
			obj.xOpacity = .99;
			return;
		}

		obj.style.opacity = obj.xOpacity;
		obj.style.MozOpacity = obj.xOpacity;
		obj.style.filter = 'alpha(opacity=' + (obj.xOpacity*100) + ')';
	}
}