
$(document).ready(function() {
	/* Initialisierung Bildwechsel */	
	wechsel = setInterval( 'imageInterval()', 5000 );
	
});


/* Bildwechsel */

var wechsel = "";
var indexaktiv = 1;
var indexneu = 1;

function imageInterval () {
	var anzahl = $("ul#galerie-detail li").length;
	
	// Prueft, welches das naechste Bild ist.
	indexneu++;
	if (indexneu > anzahl) { indexneu = 1; }
	
	// Ruft den Bildwechsel auf
	setImage (indexneu);
}

function setImage (number, renew) {
	// Zeigt das neue Bild an
	if (number != indexaktiv) {
		$("li#bild-" + number).fadeIn(1000);
		$("li#bild-" + indexaktiv).fadeOut(1000);
		
		// Setzt den neuen aktiven Index
		indexaktiv = number;
	}	
	
	// Neuer Rhytmus, wenn per Thumbnail gewechselt wird
	if (renew) {
		window.clearInterval(wechsel);
		indexneu = number;
		wechsel = setInterval( 'imageInterval()', 5000 );
	}
}


/* Standorte Imagemap */

function showStandort (id) {
	$("#"+id).fadeIn(500);
}
function hideStandort (id) {
	$("#"+id).fadeOut(500);
}

