function $(id) {
	return document.getElementById(id);
}

var MH_menu = function() {
	var good_to_hide;
	return {
		showChild: function(id) {
			MH_menu.clearAll();
			$(id).style.display = 'block';
			MH_menu.cancelClose(id);
		},
		delayClose: function(target) {
			good_to_hide = window.setTimeout('MH_menu.hide(\'' + target + '\')', 2500);
		},
		// Cancel the hiding if the mouse returns to the window prior to the timeout being reached.
		cancelClose: function(target) {
			window.clearTimeout(good_to_hide);
		},
		// Hide the color picker if mouse has been off long enough.
		hide: function(target) {
			document.getElementById(target).style.display = 'none';
		},
		clearAll: function() {
			var subMenus = document.getElementsByTagName('ul');
			for (var i=0; i<subMenus.length; i++) {
				var subMenu = subMenus[i]; 
				if (subMenu.className == 'subNav') {	
					subMenu.style.display = 'none'
				}
			}
		}
	};
}();
