/*****

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_12014 = 2500; // Zeitspanne Millisekunden
var t50_12014 = 10; // Dauer eines einzelnen Fadeout-/Fadein-Schrittes in Millisekunden
var opschritt_12014 = 0.03;  // Helligkeitsdifferenz zwischen den Fadeout-/Fadein-Schritten
/* 									*/
/* 	ENDE: Von Wolfgang Schulner eingebaute Steuerunsparameter 	*/
/* 									*/

var d_12014=document, imgs_12014 = new Array(), zInterval_12014 = null, current_12014=0, pause_12014=false;

so_init_12014();

function so_init_12014() {
	if(!d_12014.getElementById || !d_12014.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_12014 = d_12014.getElementById("imageContainer_12014").getElementsByTagName("img");
	for(i=1;i<imgs_12014.length;i++) imgs_12014[i].xOpacity_12014 = 0;
	imgs_12014[0].style.display = "block";
	imgs_12014[0].xOpacity_12014 = .99;
	
	timeout_12014 = setTimeout(so_xfade_12014,tbetween_12014);
}

function so_xfade_12014() {
	cOpacity_12014 = imgs_12014[current_12014].xOpacity_12014;
	nIndex_12014 = imgs_12014[current_12014+1]?current_12014+1:0;

	nOpacity_12014 = imgs_12014[nIndex_12014].xOpacity_12014;
	
	cOpacity_12014-=opschritt_12014; 
	nOpacity_12014+=opschritt_12014;
	
	imgs_12014[nIndex_12014].style.display = "block";
	imgs_12014[current_12014].xOpacity_12014 = cOpacity_12014;
	imgs_12014[nIndex_12014].xOpacity_12014 = nOpacity_12014;
	
	setOpacity_12014(imgs_12014[current_12014]); 
	setOpacity_12014(imgs_12014[nIndex_12014]);
	
	if(cOpacity_12014<=0) {
		imgs_12014[current_12014].style.display = "none";
		current_12014 = nIndex_12014;
		timeout_12014 = setTimeout(so_xfade_12014,tbetween_12014);
	} else {
		timeout_12014 = setTimeout(so_xfade_12014,t50_12014);
	}
	
	function setOpacity_12014(obj) {
		if(obj.xOpacity_12014>.99) {
			obj.xOpacity_12014 = .99;
			return;
		}
		if(obj.xOpacity_12014<0) {
			obj.xOpacity_12014 = 0;
			return;
		}
		obj.style.opacity = obj.xOpacity_12014;
		obj.style.MozOpacity = obj.xOpacity_12014;
		obj.style.filter = "alpha(opacity=" + (obj.xOpacity_12014*100) + ")";
	}
	
}

