// show mouseover popups
function showMouseoverPopup(popupId)
{
	document.getElementById(popupId).style.display = "block";
}


// hide mouseover popups
function hideMouseoverPopup(popupId)
{
	document.getElementById(popupId).style.display = "none";
}


// displays an image in a pop-up of the specified size and with the specified title
function showImg(imgSrc, width, height, title)
{
	var popup = window.open("","myImg",config="height="+height+",width="+width+"");
	popup.document.write("<title>"+ title +"</title>");
	popup.document.write("<img src='" + imgSrc + "' height='" + height + "' width='" + width + "' onclick='window.close()' style='position:absolute;left:0;top:0'>");
	popup.document.write("<script type='text/javascript'> document.oncontextmenu = new Function(\"return false\") </sc"+"ript>");
	popup.document.close();
}

function openDropDown(element)
{
	cancelTimer(element);
	// closeDropDown();

	$("#" + element.id + " > ul").show("fast");
}


function closeDropDown(elementId)
{
	var htmlElement = document.getElementById(elementId);	// persistent object
	if (htmlElement.timerID != null)
	{
		$("#" + elementId + " > ul").hide("fast");
	}
}


function dropDownTimer(htmlElement)
{
	if(htmlElement.timerID != null)
	{
		clearTimeout(element.timerID);
	}
	
	htmlElement.timerID = window.setTimeout('closeDropDown("' + htmlElement.id + '")', window.timeout);
}


function cancelTimer(element)
{
	if(element.timerID != null)
   	{
   		window.clearTimeout(element.timerID);
     	element.timerID = null;
    }
}


// close all open menus if the user clicks outside of the menu
// currently disabled because I couldn't get it functioning and it's not necessary with a timeout lower than about 400
/*
document.onclick = function()
{
	var menus = $('#navTopLevel > li');
	for(var i in menus)
	{
		closeDropDown(menus[i].id);
	}
}
*/
