window.addEventListener?window.addEventListener('load',so_init,false):window.attachEvent('onload',so_init);
var imgs = new Array(), zInterval = null, current=0, pause=false;

function so_init()
{

	imgs = document.getElementById('rotator').getElementsByTagName('img');
	for(i=1;i<imgs.length;i++) {
	imgs[i].xOpacity = 0;
	imgs[i].style.zIndex.value = -1;}
	imgs[0].style.display = 'block';
	imgs[0].xOpacity = .99;
	setTimeout('so_xfade(1)',2500);
}

function so_xfade(n) {
if ( n == 1 )  {
	nIndex = imgs[current+1]?current+1:1;
	imgs[current].style.zIndex = 0;
	imgs[nIndex].style.zIndex = 1;
	imgs[nIndex].style.display = 'block';
	imgs[nIndex].xOpacity = 0;
	setOpacity(imgs[nIndex]);
	setTimeout('so_xfade(0)',50);	
} else { 
	nOpacity = imgs[nIndex].xOpacity;
	nOpacity+=.0167;
	imgs[nIndex].xOpacity = nOpacity;
	setOpacity(imgs[nIndex]);
	if(nOpacity>.99) {
		imgs[current].style.zIndex = -1;
		imgs[current].style.display = 'none';
		current = nIndex;
		setTimeout('so_xfade(1)',2500);
	} 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) + ')';
	}
}
