var banner_timeout;
function banner_button_select (obj) {
var obj1=document.getElementById('banner1');
var obj2=document.getElementById('banner2');
var obj3=document.getElementById('banner3');
var obj4=document.getElementById('banner4');
var obj_button1=document.getElementById('banner_button1');
var obj_button2=document.getElementById('banner_button2');
var obj_button3=document.getElementById('banner_button3');
var obj_button4=document.getElementById('banner_button4');
	if(obj==obj1) {
	obj_button1.style.backgroundPosition='left';
	obj_button2.style.backgroundPosition='right';
	obj_button3.style.backgroundPosition='right';
	obj_button4.style.backgroundPosition='right';
	} else if(obj==obj2) {
	obj_button1.style.backgroundPosition='right';
	obj_button2.style.backgroundPosition='left';
	obj_button3.style.backgroundPosition='right';
	obj_button4.style.backgroundPosition='right';
	} else if(obj==obj3) {
	obj_button1.style.backgroundPosition='right';
	obj_button2.style.backgroundPosition='right';
	obj_button3.style.backgroundPosition='left';
	obj_button4.style.backgroundPosition='right';
	} else if(obj==obj4) {
	obj_button1.style.backgroundPosition='right';
	obj_button2.style.backgroundPosition='right';
	obj_button3.style.backgroundPosition='right';
	obj_button4.style.backgroundPosition='left';
	}
}
function banner_stop(obj0) {
var obj1=document.getElementById('banner1');
var obj2=document.getElementById('banner2');
var obj3=document.getElementById('banner3');
var obj4=document.getElementById('banner4');
clearTimeout(banner_timeout);
	if(obj0==obj1) {
	obj2.style.display='none';
	obj3.style.display='none';
	obj4.style.display='none';
	var obj=obj4;
	} else if(obj0==obj2) {
	obj1.style.display='none';
	obj3.style.display='none';
	obj4.style.display='none';
	var obj=obj1;
	} else if(obj0==obj3) {
	obj1.style.display='none';
	obj2.style.display='none';
	obj4.style.display='none';
	var obj=obj2;
	} else if(obj0==obj4) {
	obj1.style.display='none';
	obj2.style.display='none';
	obj3.style.display='none';
	var obj=obj3;
	}
obj0.style.display='block';
banner_button_select(obj0);
	if(navigator.userAgent.indexOf('MSIE') > -1) obj0.style.removeAttribute('filter');
obj0.style.MozOpacity=1;
obj0.style.WebkitOpacity=1;
obj0.style.KhtmlOpacity=1;
obj0.style.opacity=1;
//banner_start(obj,100,0,1); //Falls es weitergehen soll
}
function banner_start(obj0,opacity0,opacity,sofort) {
var obj1=document.getElementById('banner1');
var obj2=document.getElementById('banner2');
var obj3=document.getElementById('banner3');
var obj4=document.getElementById('banner4');
	if(!sofort) var verz=6000; //Verzögerung vor jedem Wechseln in mkSek.
	else var verz=0;
	if(obj0==obj1) {
	banner_timeout=setTimeout( function() { banner_abwechseln(obj1,obj2,opacity0,opacity); }, verz);
	} else if(obj0==obj2) {
	banner_timeout=setTimeout( function() { banner_abwechseln(obj2,obj3,opacity0,opacity); }, verz);
	} else if(obj0==obj3) {
	banner_timeout=setTimeout( function() { banner_abwechseln(obj3,obj4,opacity0,opacity); }, verz);
	} else if(obj0==obj4) {
	banner_timeout=setTimeout( function() { banner_abwechseln(obj4,obj1,opacity0,opacity); }, verz);
	}
	
}
function banner_schleife(obj1,obj2,opacity0,opacity) {
setTimeout( function() { banner_abwechseln(obj1,obj2,opacity0,opacity); }, 50); //Verzögerung vor jedem Erhöhen / Reduzieren von opacity / opacity0 in mkSek.
}
function banner_abwechseln(obj1,obj2,opacity0,opacity) {
var obj_1=document.getElementById('banner1');
var obj_2=document.getElementById('banner2');
var obj_3=document.getElementById('banner3');
var obj_4=document.getElementById('banner4');
	if(obj2==obj_1) banner_button_select(obj_1);
	else if(obj2==obj_2) banner_button_select(obj_2);
	else if(obj2==obj_3) banner_button_select(obj_3);
	else if(obj2==obj_4) banner_button_select(obj_4);
var fein=10; //fade-Feinheit (um wieviel Prozent wird opacity erhöht / opacity0 reduziert)

opacity=eval(opacity-fein); //fade-Feinheit
obj1.style.filter='alpha(opacity='+eval(opacity)+')';
obj1.style.MozOpacity=eval(opacity/100);
obj1.style.WebkitOpacity=eval(opacity/100);
obj1.style.KhtmlOpacity=eval(opacity/100);
obj1.style.opacity=eval(opacity/100);

obj2.style.display='block';
opacity0=eval(opacity0+fein); //fade-Feinheit
obj2.style.filter='alpha(opacity='+eval(opacity0)+')';
obj2.style.MozOpacity=eval(opacity0/100);
obj2.style.WebkitOpacity=eval(opacity0/100);
obj2.style.KhtmlOpacity=eval(opacity0/100);
obj2.style.opacity=eval(opacity0/100);

	if(opacity>0) banner_schleife(obj1,obj2,opacity0,opacity);
	else {
	obj1.style.display='none';
	obj1.style.filter='alpha(opacity=0)';
	obj1.style.MozOpacity=0;
	obj1.style.WebkitOpacity=0;
	obj1.style.KhtmlOpacity=0;
	obj1.style.opacity=0;
		if(navigator.userAgent.indexOf('MSIE') > -1) obj2.style.removeAttribute('filter');
	banner_start(obj2,0,100,false);
	}
}

