var nIndex = -1;
var nInOut = 1; //fader in or out
var browserCheck;
var timeoutDelay = 1000;


if (navigator.userAgent.toLowerCase().indexOf("msie ") != -1) {
	var string = navigator.userAgent.toLowerCase().substring(navigator.userAgent.toLowerCase().indexOf("msie "));
	string = string.substring(5,string.indexOf(";"));
	browserCheck = "msie"+string; 
}else if (navigator.userAgent.toLowerCase().indexOf("netscape/7") != -1){ 
	browserCheck = "netscape/7"; 
}else {
	browserCheck = "Unrecognized Browser Detected";
}

function startWechsel(){
	//if (browserCheck.indexOf("msie") != -1){
		
		//preloading images for better fadeshow
		for(var i=0; i<imgArr.length; i++){
			preload("img"+i,imgArr[i][0]);
			preload("img"+i,imgArr[i][1]);
			
		}
		//alert(nIndex);
		wechsel();
		//setTimeout("",timeoutDelay);
	//}
}
	
function wechsel(){
	//alert(nIndex);
	
	
	nIndex++;
	if(nIndex >= imgArr.length) {
		nIndex = 0;
		nInOut = ((nInOut+1) % 2);
	}
	//alert(nInOut + "/" + nIndex);
	
	if (browserName != "iepc"){
		document.getElementById("bild" + nIndex).src = imgArr[nIndex][nInOut];
		setTimeout("wechsel()",timeoutDelay);
	}
	
	var debug = "";
	debug += "nIndex: " + nIndex + "\n";
	debug += "imgArr.length: " + imgArr.length + "\n";
	debug += "imgArr[nIndex]" + imgArr[nIndex][nInOut] + "\n";
	//alert(debug);
	
	document.getElementById("bild" + nIndex).filters.blendTrans.Apply();
	document.getElementById("bild" + nIndex).src = imgArr[nIndex][nInOut];
	document.getElementById("bild" + nIndex).filters.blendTrans.Play();
	
	setTimeout("wechsel()",timeoutDelay);
}	