function showMietbereich(id) {
    this.id = id;
	$("#mb_" + this.id).css("visibility", "visible");
	$("#mb_" + this.id).css("z-index", "900");
}

function hideMietbereich(id) {
	$("#mb_" + id).css("visibility", "hidden");
	$("#mb_" + this.id).css("z-index", "0");
}

$(document).ready(function(){

	// mouseover 1 Menue-Ebene
	$("#primNavContainer a").bind("mouseover", function(e){
		$(this).addClass('over');
	});
	$("#primNavContainer a").bind("mouseout", function(e){
		$(this).removeClass('over');
	});
	// mouseover 2 Menue-Ebene
	$('.secNavItem').bind("mouseover", function(e){
		$(this).addClass('over');
	});
	$('.secNavItem').bind("mouseout", function(e){
		$(this).removeClass('over');
	});
	
	// Mietbereiche
    $('.mbEbene').cluetip({
		local: true,
		//cluetipClass: 'jtip',
		//sticky: true,
		cluezIndex: 5000,
		topOffset: 10,
		leftOffset: 25,
		arrows: true,
		dropShadow: false,
		tracking: true
	});
	
	$(".mbEbene").bind("mouseover", function(){
		var mb_itemID = $(this).attr('id');
		var mb_id = mb_itemID.substr(mb_itemID.length-2, 2);	
		//var mb_link = 'test'+mb_id;
		//$(this).attr('href', mb_link);
		showMietbereich(mb_id);
	});
	$(".mbEbene").bind("mouseout", function(){
		var mb_itemID = $(this).attr('id');
		var mb_id = mb_itemID.substr(mb_itemID.length-2, 2);
		hideMietbereich(mb_id);
	});
	$(".grundriss-lupe").bind("click", function(){
		var mb_itemID = $(this).parent().attr('id');
		var mb_id = mb_itemID.substr(mb_itemID.length-2, 2);
		var layerstatus = $('#mbInfoLayer' + mb_id).css('display');
		if (layerstatus == 'none') {
			$('.mbInfoLayer').css('display', 'none');
			$('#mbInfoLayer' + mb_id).css('display', 'block');
			$('#mbInfoLayer' + mb_id).css('z-index', '100');
		} else {
			$('.mbInfoLayer').css('display', 'none');
		}
	});
	// Mietbereiche Detail
	$(".mbInfoLayer-grundriss, .mbInfoLayer-close").bind("click", function(){
		$(this).parent().css('display', 'none');
	});
	
	
	// Erreichbarkeit
	$('.erreichbarkeit-lupe').click(function () {
		$('#googleMapsLayer').css('display', 'block');
    });
	$('.googleMapsLayer-close').click(function () {
		$('#googleMapsLayer').css('display', 'none');
    });
	
	
	// Hafencity
	$('.hafencity-karte-poi').cluetip({
		local: true,
		cluezIndex: 5000,
		topOffset: -10,
		leftOffset: 0,
		arrows: false,
		dropShadow: false,
		tracking: true
	});
	$('.hafencity-karte-infoText .textlink').click(function () {
		$('.hafencity-karte-zoom-container').css('display', 'block');
    });
	
	
	// Hafencity Karte Zoom
	$('.hafencity-karte-zoom-poi').cluetip({
		local: true,
		cluezIndex: 5000,
		topOffset: 10,
		leftOffset: 0,
		arrows: false,
		dropShadow: false,
		tracking: true
	});
	$('.hafencity-karte-zoom-infoText .textlink').click(function () {
		$('.hafencity-karte-zoom-container').css('display', 'none');
    });
	
});
