var duration3 = 3000; //Hier die Dauer zwischen den Überblendungen angeben (Millisekunden)
var fadeduration3 = 800; //Hier die Dauer der Überblendung angeben (Millisekunden)

$(document).ready(function() {
	
	//setInterval
	var setIndex=1;
	$("#container3 a").each(function() {
		$(this).attr("id","galleryimage"+setIndex);
		setIndex = parseInt(setIndex + 1);
	});
	$("#container3 a:first-child").addClass("active");
	$("#container3 a:first-child").show();

	var max = $("#container3 a").length;
	function next3() {
		var activeId = $("#container3 .active").attr("id");
		var thisindex = parseInt(activeId.substring(12));
		var thatindex = thisindex;
		nextindex = thisindex + 1;
		if (nextindex>max) {
			nextindex=1;
		}

		$("#container3 #galleryimage"+thatindex).removeClass("active");
		$("#container3 #galleryimage"+thatindex).fadeOut(fadeduration3);
		$("#container3 #galleryimage"+nextindex).fadeIn(fadeduration3, function() {
			$(this).addClass("active");
		});	
	}
	
	var automaticAnimation = window.setInterval(next3,duration3);
	
});
