/** showSubOnMouseoverMain.js
  * Implements nav behavior that shows a hidden subnav
  * when the user mouses over a main section.
  */

/** public void itemOver : Differs from the default function in three ways:
  * a) execute any hideMenuListener to hide a currently displayed subnav
  * b) if the item is a section, set up any new hideMenuListeners necessary for hiding its subnav in turn
  * c) if the item is a section, displays the subnav
  * @param Event e Mouseover event triggering this function call
  * @param String itemId Id of nav item moused-over
  * @param String statusText Text to display in self.status
  */
itemOver = function(e, itemId, statusText) {
	if (editMode) return;
	// cancel bubbling
	if (e) {
		e.cancelBubble = true;
		if (e.stopPropagation) {
			e.stopPropagation();
			e.preventDefault();
		}
	}
	// show status text
	window.status = (statusText) ? statusText : "";
	var item = Navigation.getItem(itemId);
	// document has not finished loading or bogus itemId
	if (!item) return;
	// if a hideMenuListener function has been defined, execute it to hide any currently displayed menu
	if ((item.getLevel() == 0) && window.hideMenuListener) hideMenuListener(e);
	// change the classes, images, etc. for items not already "on"
	if (!item.isOn()) item.over();
	if (item.isSection()) {
		// if there is a special hide subnav function, execute it
		if (window.setHideMenuListener) setHideMenuListener();
		// capture the currently displayed subnav's id
		Navigation.setDisplayedSectionId(itemId);
		// turn the subnav on
		item.showMenu();
	}
}
