var geschw=1.1;
var	opac_1=0; 
var	opac_1_100=0; 
var	opac_2=0; 
var	opac_2_100=0; 
var ist_wechsel=0;
var maus_drin=0;

function wechsel(id) {

	clearInterval(aid);
	if(ist_wechsel==0) {

		ist_wechsel=1;
		opac_1=1; 
		opac_2=0; 
		bid=setInterval('blenden(' + id + ',' + last_out +')',50);
		aid=setInterval('autowechsel()',4000);			
	
	} else {
	
		aid=setInterval('autowechsel()',4000);			
	
	}
}

function blenden(id,id2) {

	var check1=document.getElementById('vs_' + id2);
	var check2=document.getElementById('vs_' + id);	
	
	if(check1!==undefined && check2!=undefined && id!=id2) {
	
		if (opac_1<0) { 
			opac_1=0; 
			opac_2=0;
			if(id!=id2) {
				var check3=document.getElementById('vs_t' + id);
				var check4=document.getElementById('vs_t' + id2);
				if(check3!== null && check3.className!='vs_vorschau_highlight') check3.className='vs_vorschau_highlight';
				if(check4!== null && check4.className!='vs_vorschau') check4.className='vs_vorschau';			
				check1.style.display='none'; 
				check2.style.display='block';
			}
		}

		if(opac_1!=0) opac_1-=geschw;
		else opac_2+=geschw;
		
		if (opac_2>1) { 
			opac_2=1;
			ist_wechsel=0;
			clearInterval(bid);
			last_out=id;
		}

		opac_1_100=opac_1*100;
		opac_2_100=opac_2*100;

		check1.style.opacity=opac_1;
		check1.style.filter='alpha(opacity=' + opac_1_100 + ')';
		check2.style.opacity=opac_2;
		check2.style.filter='alpha(opacity=' + opac_2_100 + ')';
			
	} else {
	
		last_out=id;
		ist_wechsel=0;
		clearInterval(bid);
	
	}

}

function autowechsel() {

	if(maus_drin==0) {
		clearInterval(aid);
		var current=last_out+1;
		var neu=0;
		var check=document.getElementById('vs_' + current);
		if(check !== null) neu=current;
		wechsel(neu);
	}

}