/*
	-----------------------------------------------
	Script : Rotation d'image
	Version 1.0
	-----------------------------------------------
	Site : http://www.dreaminvasion.com
	Par : Gerald LONLAS
	Email : webmaster@dreaminvasion.com
	-----------------------------------------------
*/

// variables
var imgList2 = new Array();
var zInterval2 = null;
var indice2=0;

// Change Opacit� de l'image
function setOpacity2(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 rotation2()
{
	cOpacity = imgList2[indice2].xOpacity;
	nIndex = imgList2[indice2 + 1]? indice2 + 1 : 0;
	nOpacity = imgList2[nIndex].xOpacity;

	cOpacity-=.05;
	nOpacity+=.05;

	imgList2[nIndex].style.display = 'block';
	imgList2[indice2].xOpacity = cOpacity;
	imgList2[nIndex].xOpacity = nOpacity;

	setOpacity2(imgList2[indice2]);
	setOpacity2(imgList2[nIndex]);

	if(cOpacity<=0)
	{
		imgList2[indice2].style.display = 'none';
		indice2 = nIndex;
		setTimeout(rotation2, 3000);
	}
	else
	{
		setTimeout(rotation2, 50);
	}
}

// Initialisation du rotation2
function rotationInitialisation(elementId)
{
	if(document.getElementById || document.createElement)
	{
		imgList2 = document.getElementById( elementId ).getElementsByTagName('img');
		
		for(i=1;i<imgList2.length;i++) 
		{ imgList2[i].xOpacity = 0; }
		
		imgList2[0].style.display = 'block';
		imgList2[0].xOpacity = .99;

		setTimeout(rotation2, 3000);
	};
}
