/*****

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_11859 = 4000; // Zeitspanne Millisekunden
var t50_11859 = 20; // Dauer eines einzelnen Fadeout-/Fadein-Schrittes in Millisekunden
var opschritt_11859 = 0.01;  // Helligkeitsdifferenz zwischen den Fadeout-/Fadein-Schritten
/* 									*/
/* 	ENDE: Von Wolfgang Schulner eingebaute Steuerunsparameter 	*/
/* 									*/

var d_11859=document, imgs_11859 = new Array(), zInterval_11859 = null, current_11859=0, pause_11859=false;

so_init_11859();

function so_init_11859() {
	if(!d_11859.getElementById || !d_11859.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_11859 = d_11859.getElementById("imageContainer_11859").getElementsByTagName("img");
	for(i=1;i<imgs_11859.length;i++) imgs_11859[i].xOpacity_11859 = 0;
	imgs_11859[0].style.display = "block";
	imgs_11859[0].xOpacity_11859 = .99;
	
	timeout_11859 = setTimeout(so_xfade_11859,tbetween_11859);
}

function so_xfade_11859() {
	cOpacity_11859 = imgs_11859[current_11859].xOpacity_11859;
	nIndex_11859 = imgs_11859[current_11859+1]?current_11859+1:0;

	nOpacity_11859 = imgs_11859[nIndex_11859].xOpacity_11859;
	
	cOpacity_11859-=opschritt_11859; 
	nOpacity_11859+=opschritt_11859;
	
	imgs_11859[nIndex_11859].style.display = "block";
	imgs_11859[current_11859].xOpacity_11859 = cOpacity_11859;
	imgs_11859[nIndex_11859].xOpacity_11859 = nOpacity_11859;
	
	setOpacity_11859(imgs_11859[current_11859]); 
	setOpacity_11859(imgs_11859[nIndex_11859]);
	
	if(cOpacity_11859<=0) {
		imgs_11859[current_11859].style.display = "none";
		current_11859 = nIndex_11859;
		timeout_11859 = setTimeout(so_xfade_11859,tbetween_11859);
	} else {
		timeout_11859 = setTimeout(so_xfade_11859,t50_11859);
	}
	
	function setOpacity_11859(obj) {
		if(obj.xOpacity_11859>.99) {
			obj.xOpacity_11859 = .99;
			return;
		}
		if(obj.xOpacity_11859<0) {
			obj.xOpacity_11859 = 0;
			return;
		}
		obj.style.opacity = obj.xOpacity_11859;
		obj.style.MozOpacity = obj.xOpacity_11859;
		obj.style.filter = "alpha(opacity=" + (obj.xOpacity_11859*100) + ")";
	}
	
}
