// Ein- und Ausblende-Effekte, wenn das Dokument vollständig geladen ist
$(document).ready( function() {

	// Geschwindigkeit um Inhalt-DIVs ein- bzw. auszublenden
	contentfadespeed	= 2000;

	// Geschwindigkeit um die Unternavigation zu öffnen
	menuopenspeed		= 400;

	// Geschwindigkeit um die Unternavigation zu schliessen
	menuclosespeed		= 200;

	// Unternavigation "einfahren"
	if ( $('#nav_kontakt').hasClass('active') ) {
		$('#nav ul li ul').show().css('height', '33px');
	}
	else {
		$('#nav ul li ul').hide().css('height', '0px');
	}

	if ( noFade == 1 ) {
		// Inhalt-DIVs einblenden
		$('#content-top').show();
		$('#content').show();
		$('#content-bottom').show();
	}
	else {
		// Inhalt-DIVs ausblenden
		$('#content-top').hide();
		$('#content').hide();
		$('#content-bottom').hide();

		// Inhalt-DIVs einblenden
		$('#content-top').fadeIn(contentfadespeed);
		$('#content').fadeIn(contentfadespeed);
		$('#content-bottom').fadeIn(contentfadespeed);
	}

	// Unternavigation Ein-/ Ausblenden
	if ( !$('#nav_kontakt').hasClass('active') ) {
		$('#nav ul li').hover(
			function() {
				// Mouse in
				$(this).find('ul').stop().animate({height: '33px'}, menuopenspeed );
		    },
			function() {
				// Mouse out
				$(this).find('ul').stop().animate({height: '0px'}, menuclosespeed, function() { $(this).hide(); }); 
			}
		);
	}
});

// Funktion um Inhalt-DIVs auszublenden
function fadeout( url ) {
	if ( noFade == 1 ) {
		window.location.href = url;
	}
	else {
		$('#content-top').fadeOut(contentfadespeed );
		$('#content').fadeOut(contentfadespeed, function() {window.location.href = url;} );
		$('#content-bottom').fadeOut(contentfadespeed );
	}
}
