YAHOO.namespace("idc.menu");

YAHOO.idc.menu.Menu = function (p_oElement, p_oConfig)
{
	YAHOO.idc.menu.Menu.superclass.constructor.call(
		this, 
		p_oElement,
		p_oConfig
	);
};

YAHOO.lang.extend(YAHOO.idc.menu.Menu, YAHOO.widget.Menu, {

	init: function (p_oElement, p_oConfig)
	{
		this.ITEM_TYPE = YAHOO.idc.menu.MenuItem;
		
		YAHOO.idc.menu.Menu.superclass.init.call(this, p_oElement, p_oConfig);
    },

	_onKeyDown: function(p_sType, p_aArgs, p_oMenuBar) 
	{
	    var oEvent = p_aArgs[0],
	        oItem = p_aArgs[1],
	        me = this,
	        oSubmenu,
	        oItemCfg,
	        oParentItem,
	        oRoot,
	        oNextItem,
	        oParentMenu,
	        bCallSuper = true;
	
		if (typeof(lcDirection) != "undefined" && lcDirection == 'rtl')
		{
		    /*
		        This function is called to prevent a bug in Firefox.  In Firefox,
		        moving a DOM element into a stationary mouse pointer will cause the 
		        browser to fire mouse events.  This can result in the menu mouse
		        event handlers being called uncessarily, especially when menus are 
		        moved into a stationary mouse pointer as a result of a 
		        key event handler.
		    */
		    function stopMouseEventHandlers() {
		
		        me._bStopMouseEventHandlers = true;
		        
		        window.setTimeout(function () {
		        
		            me._bStopMouseEventHandlers = false;
		        
		        }, 10);
		
		    }
		
		
		    if (oItem && !oItem.cfg.getProperty("disabled")) {
		
		        oItemCfg = oItem.cfg;
		        oParentItem = this.parent;
		
		        switch(oEvent.keyCode) {
		            
		            case 37:    // Right arrow
		            
		            	bCallSuper = false;
		    
		                oSubmenu = oItemCfg.getProperty("submenu");
		    
		                if (oSubmenu) {
		    
		                    if (!oItemCfg.getProperty("selected")) {
		        
		                        oItemCfg.setProperty("selected", true);
		        
		                    }
		    
		                    oSubmenu.show();
		                    oSubmenu.setInitialFocus();
		                    oSubmenu.setInitialSelection();
		    
		                }
		                else {
		    
		                    oRoot = this.getRoot();
		                    
		                    if (oRoot instanceof YAHOO.widget.MenuBar) {
		    
		                        oNextItem = oRoot.activeItem.getNextEnabledSibling();
		    
		                        if (oNextItem) {
		                        
		                            oRoot.clearActiveItem();
		    
		                            oNextItem.cfg.setProperty("selected", true);
		    
		                            oSubmenu = oNextItem.cfg.getProperty("submenu");
		    
		                            if (oSubmenu) {
		    
		                                oSubmenu.show();
		                            
		                            }
		    
		                            oNextItem.focus();
		                        
		                        }
		                    
		                    }
		                
		                }
		    
		    
		                Event.preventDefault(oEvent);
		
		                stopMouseEventHandlers();
		
		            break;
		    
		    
		            case 39:    // Left arrow
		            
		            	bCallSuper = false;
		    
		                if (oParentItem) {
		    
		                    oParentMenu = oParentItem.parent;
		    
		                    if (oParentMenu instanceof YAHOO.widget.MenuBar) {
		    
		                        oNextItem = 
		                            oParentMenu.activeItem.getPreviousEnabledSibling();
		    
		                        if (oNextItem) {
		                        
		                            oParentMenu.clearActiveItem();
		    
		                            oNextItem.cfg.setProperty("selected", true);
		    
		                            oSubmenu = oNextItem.cfg.getProperty("submenu");
		    
		                            if (oSubmenu) {
		                            
		                                oSubmenu.show();
		                            
		                            }
		    
		                            oNextItem.focus();
		                        
		                        } 
		                    
		                    }
		                    else {
		    
		                        this.hide();
		    
		                        oParentItem.focus();
		                    
		                    }
		    
		                }
		    
		                Event.preventDefault(oEvent);
		
		                stopMouseEventHandlers();
		
		            break;        
		    
		        }
		    }
		}
	    
	    if (bCallSuper)
        {
			YAHOO.idc.menu.Menu.superclass._onKeyDown.call(this, p_sType, p_aArgs, p_oMenuBar);
		}
	},
	
	configX: function (type, args, obj)
	{
		if (its.ie)
		{
			var x = args[0];
			YAHOO.util.Dom.setX(this.element, x, true);
		}
		
		YAHOO.idc.menu.Menu.superclass.configX.call(this, type, args, obj);
	}
});


YAHOO.idc.menu.closeOpenMenu = function()
{
	var currentlyOpenedMenu = YAHOO.idc.menu.openedMenu;
	if (!YAHOO.lang.isNull(currentlyOpenedMenu) && !YAHOO.lang.isUndefined(currentlyOpenedMenu))
	{
		YAHOO.widget.MenuManager.hideVisible();
	}
	YAHOO.idc.menu.openedMenu = null;
}

YAHOO.idc.menu.showMenu = function(p_oEvent, oMenu)
{
	YAHOO.util.Event.stopPropagation(p_oEvent);
	oMenu.show();
	oMenu.focus();
}

YAHOO.idc.menu.getTopmostParentMenu = function(oMenu)
{
	var topmostMenu = oMenu,
		temp = oMenu.parent;
	while (temp != null)
	{
		topmostMenu =  temp;
		temp = topmostMenu.parent;
	}
	return topmostMenu;
}

/**
 * Removes all items in this menu (and its submenus recursively)
 * who have no children/link, and all menus which have no items in them. 
 * p_oMenu - The menu to start cleaning from.
 */
YAHOO.idc.menu.cleanMenu = function(p_oMenu)
{
	var aItems = p_oMenu.getItems();
	if (aItems.length == 0)
	{
		return;
	}

	// Recurse through all the submenus and clean them, too.
	var aSubmenus = p_oMenu.getSubmenus();
	for (var a = 0; a < aSubmenus.length; a++)
	{
		YAHOO.idc.menu.cleanMenu(aSubmenus[a]);
	}
	
	// Delete any items that serve no purpose
	for (var b = aItems.length - 1; b >= 0; b--)
	{
		var hasSubmenu = false;
		var oSubmenu = aItems[b].cfg.getProperty("submenu");
		var sUrl = aItems[b].cfg.getProperty("url");
		var bSubmenuItemsExists = false;
		var aSubmenuItems = null;
		
		if (oSubmenu != null)
		{
			aSubmenuItems = oSubmenu.getItems();
			bSubmenuItemsExists = (!YAHOO.lang.isNull(aSubmenuItems) && !YAHOO.lang.isUndefined(aSubmenuItems));
			if (bSubmenuItemsExists && aSubmenuItems.length > 0)
			{
				hasSubmenu = true;
			}
		}
		
		// Delete the item if it has no submenu and href
		if (!hasSubmenu && sUrl == "#")
		{
			aItems[b].destroy();
		}
		// Otherwise, possibly destroy its menu if there are no items in it.
		else if (bSubmenuItemsExists && aSubmenuItems.length == 0)
		{
			// We can't use destroy, because it doesn't seem to work...
			// Instead, just orphan the submenu.
			aItems[b].cfg.setProperty("submenu", null);
		}
	}
}

/*
 * Wraps a navbuilder object for YUI construction
 * p_oNavbuilder - The navbuilder object
 * p_sTopMenuName - The name for the head menu
 * p_oConfiguration - Any special YUI configuration to be included for the head menu 
 */
YAHOO.idc.menu.wrapNavbuilderForYui = function(p_oNavbuilder, p_sTopMenuName, p_oConfiguration,
	p_sDefaultTarget)
{
	p_oNavbuilder.m_bUsingTopMenus = true;
	p_oNavbuilder.buildMenuFromXml = YAHOO.idc.menu.buildMenuFromXml;
	p_oNavbuilder.m_sTopMenuName = p_sTopMenuName;
	p_oNavbuilder.m_oConfiguration = p_oConfiguration;
	p_oNavbuilder.m_sDefaultTarget = p_sDefaultTarget;
}

/*
 * Parses an XML node from a navbuilder object into a configuration object
 * that YUI can use to build a menu item.
 * p_oNode - a navbuilder XML node
 * returns - a configuration object for YUI
 */
YAHOO.idc.menu.parseNode = function (p_oNode, p_sDefaultTarget)
{
	var oMenuItemConfig = new Object();
	
	// Parse all arguments supplied.
	for (i = 0; i < p_oNode.attributes.length; i++) 
	{
		var sAttrName = p_oNode.attributes[i].name;
		var sAttrValue = p_oNode.attributes[i].value;
		var sAttrNameYUI = YAHOO.idc.menu.convertAttrNameToYUI(sAttrName);
		if (sAttrNameYUI)
		{
			oMenuItemConfig[sAttrNameYUI] = sAttrValue;
		}
	}
	
	// Set the default target if it was not provided and this is not a URL-free node
	var sTarget = oMenuItemConfig['target'];
	var sUrl = oMenuItemConfig['url'];
	if ((YAHOO.lang.isNull(sTarget) || YAHOO.lang.isUndefined(sTarget)) &&
		!YAHOO.lang.isNull(sUrl) && !YAHOO.lang.isUndefined(sUrl) &&
		sUrl != "" && sUrl != "#")
	{
		oMenuItemConfig['target'] = p_sDefaultTarget;
	}
	
	// Create a submenu now if this is a collection.
	if (p_oNode.tagName == 'collection')
	{
		oMenuConfig = new Object();
		if (typeof(lcDirection) != "undefined" && lcDirection == 'rtl')
		{
			oMenuConfig['submenualignment'] = ["tr","tl"];
		}
		var oMenu = new YAHOO.idc.menu.Menu(oMenuItemConfig.id + "_submenu", oMenuConfig);
		oMenuItemConfig.submenu = oMenu;
	}
	
	return oMenuItemConfig;
}

/*
 * Converts an attribute name (from the old navbuilder api) to the
 * name that YUI expects for its configuration object.
 * p_sAttrName - a navbuilder attribute name
 * returns - a YUI attribute name
 */
YAHOO.idc.menu.convertAttrNameToYUI = function (p_sAttrName)
{
	if (p_sAttrName == 'id' || p_sAttrName == 'url' || p_sAttrName == 'target')
	{
		return p_sAttrName;
	}
	else if (p_sAttrName == 'label')
	{
		return 'text';
	}
	
	// There are four other attributes that come up when dealing with trays:
	// 'icon', 'collection_service', 'isRebuild', 'tray_doc'.  We can deal
	// with these once we implement YUI for trays.  ~dlew
	
	return null;
}

/*
 * An override for the navbuilder buildHTmlStringFromXml function.
 * Instead, it builds a YUI menu, starting with a MenuBar.
 * node - The current XML node in the navbuilder tree
 */
YAHOO.idc.menu.buildMenuFromXml = function(node, p_oMenu)
{
	/* Create a variable containing all children of the parent element. */
	var childList = node.childNodes;

	// If it's the top, initialize the menu 
	var oMenu;
	if (node.tagName == 'navtree')
	{
		this.m_oTopMenu = new YAHOO.idc.menu.MenuBar(this.m_sTopMenuName, this.m_oConfiguration);
		oMenu = this.m_oTopMenu;
	}
	else if (!YAHOO.lang.isNull(p_oMenu) && !YAHOO.lang.isUndefined(p_oMenu))
	{
		oMenu = p_oMenu;
	}
	else
	{
		oMenu = YAHOO.widget.MenuManager.getMenu(node.getAttribute("id") + "_submenu");
	}

	/* Loop through the children of the passed-in element. */
	for (var i=0; i < childList.length; i++)
	{
		var childNode = childList[i];
		
		// create the proper child node
		var oChildMenuItemConfig = YAHOO.idc.menu.parseNode(childNode, this.m_sDefaultTarget);
		
		// Check that we haven't already used this node once.  If we have,
		// make a unique copy of the node's id.  This problem comes up
		// because navbuilder allows nodes to duplicate between being in a collection
		// and being in the top level nodes (see: "My Profile" link).
		var baseId = oChildMenuItemConfig.id;
		var tempMenu = YAHOO.widget.MenuManager.getMenuItem(baseId);
		var n = 1;
		while (tempMenu)
		{
			oChildMenuItemConfig.id = baseId + "_" + n;
			n++;
			var tempMenu = YAHOO.widget.MenuManager.getMenuItem(oChildMenuItemConfig.id);
		}
		
		// Create the new menu item
		var oChildMenuItem;
		if (oMenu instanceof YAHOO.idc.menu.MenuBar)
		{
			oChildMenuItem = new YAHOO.idc.menu.MenuBarItem(oChildMenuItemConfig.id, oChildMenuItemConfig);
		}
		else if (oMenu instanceof YAHOO.idc.menu.Menu)
		{
			oChildMenuItem = new YAHOO.idc.menu.MenuItem(oChildMenuItemConfig.id, oChildMenuItemConfig);
		}
		
		// Add it to the top node
		oMenu.addItem(oChildMenuItem);
		
		// If it is a collection, run this method recursively.
		if (isCollectionNode(childNode))
		{
			this.buildMenuFromXml(childNode, oChildMenuItem._oSubmenu);
		}
	}
}
YAHOO.idc.menu.ImagePopupMenu = function(p_oElement, p_oConfig)
{
	if (p_oConfig)
	{
		if (p_oConfig.imageElement)
		{
			if (YAHOO.lang.isString(p_oConfig.imageElement))
			{
				this.imageElement = document.getElementById(p_oConfig.imageElement);
			}
			else
			{
				this.imageElement = p_oConfig.imageElement;
			}
		}
	}

	YAHOO.idc.menu.ImagePopupMenu.superclass.constructor.call(
		this, 
		p_oElement,
		p_oConfig
	);
};

YAHOO.lang.extend(YAHOO.idc.menu.ImagePopupMenu, YAHOO.widget.Menu, {

init: function(p_oElement, p_oConfig)
{
	if(!this.ITEM_TYPE)
	{
		this.ITEM_TYPE = YAHOO.idc.menu.MenuItem;
	}

	// Call the init of the superclass (YAHOO.widget.Menu)
	YAHOO.idc.menu.ImagePopupMenu.superclass.init.call(this, p_oElement);

	this.beforeInitEvent.fire(YAHOO.idc.menu.ImagePopupMenu);

	if(p_oConfig)
	{
		this.cfg.applyConfig(p_oConfig, true);
	}

	this.initEvent.fire(YAHOO.idc.menu.ImagePopupMenu);
},

show: function()
{
	YAHOO.idc.menu.closeOpenMenu();
	
	var src = this.imageElement.src;
	var index = src.lastIndexOf('.');
	this.imageElement.src = src.substring(0, index) + '_over' + src.substring(index);
	
	this.align();
	YAHOO.idc.menu.ImagePopupMenu.superclass.show.call(this);
	YAHOO.idc.menu.openedMenu = this;
},

hide: function()
{
	this.imageElement.src = this.imageElement.src.replace(/_over/, "");
	YAHOO.idc.menu.ImagePopupMenu.superclass.hide.call(this);
},

/**
* @property imageElement
* @description Object reference to the HTML image element to which
* this menu is attached.
* @default null
* @type HTMLImgElement
*/
imageElement: null,

/**
* @method toString
* @description Returns a string representing the action popup menu.
* @return {String}
*/
toString: function()
{
	return ("ImagePopupMenu " + this.id);
},

/**
* @description Initializes the class's configurable properties which can be
* changed using the menu bar's Config object ("cfg").
* @method initDefaultConfig
*/
initDefaultConfig: function()
{
	YAHOO.idc.menu.ImagePopupMenu.superclass.initDefaultConfig.call(this);

	var oConfig = this.cfg;

	// Add configuration properties
}

}); // END YAHOO.lang.extend

YAHOO.idc.menu.ImagePopupContextMenu = function (p_oElement, p_oConfig)
{
	YAHOO.idc.menu.ImagePopupContextMenu.superclass.constructor.call(
		this, 
		p_oElement,
		p_oConfig
	);
}

YAHOO.lang.extend(YAHOO.idc.menu.ImagePopupContextMenu, YAHOO.idc.menu.ImagePopupMenu, {
	init: function (p_oElement, p_oConfig)
	{
		if(!this.ITEM_TYPE)
		{
			this.ITEM_TYPE = YAHOO.idc.menu.IdcContextMenuItem;
		}
		
		YAHOO.idc.menu.ImagePopupMenu.superclass.init.call(this, p_oElement, p_oConfig);
	}
});

YAHOO.idc.menu.createAndDisplayImagePopupMenu = function(p_oEvent, extraArgs)
{
	var menuId = extraArgs[0];
	var imageId = extraArgs[1];
	var linkId = extraArgs[2];
	var menuItems = extraArgs[3];
	var cfg = extraArgs[4];
	var itemType = (cfg && cfg.itemType) ? cfg.itemType : YAHOO.idc.menu.ImagePopupMenu;
	var className = (cfg && cfg.className) ? cfg.className : 'yui_idc_actionspopupmenu';

	YAHOO.util.Event.stopPropagation(p_oEvent);

	var oMenu = new itemType(menuId,
		{visible:false, context:[imageId,'tr','tl'], constraintoviewport:true, imageElement:imageId,
		 classname: className });
	if (YAHOO.lang.isNull(menuItems) || YAHOO.lang.isUndefined(menuItems))
	{
		oMenu.render();
	}
	else
	{
		oMenu.addItems(menuItems);
		
		// Firefox 2 and below have a bug which causes problems
		// in the display of the menus if not on document.body.
		// For more information see BUG 7253808.
		if (its.firefox && YAHOO.env.ua.gecko < 1.9)
		{
			oMenu.render(document.body)
		}
		else
		{
			// Create a div after the link, place the menu into that.
			var linkEl = document.getElementById(linkId);
			var divEl = document.createElement('div');
			divEl.style.cssFloat = "left";
			divEl.style.styleFloat = "left";
			linkEl.parentNode.insertBefore(divEl, linkEl.nextSibling);
			oMenu.render(divEl);
		}
	}
	
	YAHOO.util.Event.removeListener(linkId, 'click', YAHOO.idc.menu.createAndDisplayImagePopupMenu);
	YAHOO.util.Event.addListener(linkId, 'click', YAHOO.idc.menu.showMenu, oMenu);
	oMenu.show();
	oMenu.focus();
	
	return oMenu;
}

YAHOO.idc.menu.IdcContextMenuItem = function(p_oObject, p_oConfig) 
{
	YAHOO.idc.menu.IdcContextMenuItem.superclass.constructor.call(this, p_oObject, p_oConfig);
};

YAHOO.extend(YAHOO.idc.menu.IdcContextMenuItem, YAHOO.widget.ContextMenuItem, {
	

	hide: function()
	{
		YAHOO.util.Dom.setStyle(this.element, "display", "none");
	},
	
	show: function()
	{
		YAHOO.util.Dom.setStyle(this.element, "display", "block");
	},
	
	initDefaultConfig: function()
	{
		YAHOO.idc.menu.IdcContextMenuItem.superclass.initDefaultConfig.call(this);
		var oConfig = this.cfg;

		// Add configuration properties
	
		oConfig.addProperty(
			"hidden", 
			{
				value:false, 
				handler:this.configHidden
			});
			
		oConfig.addProperty("menuID", {});
		oConfig.addProperty("menuGroup", {});
	},
	init: function(p_oObject, p_oConfig) {
		YAHOO.idc.menu.IdcContextMenuItem.superclass.init.call(this, p_oObject, p_oConfig);
		
		// reapply the config with the 'setDefaults' set to true
		// so the initial config is set as the 'defaults' to allow resets
		this.cfg.applyConfig(p_oConfig, true);
	},
	configHidden: function(p_sType, p_aArgs, p_oItem)
	{
		var isHidden = p_aArgs[0];
		
		if (isHidden)
		{
			p_oItem.hide();
		}
		else
		{
			p_oItem.show();
		}	
		
	}
});

YAHOO.idc.menu.MenuBar = function (p_oElement, p_oConfig)
{
	YAHOO.idc.menu.MenuBar.superclass.constructor.call(
		this, 
		p_oElement,
		p_oConfig
	);
};

YAHOO.lang.extend(YAHOO.idc.menu.MenuBar, YAHOO.widget.MenuBar, {

	init: function(p_oElement, p_oConfig)
	{
	    this.ITEM_TYPE = YAHOO.idc.menu.MenuBarItem;
	
	    YAHOO.idc.menu.MenuBar.superclass.init.call(this, p_oElement, p_oConfig);
	},

	show: function()
	{
		// Clear out any parents with no children
		YAHOO.idc.menu.cleanMenu(this);
		
		// Show the menu bar
		YAHOO.idc.menu.MenuBar.superclass.show.call(this);
	},

	_onKeyDown: function(p_sType, p_aArgs, p_oMenuBar) 
	{
		var oEvent = p_aArgs[0],
        	oItem = p_aArgs[1];
        
        var currentlyOpenedMenu = YAHOO.idc.menu.openedMenu;
		if(oItem && !oItem.cfg.getProperty("disabled") && oEvent.keyCode == 40)
        {
        	if (!YAHOO.lang.isNull(currentlyOpenedMenu) && !YAHOO.lang.isUndefined(currentlyOpenedMenu))
        	{
	        	var currTopmostMenu = YAHOO.idc.menu.getTopmostParentMenu(YAHOO.idc.menu.openedMenu);
	        	var newTompostMenu = YAHOO.idc.menu.getTopmostParentMenu(oItem);
	        	if (currTopmostMenu != newTompostMenu)
	        	{
	        		YAHOO.idc.menu.closeOpenMenu();
	        		YAHOO.idc.menu.openedMenu = oItem.cfg.getProperty("submenu");
	        	}
	        }
	        else
	        {
	        	YAHOO.idc.menu.openedMenu = oItem.cfg.getProperty("submenu");
	        }
        }
        
        // Reverse the left-right direction on the keyboard, so that we simulate the
        // same navigation even with the menus flipped.  Note that most of this code is ripped 
        // directly from menubar.js, and should be updated whenever YUI is updated
        // (until YUI supports RTL).
        var bCallSuper = true;
        if(oItem && !oItem.cfg.getProperty("disabled") && typeof(lcDirection) != "undefined" && 
        	lcDirection == 'rtl') {
	
	        oItemCfg = oItem.cfg;
	
	        switch(oEvent.keyCode) {
	    
	            case 37:    // Left arrow
	            case 39:    // Right arrow
	            
	                bCallSuper = false;
	    
	                if(oItem == this.activeItem && 
	                    !oItemCfg.getProperty("selected")) {
	    
	                    oItemCfg.setProperty("selected", true);
	    
	                }
	                else {
	    
	                    oNextItem = (oEvent.keyCode != 37) ? 
	                        oItem.getPreviousEnabledSibling() : 
	                        oItem.getNextEnabledSibling();
	            
	                    if(oNextItem) {
	    
	                        this.clearActiveItem();
	    
	                        oNextItem.cfg.setProperty("selected", true);
	    
	    
	                        if(this.cfg.getProperty("autosubmenudisplay")) {
	                        
	                            oSubmenu = oNextItem.cfg.getProperty("submenu");
	                            
	                            if(oSubmenu) {
	                        
	                                oSubmenu.show();
	                            
	                            }
	                
	                        }           
	    
	                        oNextItem.focus();
	    
	                    }
	    
	                }
	    
	                Event.preventDefault(oEvent);
	    
	            break;
	        }
	    }
        
        if (bCallSuper)
        {
			YAHOO.idc.menu.MenuBar.superclass._onKeyDown.call(this, p_sType, p_aArgs, p_oMenuBar);
		}
	},

	_onClick: function(p_sType, p_aArgs, p_oMenuBar)
	{
		YAHOO.idc.menu.closeOpenMenu();
		YAHOO.idc.menu.MenuBar.superclass._onClick.call(this, p_sType, p_aArgs, p_oMenuBar);
		
		var oItem = p_aArgs[1];
		var oSubmenu = oItem.cfg.getProperty("submenu");
		YAHOO.idc.menu.openedMenu = oSubmenu;
	}
});YAHOO.idc.menu.MenuItem = function (p_oObject, p_oConfig) 
{
    YAHOO.idc.menu.MenuItem.superclass.constructor.call(this, 
        p_oObject, p_oConfig);
};

YAHOO.lang.extend(YAHOO.idc.menu.MenuItem, YAHOO.widget.MenuItem, {
	init: function(p_oObject, p_oConfig)
	{
		this.SUBMENU_TYPE = YAHOO.idc.menu.Menu;
		
		YAHOO.idc.menu.MenuItem.superclass.init.call(this, p_oObject, p_oConfig);
	}
});
YAHOO.idc.menu.MenuBarItem = function(p_oObject, p_oConfig) 
{
    YAHOO.idc.menu.MenuBarItem.superclass.constructor.call(this, 
        p_oObject, p_oConfig);
};

YAHOO.lang.extend(YAHOO.idc.menu.MenuBarItem, YAHOO.widget.MenuBarItem, {
	init: function(p_oObject, p_oConfig)
	{
		this.SUBMENU_TYPE = YAHOO.idc.menu.Menu;
		
		YAHOO.idc.menu.MenuBarItem.superclass.init.call(this, p_oObject, p_oConfig);
	}
});

