/*
	-----------------------------------------------
	Script : Rotation d'image
	Version 1.0
	-----------------------------------------------
	Site : http://www.dreaminvasion.com
	Par : Gerald LONLAS
	Email : webmaster@dreaminvasion.com
	-----------------------------------------------
*/

// variables
var imgList3 = new Array();
var zInterval3 = null;
var indice3=0;

// Change Opacit� de l'image
function setOpacity3(objet)
{
	if(objet.xOpacity>.99)
	{
		objet.xOpacity = .99;
		return;
	}

	objet.style.opacity = objet.xOpacity;
	objet.style.MozOpacity = objet.xOpacity;
	objet.style.filter = 'alpha(opacity=' + (objet.xOpacity*100) + ')';
}

// Fonction de changement des images (rotation)
function rotation3()
{
	cOpacity = imgList3[indice3].xOpacity;
	nIndex = imgList3[indice3 + 1]? indice3 + 1 : 0;
	nOpacity = imgList3[nIndex].xOpacity;

	cOpacity-=.05;
	nOpacity+=.05;

	imgList3[nIndex].style.display = 'block';
	imgList3[indice3].xOpacity = cOpacity;
	imgList3[nIndex].xOpacity = nOpacity;

	setOpacity3(imgList3[indice3]);
	setOpacity3(imgList3[nIndex]);

	if(cOpacity<=0)
	{
		imgList3[indice3].style.display = 'none';
		indice3 = nIndex;
		setTimeout(rotation3, 3000);
	}
	else
	{
		setTimeout(rotation3, 50);
	}
}

// Initialisation du rotation3
function rotationInit3(elementId)
{
	if(document.getElementById || document.createElement)
	{
		imgList3 = document.getElementById( elementId ).getElementsByTagName('img');
		
		for(i=1;i<imgList3.length;i++) 
		{ imgList3[i].xOpacity = 0; }
		
		imgList3[0].style.display = 'block';
		imgList3[0].xOpacity = .99;

		setTimeout(rotation3, 3000);
	};
}
