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