/*
	Image Cross Fade Redux
	Version 1.0
	Last revision: 02.15.2006
	steve@slayeroffice.com

	Rewrite of old code found here: http://slayeroffice.com/code/imageCrossFade/index.html
*/

window.addEventListener?window.addEventListener('load',so_inittttt,false):window.attachEvent('onload',so_inittttt);

var d=document, imgstttt = new Array(), zInterval = null, currenttttt=0, pause=false;

function so_inittttt()
{
	if(!d.getElementById || !d.createElement)return;

	css = d.createElement('link');
	css.setAttribute('href','slideshow2tttt.css');
	css.setAttribute('rel','stylesheet');
	css.setAttribute('type','text/css');
	d.getElementsByTagName('head')[0].appendChild(css);

	imgstttt = d.getElementById('rotatortttt').getElementsByTagName('img');
	for(i=1;i<imgstttt.length;i++) imgstttt[i].xOpacitytttt = 0;
	imgstttt[0].style.display = 'block';
	imgstttt[0].xOpacitytttt = .99;

	setTimeout(so_xfadetttt,3000);
}

function so_xfadetttt()
{
	cOpacity = imgstttt[currenttttt].xOpacitytttt;
	nIndextttt = imgstttt[currenttttt+1]?currenttttt+1:0;
	nOpacity = imgstttt[nIndextttt].xOpacitytttt;

	cOpacity-=.05;
	nOpacity+=.05;

	imgstttt[nIndextttt].style.display = 'block';
	imgstttt[currenttttt].xOpacitytttt = cOpacity;
	imgstttt[nIndextttt].xOpacitytttt = nOpacity;

	setOpacitytttt(imgstttt[currenttttt]);
	setOpacitytttt(imgstttt[nIndextttt]);

	if(cOpacity<=0)
	{
		imgstttt[currenttttt].style.display = 'none';
		currenttttt = nIndextttt;
		setTimeout(so_xfadetttt,3000);
	}
	else
	{
		setTimeout(so_xfadetttt,50);
	}

	function setOpacitytttt(obj)
	{
		if(obj.xOpacitytttt>.99)
		{
			obj.xOpacitytttt = .99;
			return;
		}

		obj.style.opacity = obj.xOpacitytttt;
		obj.style.MozOpacity = obj.xOpacitytttt;
		obj.style.filter = 'alpha(opacity=' + (obj.xOpacitytttt*100) + ')';
	}
}