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

var d3=document, imgs3 = new Array(), zInterval = null, current3=0, pause=false;

function so_init_3()
{
	if(!d3.getElementById || !d3.createElement)return;

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

	imgs3 = d3.getElementById('rotator_two').getElementsByTagName('img');
	for(i=1;i<imgs3.length;i++) imgs3[i].xOpacity = 0;
	imgs3[0].style.display = 'block';
	imgs3[0].xOpacity = .99;

	setTimeout(so_xfade_3,4000);
}

function so_xfade_3()
{
	c3Opacity = imgs3[current3].xOpacity;
	n3Index = imgs3[current3+1]?current3+1:0;
	n3Opacity = imgs3[n3Index].xOpacity;

	c3Opacity-=.05;
	n3Opacity+=.05;

	imgs3[n3Index].style.display = 'block';
	imgs3[current3].xOpacity = c3Opacity;
	imgs3[n3Index].xOpacity = n3Opacity;

	setOpacity_3(imgs3[current3]);
	setOpacity_3(imgs3[n3Index]);

	if(c3Opacity<=0)
	{
		imgs3[current3].style.display = 'none';
		current3 = n3Index;
		setTimeout(so_xfade_3,4000);
	}
	else
	{
		setTimeout(so_xfade_3,50);
	}

	function setOpacity_3(obj)
	{
		if(obj.xOpacity>.99)
		{
			obj.xOpacity = .99;
			return;
		}

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