$(document).ready(function() {
	$(".hoverarea").hover(function() {
		var hoverlayer = $(this).find(".hoverlayer");
		$(this).data("z-index", $(this).css("z-index"));
		$(this).css("z-index", hoverlayer.css("z-index"));
		hoverlayer.show();
	}, function() {
		var hoverlayer = $(this).find(".hoverlayer");
		hoverlayer.hide();
		$(this).css("z-index", $(this).data("z-index"));
	});
});

function popup(element) {
	close_popup();
	if ($.browser.msie){
		$(element).next(".popup_container").children(".popup_bg_rechts").css("left","50px");
		$(element).next(".popup_container").children(".popup_bg_rechts").css("top","-40px");
		$(element).next(".popup_container").children(".popup_close_rechts").css("left","360px");
		$(element).next(".popup_container").children().css("display","block");
		$(element).next(".popup_container").children().css("display","block");
	} else {
		$(element).next(".popup_container").children().fadeIn("fast");
		$(element).next(".popup_container").children().next().fadeIn("fast");
	}
	//korrektur fuer die mozilla
	if ($.browser.msie){
	} else {
		$("#maintenanceSpacer").css("display","block");
	}
}

function popupAndScroll(element, containerID) {
	popup(element);
	window.setTimeout("scroll(\"" + containerID + "\"," + (Top(element, containerID) - 68) + ")", 250);
}

function scroll(containerID, top) {
	$("#" + containerID).get(0).scrollTop = top;
}

function Top(element, containerID) {
	var curtop = 0;
	if (element.offsetParent) {
		while (1) {
			curtop += element.offsetTop;
			if (!element.offsetParent || $(element).is("#" + containerID)) {
				break;
			}
			element = element.offsetParent;
		}
	} else if (element.y) {
		curtop += element.y;
	}
	return curtop;
}

function close_popup() {
	$(".popup_container").children().css("display","none");
}

