function Menu( oArgument )
{
	this.init( oArgument );
}

Menu.prototype.init = function( oArgument )
{
	if ( typeof oArgument == "undefined" )
		oArgument = new Object;
	
	if ( typeof oArgument.id != "undefined" )
		oArgument.id = "menu";

	window[ ( this._self = "$_oMenu" ) ] = this;

	this._wrapper = document.getElementById( oArgument.id );
	if ( this._wrapper != null )
	{
		this._nodename = typeof oArgument.nodename == "undefined" ? "li" : oArgument.nodename;
	
		this._item = this._wrapper.getElementsByTagName( this._nodename );
		
		if ( this._item.length > 0 )
			this.prepare();
	}
};

Menu.prototype.prepare = function()
{
	var nItem = this._item.length;
	
	while ( nItem-- > 0 )
	{
		this._item[ nItem ]._parent = this;
		this._item[ nItem ]._index = nItem;
		this._item[ nItem ].onclick = window.$_oMenu.__onclick;
		this._item[ nItem ].onmouseover =  window.$_oMenu.__onmouseover;
		this._item[ nItem ].onmouseout = window.$_oMenu.__onmouseout;
	}
	
	return true;
};

Menu.prototype.onmouseover = function( nItem )
{
	var oItem = this._item[ nItem ];
	oItem.className += " hover";
};

Menu.prototype.onmouseout = function( nItem )
{
	var oItem = this._item[ nItem ];
	oItem.className = oItem.className.replace( /\s?(hover)/gi, '' );
};

Menu.prototype.onclick = function( nItem )
{
	var oItem = this._item[ nItem ];
	var sAlert = "";
	if ( typeof oItem.childNodes[ 0 ] != "undefined" )
		if ( oItem.childNodes[ 0 ].nodeName == "A" )
			window.location.href = oItem.childNodes[ 0 ].href;
};

Menu.prototype.__onmouseover = function( e )
{
	this._parent.onmouseover( this._index );
};

Menu.prototype.__onmouseout = function( e )
{
	this._parent.onmouseout( this._index );
};

Menu.prototype.__onclick = function( e )
{
	if ( !e )
		var e = window.event;
	e.cancelBubble = true;
	
	this._parent.onclick( this._index );
};
