/*
	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_init3,false):window.attachEvent('onload',so_init3);

var d3=document, imgs3 = new Array(), zInterval3 = null, current3=0, pause3=false;

function so_init3()
{
	if(!d3.getElementById || !d3.createElement)return;

	css3 = d3.createElement('link');
	css3.setAttribute('href','slideshow.css');
	css3.setAttribute('rel','stylesheet');
	css3.setAttribute('type','text/css');
	d3.getElementsByTagName('head')[0].appendChild(css3);

	imgs3 = d3.getElementById('rotator3').getElementsByTagName('img');
	for(i3=1;i3<imgs3.length;i3++) imgs3[i3].xOpacity = 0;
	imgs3[0].style.display = 'block';
	imgs3[0].xOpacity = .99;

	setTimeout(so_xfade3,3000);
}

function so_xfade3()
{
	cOpacity3 = imgs3[current3].xOpacity;
	nIndex3 = imgs3[current3+1]?current3+1:0;
	nOpacity3 = imgs3[nIndex3].xOpacity;

	cOpacity3-=.05;
	nOpacity3+=.05;

	imgs3[nIndex3].style.display = 'block';
	imgs3[current3].xOpacity = cOpacity3;
	imgs3[nIndex3].xOpacity = nOpacity3;

	setOpacity3(imgs3[current3]);
	setOpacity3(imgs3[nIndex3]);

	if(cOpacity3<=0)
	{
		imgs3[current3].style.display = 'none';
		current3 = nIndex3;
		setTimeout(so_xfade3,3000);
	}
	else
	{
		setTimeout(so_xfade3,50);
	}

	function setOpacity3(obj3)
	{
		if(obj3.xOpacity>.99)
		{
			obj3.xOpacity = .99;
			return;
		}

		obj3.style.opacity = obj3.xOpacity;
		obj3.style.MozOpacity = obj3.xOpacity;
		obj3.style.filter = 'alpha(opacity=' + (obj3.xOpacity*100) + ')';
	}
}