/*****

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_init3,false):window.attachEvent("onload",so_init3);

var d=document, imgs3 = new Array(), ps3=new Array(), zInterval = null, current3=0, pause=false;

function so_init3() {
	if(!d.getElementById || !d.createElement)return;

	// DON'T FORGET TO GRAB THIS FILE AND PLACE IT ON YOUR SERVER IN THE SAME DIRECTORY AS THE JAVASCRIPT!
	// http://slayeroffice.com/code/imageCrossFade/xfade2.css
	css = d.createElement("link");
	css.setAttribute("href","xfade2.css");
	css.setAttribute("rel","stylesheet");
	css.setAttribute("type","text/css");
	d.getElementsByTagName("head")[0].appendChild(css);

	imgs3 = d.getElementById("imageContainer4").getElementsByTagName("img");
	for(i=1;i<imgs3.length;i++) imgs3[i].xOpacity = 0;
	imgs3[0].style.display = "block";
	imgs3[0].xOpacity = .99;
	ps3 = d.getElementById("imageContainer4").getElementsByTagName("p");
	for(i=1;i<ps3.length;i++) ps3[i].xOpacity = 0;
	ps3[0].style.display = "block";
	ps3[0].xOpacity = .99;
	
	setTimeout(so_xfade3,2000);
}

function so_xfade3() {
	cOpacity3 = imgs3[current3].xOpacity;
	nIndex3 = imgs3[current3+1]?current3+1:0;
	cOpacity3 = ps3[current3].xOpacity;
	nIndex3 = ps3[current3+1]?current3+1:0;

	nOpacity3 = imgs3[nIndex3].xOpacity;
	nOpacity3 = ps3[nIndex3].xOpacity;
	
	cOpacity3-=.05; 
	nOpacity3+=.05;
	
	imgs3[nIndex3].style.display = "block";
	imgs3[current3].xOpacity = cOpacity3;
	imgs3[nIndex3].xOpacity = nOpacity3;
	ps3[nIndex3].style.display = "block";
	ps3[current3].xOpacity = cOpacity3;
	ps3[nIndex3].xOpacity = nOpacity3;
		
	setOpacity3(imgs3[current3]); 
	setOpacity3(imgs3[nIndex3]);
	setOpacity3(ps3[current3]); 
	setOpacity3(ps3[nIndex3]);
	
	if(cOpacity3<=0) {
		imgs3[current3].style.display = "none";
		ps3[current3].style.display = "none";
		current3 = nIndex3;
		setTimeout(so_xfade3,2000);
	} else {
		setTimeout(so_xfade3,50);
	}
	
	function setOpacity3(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) + ")";
	}
	
}






