var active = 0;
var imageList = null;

$(document).ready(function() {
	imageList = $('#teaserbilder li');
	$(imageList[active]).css('zIndex', 1001);
	$(imageList[active+1]).css('zIndex', 1000);
	for(var i = 2; i < imageList.length; i++)
		$(imageList[i]).css('opacity', 0);
});
setTimeout(blendOver, 3000);

function blendOver() {
	img = $('#teaserbilder li')[active];
	
	var next = active+1;
	if(next >= (imageList.length))
		next = 0;

	$(imageList[active]).css('zIndex', 1001);
	$(imageList[next]).css('zIndex', 1000);
	$(imageList[next]).css('opacity', 1);
	$(imageList[next]).css('display', 'block');
	
	$(img).fadeOut(750, function() {
		setTimeout(blendOver, 2500);
	});
	active = next;
}

