window.addEventListener?window.addEventListener('load',inizio,false):window.attachEvent('onload',inizio);
var imgr = new Array(), zInterval = null, current=0, pause=false;

function inizio()
{

	imgr = document.getElementById('rotator').getElementsByTagName('img');
	for(i=1;i<imgr.length;i++) {
	imgr[i].xOpacity = 0;
	imgr[i].style.zIndex.value = -1;}
	imgr[0].style.display = 'block';
	imgr[0].xOpacity = .99;
	setTimeout('so_xfade(1)',1500);
}

function so_xfade(n) {
if ( n == 1 )  {
	nIndex = imgr[current+1]?current+1:1;
	imgr[current].style.zIndex = 0;
	imgr[nIndex].style.zIndex = 1;
	imgr[nIndex].style.display = 'block';
	imgr[nIndex].xOpacity = 0;
	setOpacity(imgr[nIndex]);
	setTimeout('so_xfade(0)',50);	
} else { 
	nOpacity = imgr[nIndex].xOpacity;
	nOpacity+=.0167;
	imgr[nIndex].xOpacity = nOpacity;
	setOpacity(imgr[nIndex]);
	if(nOpacity>.99) {
		imgr[current].style.zIndex = -1;
		imgr[current].style.display = 'none';
		current = nIndex;
		setTimeout('so_xfade(1)',1500);
	} else {
		setTimeout('so_xfade(0)',50);
	}
}
	function setOpacity(obj) {
		obj.style.opacity = obj.xOpacity;
		obj.style.MozOpacity = obj.xOpacity;
		obj.style.filter = 'alpha(opacity=' + (obj.xOpacity*100) + ')';
	}
}
