/*
	Image Cross Fade Redux
	Version 1.0
	Last revision: 02.15.2006
	steve@slayeroffice.com

	Rewrite of old code found here: http://slayeroffice.com/code/imageCrossFade/index.html
*/
function Ccrossfade_1012(){
	this.current=0;
	//--- Konfiguration --
	this.haltezeit=    	3500; 	// Zeit, während das bild zu sehen ist.
	this.schrittzeit= 	  60; 	// Pause zwischen den einzelnen schritten.
	this.schrittweite= 	0.02; 	// Änderung der Transparenz pro schritt.
}
Ccrossfade_1012.prototype.go=function(){
	var d=document;
	css = d.createElement('link');
	css.setAttribute('href','inc/ermt_crossfade_1012/style2.css');
	css.setAttribute('rel','stylesheet');
	css.setAttribute('type','text/css');
	d.getElementsByTagName('head')[0].appendChild(css);
	
	css = d.createElement('link');
	
//	this.imgs = d.getElementById('rotator').getElementsByTagName('img');
	this.imgs = d.getElementById('ermt_crossfade_1012').getElementsByTagName('div');
	for(i=1;i<this.imgs.length;i++) this.imgs[i].xOpacity = 0;
	this.imgs[0].style.display = 'block';
	this.imgs[0].xOpacity = .99;
	setTimeout(this.step,this.haltezeit);
}
Ccrossfade_1012.prototype.step=function(){
	cOpacity = crossfade_1012.imgs[crossfade_1012.current].xOpacity;
	nIndex = crossfade_1012.imgs[crossfade_1012.current+1]?crossfade_1012.current+1:0;
	nOpacity = crossfade_1012.imgs[nIndex].xOpacity;
	cOpacity-=crossfade_1012.schrittweite;
	nOpacity+=crossfade_1012.schrittweite;
	crossfade_1012.imgs[nIndex].style.display = 'block';
	crossfade_1012.imgs[crossfade_1012.current].xOpacity = cOpacity;
	crossfade_1012.imgs[nIndex].xOpacity = nOpacity;
	setOpacity(crossfade_1012.imgs[crossfade_1012.current]);
	setOpacity(crossfade_1012.imgs[nIndex]);
	if(cOpacity<=0){
		crossfade_1012.imgs[crossfade_1012.current].style.display = 'none';
		crossfade_1012.current = nIndex;
		setTimeout(crossfade_1012.step,crossfade_1012.haltezeit);
	}else{
		setTimeout(crossfade_1012.step,crossfade_1012.schrittzeit);
	}
	function setOpacity(obj){
		if(obj.xOpacity>.99)		{
			obj.xOpacity = .99;
			return;
		}
		obj.style.opacity = obj.xOpacity;
		obj.style.MozOpacity = obj.xOpacity;
		obj.style.filter = 'alpha(opacity=' + (obj.xOpacity*100) + ')';
	}
}
crossfade_1012= new Ccrossfade_1012();
function crossfade_1012_go(){
	crossfade_1012.go();
}
window.addEventListener?window.addEventListener('load',crossfade_1012_go,false):window.attachEvent('onload',crossfade_1012_go);
