/*****
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_init6,false):window.attachEvent("onload",so_init6);

var d6=document, imgs6 = new Array(), zInterval = null, current6 = 0, pause=false;

function so_init6() {
	if(!d6.getElementById || !d6.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
	css6 = d6.createElement("link");
	css6.setAttribute("href","xfade6.css");
	css6.setAttribute("rel","stylesheet");
	css6.setAttribute("type","text/css");
	d6.getElementsByTagName("head")[0].appendChild(css6);

	imgs6 = d6.getElementById("baner6x").getElementsByTagName("img");
	for(i6=1;i6<imgs6.length;i6++) {
	
	imgs6[i6].xOpacity6 = 0;
	imgs6[i6].style.visibility = "hidden";
	}
	imgs6[0].style.visibility = "visible";
	imgs6[0].style.display = "block";
	imgs6[0].style.position = "absolute";
	imgs6[0].xOpacity6 = 1.0;
	
	setTimeout(so_xfade6,3000); // czas do pierwszej zmiany
}

function so_xfade6() {
	cOpacity6 = imgs6[current6].xOpacity6;
	nIndex6 = imgs6[current6+1]?current6+1:0;

	nOpacity6 = imgs6[nIndex6].xOpacity6;
	
	cOpacity6-=.05; 
	nOpacity6+=.05;
	
	imgs6[nIndex6].style.display = "block";
	imgs6[nIndex6].style.position = "absolute";
	imgs6[nIndex6].style.visibility = "visible";
	imgs6[nIndex6].style.left = "0px";
	imgs6[current6].xOpacity6 = cOpacity6;
	imgs6[nIndex6].xOpacity6 = nOpacity6;
	
	setOpacity6(imgs6[current6]);
	setOpacity6(imgs6[nIndex6]);

	
	if(cOpacity6<=0) {
		imgs6[current6].style.display = "none";
		imgs6[current6].style.position = "relative";
		current6 = nIndex6;
		setTimeout(so_xfade6,3000); // czas pomiedzy kolejnymi obrazkami
	} else {
		setTimeout(so_xfade6,25);
	}
	
	function setOpacity6(obj) {
		if(obj.xOpacity6>1.0) {
			obj.xOpacity6 = 1.0;
			return;
		}
		obj.style.opacity = obj.xOpacity6;
		obj.style.MozOpacity = obj.xOpacity6;
		obj.style.filter = "alpha(opacity=" + (obj.xOpacity6*100) + ")";
	}
}