/*
	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_initttt,false):window.attachEvent('onload',so_initttt);

var d=document, imgsttt = new Array(), zInterval = null, currentttt=0, pause=false;

function so_initttt()
{
	if(!d.getElementById || !d.createElement)return;

	css = d.createElement('link');
	css.setAttribute('href','slideshow2ttt.css');
	css.setAttribute('rel','stylesheet');
	css.setAttribute('type','text/css');
	d.getElementsByTagName('head')[0].appendChild(css);

	imgsttt = d.getElementById('rotatorttt').getElementsByTagName('img');
	for(i=1;i<imgsttt.length;i++) imgsttt[i].xOpacityttt = 0;
	imgsttt[0].style.display = 'block';
	imgsttt[0].xOpacityttt = .99;

	setTimeout(so_xfadettt,3000);
}

function so_xfadettt()
{
	cOpacity = imgsttt[currentttt].xOpacityttt;
	nIndexttt = imgsttt[currentttt+1]?currentttt+1:0;
	nOpacity = imgsttt[nIndexttt].xOpacityttt;

	cOpacity-=.05;
	nOpacity+=.05;

	imgsttt[nIndexttt].style.display = 'block';
	imgsttt[currentttt].xOpacityttt = cOpacity;
	imgsttt[nIndexttt].xOpacityttt = nOpacity;

	setOpacityttt(imgsttt[currentttt]);
	setOpacityttt(imgsttt[nIndexttt]);

	if(cOpacity<=0)
	{
		imgsttt[currentttt].style.display = 'none';
		currentttt = nIndexttt;
		setTimeout(so_xfadettt,3000);
	}
	else
	{
		setTimeout(so_xfadettt,50);
	}

	function setOpacityttt(obj)
	{
		if(obj.xOpacityttt>.99)
		{
			obj.xOpacityttt = .99;
			return;
		}

		obj.style.opacity = obj.xOpacityttt;
		obj.style.MozOpacity = obj.xOpacityttt;
		obj.style.filter = 'alpha(opacity=' + (obj.xOpacityttt*100) + ')';
	}
}