var timeBetween=10000;
var imgPos =0;
var newImg;
var timeOut;

function getNextImage(anz) {
	if (document.getElementById("img_list")!=undefined && document.getElementById("img_list")!=null) {
		imgCount=document.getElementById("img_list").getElementsByTagName("a").length;
		imgPos=imgPos+anz;
		
		if (imgPos<0) imgPos=imgCount-1;
		if (imgPos>=imgCount) imgPos=0;
		
		newImg=new Image();
		newImg.src=document.getElementById("teaser_pic_" + imgPos).href;
		document.getElementById("teaser_back").style.backgroundImage="url(" + newImg.src + ")";
	}
}

function switchTeaser() {
	if (document.images)  {
		if (document.getElementById("img_list")!=undefined && document.getElementById("img_list")!=null) {
			clearTimeout(timeOut);
			$("#teaser_img").fadeTo(250, 0.05, function () {
				document.getElementById("teaser_img").src=newImg.src;
				$("#teaser_img").fadeTo(0, 1.00);
			});
			getNextImage(1);
			timeOut=setTimeout("switchTeaser();",timeBetween);
		}
	}
}