Menu = {

	/**
	 * Initializes 
	 */
	init: function()
	{
		if (document.observe)
		{
			document.observe("dom:loaded", Menu._doInit);
		}
		else
		{
			Element.observe(window, "load", Menu._doInit);
		}
	}, // function init

	/**
	 * Perform actual initialization 
	 */
	_doInit: function()
	{
		/* add functions to the images */
		var linkContainer = 'menu';
		
		if($(linkContainer))
		{
			var elements = $(linkContainer).getElementsBySelector("img");
			
			for (var i = 0; i < elements.length; i++)
			{
				if (elements[i].src.indexOf('grayscale') != -1)
				{
					elements[i].onmouseover = function(){ Menu.showColorIcon(this); }
					elements[i].onmouseout = function(){ Menu.showGrayIcon(this); }
				}
			}
		}
	}, // function _doInit

	/**
	 * Replace a gray icon to a colored variant
	 *
	 * @param	element Name of the image element
	 */
	showColorIcon: function(element)
	{
		if(element.src.indexOf('grayscale'))
		{
			element.src = element.src.replace('/grayscale', '');
		}
	}, // function showColorIcon

	/**
	 * Replace a colored icon to a grayscale variant
	 *
	 * @param	element Name of the image element
	 */
	showGrayIcon: function(element)
	{
		if(!element.hasClassName('active') && element.src.indexOf('grayscale') == -1)
		{
			element.src = element.src.replace('menu', 'menu/grayscale');
		}
	} // function showGrayIcon


}; // class Menu

Menu.init();
