/*
	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_init6,false):window.attachEvent('onload',so_init6);

var d6=document, imgs6 = new Array(), zInterval = null, current6=0, pause=false;

function so_init6()
{
	if(!d6.getElementById || !d6.createElement)return;

	css = d6.createElement('link');
	css.setAttribute('href','slideshow.css');
	css.setAttribute('rel','stylesheet');
	css.setAttribute('type','text/css');
	d6.getElementsByTagName('head')[0].appendChild(css);

	imgs6 = d6.getElementById('rotator6').getElementsByTagName('img');
	for(i6=1;i6<imgs6.length;i6++) imgs6[i6].xOpacity6 = 0;
	imgs6[0].style.display = 'block';
	imgs6[0].xOpacity6 = .99;

	setTimeout(so_xfade6,3000);
}

function so_xfade6()
{
	cOpacity6 = imgs6[current6].xOpacity6;
	nIndex6 = imgs6[current6+1]?current6+1:0;
	nOpacity6 = imgs6[nIndex6].xOpacity6;

	cOpacity6-=.05;
	nOpacity6+=.05;

	imgs6[nIndex6].style.display = 'block';
	imgs6[current6].xOpacity6 = cOpacity6;
	imgs6[nIndex6].xOpacity6 = nOpacity6;

	setOpacity(imgs6[current6]);
	setOpacity(imgs6[nIndex6]);

	if(cOpacity6<=0)
	{
		imgs6[current6].style.display = 'none';
		current6 = nIndex6;
		setTimeout(so_xfade6,3000);
	}
	else
	{
		setTimeout(so_xfade6,50);
	}

	function setOpacity(obj)
	{
		if(obj.xOpacity6>.99)
		{
			obj.xOpacity6 = .99;
			return;
		}

		obj.style.opacity = obj.xOpacity6;
		obj.style.MozOpacity = obj.xOpacity6;
		obj.style.filter = 'alpha(opacity=' + (obj.xOpacity6*100) + ')';
	}
}
