/*
	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(), zInterval6 = null, current6=0, pause6=false;

function so_init6()
{
	if(!d6.getElementById || !d6.createElement)return;

	css6 = d6.createElement('link');
	css6.setAttribute('href','css/slideshow6.css');
	css6.setAttribute('rel','stylesheet');
	css6.setAttribute('type','text/css');
	d6.getElementsByTagName('head')[0].appendChild(css6);

	imgs6 = d6.getElementById('slideshow6').getElementsByTagName('img');
	for(j=1;j<imgs6.length;j++) imgs6[j].xOpacity = 0;
	imgs6[0].style.display = 'block';
	imgs6[0].xOpacity = .99;

	setTimeout(so_xfade6,4000);
}

function so_xfade6()
{
	cOpacity6 = imgs6[current6].xOpacity;
	nIndex6 = imgs6[current6+1]?current6+1:0;
	nOpacity6 = imgs6[nIndex6].xOpacity;

	cOpacity6-=.05;
	nOpacity6+=.05;

	imgs6[nIndex6].style.display = 'block';
	imgs6[current6].xOpacity = cOpacity6;
	imgs6[nIndex6].xOpacity = nOpacity6;

	setOpacity6(imgs6[current6]);
	setOpacity6(imgs6[nIndex6]);

	if(cOpacity6<=0)
	{
		imgs6[current6].style.display = 'none';
		current6 = nIndex6;
		setTimeout(so_xfade6,6000);
	}
	else
	{
		setTimeout(so_xfade6,50);
	}

	function setOpacity6(obj6)
	{
		if(obj6.xOpacity>.99)
		{
			obj6.xOpacity = .99;
			return;
		}

		obj6.style.opacity = obj6.xOpacity;
		obj6.style.MozOpacity = obj6.xOpacity;
		obj6.style.filter = 'alpha(opacity=' + (obj6.xOpacity*100) + ')';
	}
}
