
	function MenuItemStruct (a, x, i)
	{
		this.s = [];
		this.p = a;
		this.x = x;
		this.i = i;
	}
	
	MenuItemStruct.prototype.addItem = function ()
	{
		return this.s[this.s.length] = new this.x.$c (this, this.s.length, arguments);
	};
	
	MenuItemStruct.prototype.getChildren = function ()
	{
		return this.s;
	};
	
	MenuItemStruct.prototype.getChildrenRec = function ()
	{
		for (var r = []; o = this.s[i];)
		{
			r.push (o);
			if (o.instance.s.length)
			{
				r = r.concat (o.getChildrenRec ());
			}
		}
		return r;
	};
	
	MenuItemStruct.prototype.getDepth = function ()
	{
		for ( var p = -1, o = this; o.p != null; o = o.p, p++ );
		return p;
	};
	
	MenuItemStruct.prototype.getIndex = function ()
	{
		return this.i;
	};
	
	MenuItemStruct.prototype.getMaxDepth = function (n)
	{
		if (!arguments.length)
		{
			n = 0;
		}
		if (this.s.length)
		{
			for (var o; o = this.s[i]; n = Math.max (o.getMaxDepth (n + 1), n));
			return n;
		}
		return 0;
	};
	
	MenuItemStruct.prototype.getParent = function ()
	{
		return this.p == null ? null : this.p.x;
	};
	
	MenuItemStruct.prototype.getRoot = function ()
	{
		for ( var o = this; o.p != null; o = o.p );
		return o.x;
	};
	
	MenuItemStruct.prototype.getSiblings = function ()
	{
		return this.p.s.slice (0, this.i).concat (this.p.s.slice (this.i + 1));
	};
	
	MenuItemStruct.prototype.getSiblingsAfter = function ()
	{
		var r = this.p.s.slice (this.i + 1);
		return r;
	};
	
	MenuItemStruct.prototype.getAfter = function ()
	{
		for ( var r = [], o = this; o.p != null; r = r.concat (o.p.s.slice (o.i + 1)), o = o.p );
		return r;
	};
	
	MenuItemStruct.prototype.hasChildren = function ()
	{
		return this.s.length > 0;
	};
	
	MenuItemStruct.prototype.isLastItem = function ()
	{
		return this.p == null ? false : this.i == this.p.s.length - 1;
	};
	
	Function.prototype.menuInit = function ()
	{
		this.prototype.$c = this;
		for (var i in MenuItemStruct.prototype)
		{
			this.prototype[i] = new Function ("return MenuItemStruct.prototype['" + i + "'].apply (this.instance, arguments)");
		}
	};
