window.addEventListener?window.addEventListener("load",startSlideShow,false):window.attachEvent("onload",startSlideShow);
var d=document, imgs = new Array(), zInterval = null, current=0, pause=false;

function startSlideShow()
{
	if(!d.getElementById || !d.createElement)return;
	
	imgs = d.getElementById("rotator").getElementsByTagName("img");
	for(i=1;i<imgs.length;i++) imgs[i].xOpacity = 0;
	imgs[0].style.display = "block";
	imgs[0].xOpacity = .99;

	setTimeout(startTran,10000);
}

function startTran()
{
	mopc = imgs[current].xOpacity;
	idx = imgs[current+1]?current+1:0;
	nopc = imgs[idx].xOpacity;

	mopc-=.05;
	nopc+=.05;

	imgs[idx].style.display = "block";
	imgs[current].xOpacity = mopc;
	imgs[idx].xOpacity = nopc;

	setOpacity(imgs[current]);
	setOpacity(imgs[idx]);

	if(mopc<=0)
	{
		imgs[current].style.display = "none";
		current = idx;
		setTimeout(startTran,10000);
	}
	else
	{
		setTimeout(startTran,50);
	}

	function setOpacity(obj)
	{
		if(obj.xOpacity>.99) {
			obj.xOpacity = .99;
			return;
		}
		obj.style.opacity = obj.xOpacity;
		obj.style.MozOpacity = obj.xOpacity;
		obj.style.filter = "alpha(opacity=" + (obj.xOpacity*100) + ")";
	}
}
