menuTimeouts = new Array();
visibleMenu = "";

function showMenu(menuID)
{
	var menuParent = document.getElementById(menuID + "_parent");
	if (menuParent.className == "") {
		menuParent.className = "opened";
	} else {
		menuParent.className += " opened";
	}
	
	var menu = document.getElementById(menuID);
	menu.style.display = 'inline';
	
	if (visibleMenu != "" && visibleMenu != menuID) {
		hideMenu(visibleMenu, false);
	}
	visibleMenu = menuID;
	
	// vymazání timeoutů
	for (key in menuTimeouts) {
		var timeout = menuTimeouts[key];
		window.clearTimeout(timeout);
	}
}

function hideMenu(menuID, useTimeout)
{
	if (menuID == "") {
		return;
	}
		
	if (useTimeout == false) {
		var menuParent = document.getElementById(menuID + "_parent");
		if (menuParent.className.indexOf("active") != -1) {
			menuParent.className = "active";
		} else {
			menuParent.className = "";
		}
		
		var menu = document.getElementById(menuID);
		menu.style.display = 'none';
	} else {
		var timeout = window.setTimeout("hideMenu('"+menuID+"', false)", 700);
		menuTimeouts[menuID] = timeout;
	}
}


function clearNewsletterInput()
{
	var input = document.getElementById("newsletterInput");
	if (input.value == "Zasílat novinky na email:") {
		input.value = "";
	}
}

function OpenPhotoWindow(imagePath, name, width, height)
{
	var top = (screen.height - height)/2;
	var left = (screen.width - width)/2;
	imagePath = escape(imagePath);
	wnd = window.open("photoview.php?imagePath="+imagePath+"&amp;name="+name, name, "scrollbars=no,width="+width+",height="+height);
	wnd.moveTo(left, top);
}