google.setOnLoadCallback(function() {

	// a div teljes felulete kattinthato
	$("#sidebar div, .info-section").click(function(){
	  window.location=$(this).find("a").attr("href"); return false;
	});
	
	$("#nav li").hover(
		function() {
			$("#nav .selected ul").hide();
			$(this).addClass("hovered").find("ul").show();;
		},
		function() {
			$(this).removeClass("hovered").find("ul").hide();
			$("#nav .selected ul").show();
		}
	);
	
	$('.popup-close').click(function() {
		$(this).parents(".popup").fadeOut(100);
		$("#overlay").fadeOut(100);
		return false;
	});
	
	$("#quick-contact").click(function() {
		var open = $(this).find("a").attr("rel").replace("-trigger", "");
		var popupId = open + "-popup";
		
		var docuHeight = $(document).height();
		var windowHeight = $(window).height();
		var windowWidth = $(window).width();
		
		var popupHeight = $("#" + popupId).height();
		
		$("#overlay").css({"width": windowWidth + "px", "height": docuHeight + "px"}).fadeIn(100);
		$("#" + popupId).css({"top": (windowHeight - popupHeight) / 2, "left": (windowWidth - 626) / 2 }).fadeIn(100);
		return false;
	})
	
	
	$("a[rel$='trigger']").click(function() {
		var open = $(this).attr("rel").replace("-trigger", "");
		var popupId = open + "-popup";
		
		var docuHeight = $(document).height();
		var windowHeight = $(window).height();
		var windowWidth = $(window).width();
		
		var popupHeight = $("#" + popupId).height();
		
		$("#overlay").css({"width": windowWidth + "px", "height": docuHeight + "px"}).fadeIn(100);
		$("#" + popupId).css({"left": (windowWidth - 626) / 2 }).fadeIn(100);
		$('html, body').animate({scrollTop:0}, 'slow');
		return false;
	})
	
	var submenu_current;
	$("a[rel$='submenu']").click(function() {
		var submenu = "submenu_" + $(this).attr("rel").replace("-submenu", "");
		if (submenu != submenu_current) {
			if (submenu_current) $("#" + submenu_current).fadeOut('fast')
			$("#" + submenu).fadeIn(0);
			$("#" + submenu).fadeTo(0, 0);
			$("#" + submenu).css({"visibility": "visible"});
			$("#" + submenu).fadeTo('fast', 1);
			submenu_current = submenu;
		}
		return false;
	})
});

//"top": (windowHeight - popupHeight) / 10, 