/*
	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_inittt,false):window.attachEvent('onload',so_inittt);

var d=document, imgstt = new Array(), zInterval = null, currenttt=0, pause=false;

function so_inittt()
{
	if(!d.getElementById || !d.createElement)return;

	css = d.createElement('link');
	css.setAttribute('href','slideshow2tt.css');
	css.setAttribute('rel','stylesheet');
	css.setAttribute('type','text/css');
	d.getElementsByTagName('head')[0].appendChild(css);

	imgstt = d.getElementById('rotatortt').getElementsByTagName('img');
	for(i=1;i<imgstt.length;i++) imgstt[i].xOpacitytt = 0;
	imgstt[0].style.display = 'block';
	imgstt[0].xOpacitytt = .99;

	setTimeout(so_xfadett,3000);
}

function so_xfadett()
{
	cOpacity = imgstt[currenttt].xOpacitytt;
	nIndextt = imgstt[currenttt+1]?currenttt+1:0;
	nOpacity = imgstt[nIndextt].xOpacitytt;

	cOpacity-=.05;
	nOpacity+=.05;

	imgstt[nIndextt].style.display = 'block';
	imgstt[currenttt].xOpacitytt = cOpacity;
	imgstt[nIndextt].xOpacitytt = nOpacity;

	setOpacitytt(imgstt[currenttt]);
	setOpacitytt(imgstt[nIndextt]);

	if(cOpacity<=0)
	{
		imgstt[currenttt].style.display = 'none';
		currenttt = nIndextt;
		setTimeout(so_xfadett,3000);
	}
	else
	{
		setTimeout(so_xfadett,50);
	}

	function setOpacitytt(obj)
	{
		if(obj.xOpacitytt>.99)
		{
			obj.xOpacitytt = .99;
			return;
		}

		obj.style.opacity = obj.xOpacitytt;
		obj.style.MozOpacity = obj.xOpacitytt;
		obj.style.filter = 'alpha(opacity=' + (obj.xOpacitytt*100) + ')';
	}
}