

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

var imgsp = new Array(), zIntervalp = null, currentp=0, pausep=false;

function so_initp() {
	if(!document.getElementById || !document.createElement)return;

	css = document.createElement("link");
	css.setAttribute("href","xfade1_o.css");
	css.setAttribute("rel","stylesheet");
	css.setAttribute("type","text/css");
	document.getElementsByTagName("head")[0].appendChild(css);

	imgsp = document.getElementById("imageContainer2").getElementsByTagName("img");
	for(i=1;i<imgsp.length;i++) imgsp[i].xOpacity = 0;
	imgsp[0].style.display = "block";
	imgsp[0].xOpacity = .99;

	setTimeout(so_xfadep,4500);
}

function so_xfadep() {
	cOpacity = imgsp[currentp].xOpacity;
	nIndex = imgsp[currentp+1]?currentp+1:0;
	nOpacity = imgsp[nIndex].xOpacity;

	cOpacity-=.05;
	nOpacity+=.05;

	imgsp[nIndex].style.display = "block";
	imgsp[currentp].xOpacity = cOpacity;
	imgsp[nIndex].xOpacity = nOpacity;

	setOpacity(imgsp[currentp]);
	setOpacity(imgsp[nIndex]);

	if(cOpacity<=0) {
		imgsp[currentp].style.display = "none";
		currentp = nIndex;
		setTimeout(so_xfadep,4500);
	} else {
		setTimeout(so_xfadep,100);
	}

	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) + ")";
	}

}

