// variables
var imgList = new Array();
var zInterval = null;
var indice=0;

// Change Opacité de l'image
function setOpacity(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 rotation()
{
cOpacity = imgList[indice].xOpacity;
nIndex = imgList[indice + 1]? indice + 1 : 0;
nOpacity = imgList[nIndex].xOpacity;

cOpacity-=.10;
nOpacity+=.10;

imgList[nIndex].style.display = 'block';
imgList[indice].xOpacity = cOpacity;
imgList[nIndex].xOpacity = nOpacity;

setOpacity(imgList[indice]);
setOpacity(imgList[nIndex]);

if(cOpacity<=0)
{
imgList[indice].style.display = 'none';
indice = nIndex;
setTimeout(rotation, 4000);
}
else
{
setTimeout(rotation, 50);
}
}

// Initialisation du rotation
function rotationInit(elementId)
{
if(document.getElementById || document.createElement)
{
imgList = document.getElementById( elementId ).getElementsByTagName('img');

for(i=1;i<imgList.length;i++) 
{ imgList[i].xOpacity = 0; }

imgList[0].style.display = 'block';
imgList[0].xOpacity = .99;

setTimeout(rotation, 3000);
};
}

