// JavaScript Document

// höhe auslesen
if (self.innerWidth != undefined) {
	hoehe = self.innerHeight;
} else {
	hoehe = document.documentElement.clientHeight;
}

/* --START Ready-Function -- */
$(document).ready(function() { 

	/* Variablen definieren */
	nav_height = $("#access").height();
	nav_gallery_height = $("#menu-galerien").height();
	
	/* Klasse "js" hinzufügen */
	$("#header").addClass('js');
	$("#access").addClass('js').css('height',nav_height);
	$(".menu-container").addClass('js');
	
	/* Events festlegen */
	$("#access").hover(
		function () {
			show_nav();
		},
		function () {
			hide_nav();
		}
	);
	
	/* footer unten ausrichten */
	var pos = $('.represent').position();
	var foot_pos = pos.top;
	if ( foot_pos < hoehe ) {
		var set_top = hoehe - 68;
		$('.represent a').css('top',set_top+'px').css('position','fixed');
		$('.imprint a').css('top',set_top+'px').css('position','fixed');
		$('.page-template-templategallery-php .represent a').css('top','0px').css('position','relative');
		$('.page-template-templategallery-php .imprint a').css('top','0px').css('position','relative');
		$('.home .represent a').css('top','0px').css('position','relative');
		$('.home .imprint a').css('top','0px').css('position','relative');
	}
		
});
/* -- END Ready-Function -- */

function initiate_nav_for_article(){
	hide_gallery_nav();
	
	/* Events festlegen */
	$("#nav_gallery_bg").hover(
		function () {
			show_gallery_nav();
		},
		function () {
			/* Rollout-Function */
		}
	);
}

function initiate_nav_for_news(){
	$('a[href*="news"]').parent().addClass('current-menu-item');
}


/* Navigation: Einblendeffekte */

	/* komplette Navigation */
	function hide_nav(){
		$("#access.js").css("overflow","hidden");
		$("#access").animate({
			height: 33,
			top: 46
		}, 100, function() {
			// Animation complete.
		});
		$(".menu-container").animate({
			top: -46
		}, 100, function() {
			// Animation complete.
		});
	}
	
	function show_nav(){
		$("#access").animate({
			height: 500, //nav_height,
			top: 0
		}, 100, function() {
			$("#access.js").css("overflow","visible")
		});
		$(".menu-container").animate({
			top: 0
		}, 100, function() {
			// Animation complete.
		});
	}
	
	/* nur Galerien-Seite */
	function hide_gallery_nav(){
		$("#menu-galerien").animate({
			height: 2
		}, 1, function() {
			// Animation complete.
		});
	}
	
	function show_gallery_nav(){
		$("#menu-galerien").animate({
			height: nav_gallery_height
		}, 100, function() {
			// Animation complete.
		});
	}
	
