/**
 * @author Lutz Hoffarth
 * @since 01.08.2011 
 * @since 30.09.2011 Lutz Hoffarth | Breite und verstecken des #content in css/style.css ausgelagert.
 */

var centerMinimizedHeight = 161;

var southMinHeight = 220;
//var minWidth = 1149; // @since 02.08.2011 Lutz Minimalbreite der Website.
var minWidth = 1220; // @since 04.08.2011 Lutz Minimalbreite der Website.

var minWidthContent = 940;

/**
 * true: wenn der Content Bereich angezeigt wird
 * @author Adam Laszlo
 * @since 02.08.2011 
 */
var contentShowing = false;

/**
 * Speichert den zuletzt ausgeleseen Hash. Wird benötigt für den Workaround HashListener.
 * @since 10.10.2011 Adam Laszlo
 */
var lastHash = window.location.hash;
var hashListenerID = -1;
var manualChange = true;

var id_content;
var id_contentWrapper;

/**
 * true: wenn die Subnavi angezeigt wird
 * @author Adam Laszlo
 * @since 02.08.2011 
 */
var subMenuShowing = true;

/**
 * Höhe des Top Bereichs, wenn der Content sichtbar ist
 * @author Adam Laszlo | 141
 * @since 02.08.2011 
 * @since 07.09.2011 Lutz Hoffarth | 150
 */
var titleImageHeight = 150;

$(document).ready(function(){
	loadGallary(galleryIds);
	
	$("#containerContent").css({
		minWidth : minWidth
	});
	
	id_content = $("#content");
	id_contentWrapper = $("#contentWrapper");
	
	loadNavigation();
	
	bindHashChangeListener();
	
});

/**
 * Lässt das Menu mitscrollen, falls die Minimalbreite unterschritten wird.
 * @since 02.08.11
 */
$(window).scroll(function(){
	var leftOffset = $(this).scrollLeft();
	$("#container").css({
		left : "-"+leftOffset+"px"
	});
});


function bindHashChangeListener(){
	if (("onhashchange" in window) && !($.browser.msie)) {
		$(window).bind( 'hashchange', fireHashChangeEvent );
	} else {
		hashListenerID = setInterval(function() {
			if (lastHash != window.location.hash){
				fireHashChangeEvent();
			}
		}, 200);
	}
}

function fireHashChangeEvent(){
	lastHash = window.location.hash;
	if (!manualChange){
		loadSiteByHash(lastHash);
	}
	manualChange = false;
}

function isNumber(n) {
	  return !isNaN(parseFloat(n)) && isFinite(n);
}
