/*
**
** tile-menu.js
** Floating-Point Communications (http://www.floating-point.com) [mdh]
** January 2010
**
** A menu that places fixed-size flowing/wrapping tiles in a dropdown.
** Tested in: IE7; Firefox 3.6; Safari 4; Chrome 4
**
*/

/**
* showMenu() uses CSS styles to display a dropdown menu. Submenu items (LI elements) are also updated (onmouseover/onmouseout events) to control menu visibility.
* @param		menuid - The id value of the menu from the HTML source.
* @returns	none
*/
function showMenu(menuid) {
	var el = document.getElementById(menuid);
	el.style.display = 'inline';
	
	// Set up child menu items (LI tags) to continue showing menu on mouseover, and to hide the menu on exit.
	var items = el.getElementsByTagName("li");
	for (var i = 0; i < items.length; i++) {
		items[i].onmouseover = new Function("showMenu('" + menuid + "');");
		items[i].onmouseout = new Function("hideMenu('" + menuid + "');");
	}
}

/**
* hideMenu() uses CSS styles to hide a dropdown menu.
* @param		menuid - The id value of the menu from the HTML source.
* @returns	none
*/
function hideMenu(menuid) {
	var el = document.getElementById(menuid);
	el.style.display = 'none';
}

/**
* initMenu() initializes a menu by id.  Expected to be called in the onload event, but may work elsewhere too.
* @param		menuid - The id value of the menu from the HTML source.
* @returns	none
*/
function initMenu(menuid) {
	hideMenu(menuid);
}
