/*****

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

var d_12139=document, imgs_12139 = new Array(), zInterval_12139 = null, current_12139=0, pause_12139=false;

so_init_12139();

function so_init_12139() {
	if(!d_12139.getElementById || !d_12139.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_12139 = d_12139.getElementById("imageContainer_12139").getElementsByTagName("img");
	for(i=1;i<imgs_12139.length;i++) imgs_12139[i].xOpacity_12139 = 0;
	imgs_12139[0].style.display = "block";
	imgs_12139[0].xOpacity_12139 = .99;
	
	timeout_12139 = setTimeout(so_xfade_12139,tbetween_12139);
}

function so_xfade_12139() {
	cOpacity_12139 = imgs_12139[current_12139].xOpacity_12139;
	nIndex_12139 = imgs_12139[current_12139+1]?current_12139+1:0;

	nOpacity_12139 = imgs_12139[nIndex_12139].xOpacity_12139;
	
	cOpacity_12139-=opschritt_12139; 
	nOpacity_12139+=opschritt_12139;
	
	imgs_12139[nIndex_12139].style.display = "block";
	imgs_12139[current_12139].xOpacity_12139 = cOpacity_12139;
	imgs_12139[nIndex_12139].xOpacity_12139 = nOpacity_12139;
	
	setOpacity_12139(imgs_12139[current_12139]); 
	setOpacity_12139(imgs_12139[nIndex_12139]);
	
	if(cOpacity_12139<=0) {
		imgs_12139[current_12139].style.display = "none";
		current_12139 = nIndex_12139;
		timeout_12139 = setTimeout(so_xfade_12139,tbetween_12139);
	} else {
		timeout_12139 = setTimeout(so_xfade_12139,t50_12139);
	}
	
	function setOpacity_12139(obj) {
		if(obj.xOpacity_12139>.99) {
			obj.xOpacity_12139 = .99;
			return;
		}
		if(obj.xOpacity_12139<0) {
			obj.xOpacity_12139 = 0;
			return;
		}
		obj.style.opacity = obj.xOpacity_12139;
		obj.style.MozOpacity = obj.xOpacity_12139;
		obj.style.filter = "alpha(opacity=" + (obj.xOpacity_12139*100) + ")";
	}
	
}

