/*****

Image Cross Fade Redux
Version 1.0
Last revision: 02.15.2006
steve@slayeroffice.com

Please leave this notice intact. 

Rewrite of old code found here: http://slayeroffice.com/code/imageCrossFade/index.html


*****/


window.addEventListener?window.addEventListener("load",so_init2,false):window.attachEvent("onload",so_init2);

var d2=document, divs2 = new Array(), zInterval2 = null, current2=0, pause=false, interval=5000;

function so_init2() {
	if(!d2.getElementById || !d2.createElement)return;
	

	
	divs2 = d2.getElementById("bubbleContainer").getElementsByTagName("div");
	for(j=1;j<divs2.length;j++) divs2[j].xOpacity = 0;
	divs2[0].style.display = "block";
	divs2[0].xOpacity = 1.00;
	
	setTimeout(so_xfade2,interval);
}

function so_xfade2() {
	cOpacity2 = divs2[current2].xOpacity;
	nIndex2 = divs2[current2+1]?current2+1:0;
	nOpacity2 = divs2[nIndex2].xOpacity;
	
	cOpacity2-=.05; 
	nOpacity2+=.05;
	
	divs2[nIndex2].style.display = "block";
	divs2[current2].xOpacity = cOpacity2;
	divs2[nIndex2].xOpacity = nOpacity2;
	
	setOpacity(divs2[current2]); 
	setOpacity(divs2[nIndex2]);
	
	if(cOpacity2<=0) {
		divs2[current2].style.display = "none";
		current2 = nIndex2;
		setTimeout(so_xfade2,interval);
	} else {
		setTimeout(so_xfade2,50);
	}
	
	function setOpacity(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) + ")";
	}
	
}