function karte() {
    window.open("/karte.html","karte_win","width=450,height=570,top=50,left=100,scrollbars=yes");
}


function enlargeImg(filename) {
    
    if ((navigator.appName == "Netscape") && (navigator.appVersion.substring(0,1) == "4")) {
        breite = 460;
        hoehe = 460;
    }
    else {
        breite = 20;
        hoehe = 20;
    }

    imgWindow = window.open("/cms/bigimg.php?filename="+filename,"bigImgWin","width="+breite+",height="+hoehe+",top=50,left=100,scrollbars=no");
    imgWindow.focus();
}


function openLocation(seite) {
    locationWindow = window.open("/location.php?Seite="+seite,"locationWin","width=524,height=262,top=50,left=100,scrollbars=yes");
    locationWindow.focus();
}

    
function openReferenz(seite) {
    referenzWindow = window.open("/referenz.php?Seite="+seite,"locationWin","width=524,height=262,top=50,left=100,scrollbars=yes");
    referenzWindow.focus();
}
    
//PRELOAD IMAGES:
var myImages = new Array();
function preloadImages() {
    for (i=0;i<preloadImages.arguments.length;i++) {
        myImages[i]=new Image()
        myImages[i].src=preloadImages.arguments[i]
    }
}

function disclaimer() {
    window.open("/disclaimer.html","discl_win","width=450,height=570,top=50,left=100,scrollbars=yes");
}


function openEvent(elementID) {
    window.open("/event_details.php?elementID="+elementID,"eventWin","width=500,height=500,top=50,left=100,scrollbars=yes");
}

function openAnfrage() {
    referenzWindow = window.open("/anfrage.html","kontaktWin","width=764,height=528,top=50,left=50,scrollbars=yes");
    referenzWindow.focus();
}

function openNewsdetails(id) {
	newsWindow = window.open("/news_details.php?id="+id, "newsWin", "width=784,height=528,top=50,left=50,scrollbars=yes");
	newsWindow.focus();
}


imgList = new Array('/images/quicklunch.jpg','/images/livingcooking.jpg','/images/fingerfood.jpg','/images/buffet.jpg','/images/IMG_7765.jpg');

function randomImg(imgList) {
	imgNr = Math.floor(Math.random() * imgList.length);
	document.getElementById("contentImg").src = 'img/' + imgList[imgNr];
}

// 2011 navi

function isTouch() {  
  try {  
    document.createEvent("TouchEvent");  
    return true;  
  } catch (e) {  
    return false;  
  }  
}

$(document).ready(function() {
	if(isTouch()) {
		$("#navibox>ul>li").each(function() {
			if($(this).has("div").length) {		// nur jene mit subnavi
				$(this).children("a").attr("href","JavaScript:void(0);");	// link 1. ebene wegnehmen
			}
		});
		
		$("#navibox>ul>li").click(function() {
			theDiv = $(this).children("div");
			if(theDiv.height()) {
				theDiv.css("height","0px");
			}
			else {
				theDiv.css("height","285px");
			}
		});
	}
	else {
		$("#navibox>ul>li").hover(
			function() {
				//ul2height = $(this).children("div").children("ul").height();
				ul2height = 285;
				$(this).children("div").stop();			
				$(this).children("div").animate({
					height:ul2height
				}, 200);
			},
			function() {
				$(this).children("div").stop();
				$(this).children("div").animate({
					height:0
				}, 220);
			}
		)
	
		$("div.level2box li").hover(
			function() {
				$(this).addClass("l2active");
			},
			function() {
				$(this).removeClass("l2active");	
			}
		)
	}
	
	// navi aktivieren
	$("#navibox>ul>li>a").each(function() {
		if($(this).attr("href") == window.location.pathname) {
			$(this).addClass("act");
		}	
	});
	
	$("div.level2box li a").each(function() {
		if($(this).attr("href") == window.location.pathname) {
			$(this).addClass("act");
			
			level1link = $(this).parents("#navibox>ul>li").children("a");
			$(level1link).addClass("act");				
		}	
	});
	
	// safari & chrome navi line height korrektur	
	if($.browser.webkit) {		
		$("#navibox>ul>li>a").css("padding-top","4px");
	}
	
	if(navigator.platform == 'iPad' || navigator.platform == 'iPhone' || navigator.platform == 'iPod') {
    	$("#bottombar").css("position", "static");
	};
	
	$("a.galerielink").fancybox({
		'overlayColor': '#333',
		'overlayOpacity': 0.8
	});
});
