/*****

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_init,false):window.attachEvent("onload",so_init);*/
/* 									*/
/* 	BEGINN: Von Wolfgang Schulner eingebaute Steuerunsparameter 	*/
/* 									*/
var tbetween_12020 = 20000; // Zeitspanne Millisekunden
var t50_12020 = 1; // Dauer eines einzelnen Fadeout-/Fadein-Schrittes in Millisekunden
var opschritt_12020 = 0.08;  // Helligkeitsdifferenz zwischen den Fadeout-/Fadein-Schritten
/* 									*/
/* 	ENDE: Von Wolfgang Schulner eingebaute Steuerunsparameter 	*/
/* 									*/

var d_12020=document, imgs_12020 = new Array(), zInterval_12020 = null, current_12020=0, pause_12020=false;

so_init_12020();

function so_init_12020() {
	if(!d_12020.getElementById || !d_12020.createElement)return;
	
	/*css = d.createElement("link");
	css.setAttribute("href","xfade2.css");
	css.setAttribute("rel","stylesheet");
	css.setAttribute("type","text/css");
	d.getElementsByTagName("head")[0].appendChild(css);*/
	
	imgs_12020 = d_12020.getElementById("imageContainer_12020").getElementsByTagName("img");
	for(i=1;i<imgs_12020.length;i++) imgs_12020[i].xOpacity_12020 = 0;
	imgs_12020[0].style.display = "block";
	imgs_12020[0].xOpacity_12020 = .99;
	
	timeout_12020 = setTimeout(so_xfade_12020,tbetween_12020);
}

function so_xfade_12020() {
	cOpacity_12020 = imgs_12020[current_12020].xOpacity_12020;
	nIndex_12020 = imgs_12020[current_12020+1]?current_12020+1:0;

	nOpacity_12020 = imgs_12020[nIndex_12020].xOpacity_12020;
	
	cOpacity_12020-=opschritt_12020; 
	nOpacity_12020+=opschritt_12020;
	
	imgs_12020[nIndex_12020].style.display = "block";
	imgs_12020[current_12020].xOpacity_12020 = cOpacity_12020;
	imgs_12020[nIndex_12020].xOpacity_12020 = nOpacity_12020;
	
	setOpacity_12020(imgs_12020[current_12020]); 
	setOpacity_12020(imgs_12020[nIndex_12020]);
	
	if(cOpacity_12020<=0) {
		imgs_12020[current_12020].style.display = "none";
		current_12020 = nIndex_12020;
		timeout_12020 = setTimeout(so_xfade_12020,tbetween_12020);
	} else {
		timeout_12020 = setTimeout(so_xfade_12020,t50_12020);
	}
	
	function setOpacity_12020(obj) {
		if(obj.xOpacity_12020>.99) {
			obj.xOpacity_12020 = .99;
			return;
		}
		if(obj.xOpacity_12020<0) {
			obj.xOpacity_12020 = 0;
			return;
		}
		obj.style.opacity = obj.xOpacity_12020;
		obj.style.MozOpacity = obj.xOpacity_12020;
		obj.style.filter = "alpha(opacity=" + (obj.xOpacity_12020*100) + ")";
	}
	
}

