
topRotatorDelay = 6000;  // Wartezeit für Rotator-Bilder in Millisekunden.
topRotatorWait = 0;

$(document).ready(function() { // Wenn JS aktiv, asap alle Bilder ausblenden, und nur das erste anzeigen.
	if ($("#js_header_area").length) {
		$("#js_header_area").hover(
			function() {topRotatorWait = 1;},
			function() {topRotatorWait = 0;}
		);
		$("#js_header_area a").addClass("noshow");
		$("#js_header_area a").focus( function () { $(this).blur(); } );
		$("#js_header_area a:first").animate({opacity:1,left:10},0);
	}
});

$(window).load(function() { // Wenn alle Bilder geladen sind mit dem Rotieren beginnen
	if ($("#js_header_area").length) {
		$("#js_header_area a:first").animate({opacity:1,left:10},500);
		window.setTimeout("header_next()", topRotatorDelay);
	}
});

function header_next() {
	if (topRotatorWait == 0) {
		if (jQuery.support.opacity) { // Ein- und ausfaden möglich?
			$("#js_header_area a").first().animate({opacity:0,left:0},500, function() { $(this).appendTo("#js_header_area").css('left','20px') }).next().delay(500).css('left','20px').animate({opacity:1,left:10},500);
		} else { // Sonst einfach durchwechseln ohne Effekte
			$("#js_header_area a").first().fadeOut(500, function() { $(this).appendTo("#js_header_area") }).next().delay(500).fadeIn(500);
		}
		window.setTimeout("header_next()", topRotatorDelay);
	} else {
		window.setTimeout("header_next()", 200);
	}
}
