var Menu = new Class({
	
	Implements: [Options, Events],
	
	options: {
		//itemSelector: '',
		//subMenuSelector: ''
	},
	
	initialize: function(element, options){
		this.setOptions(options);
		this.element = document.id(element) || $$(element)[0];
		this.menuItems = this.element.getElements(this.options.itemSelector);
		this.menuItems.each(this.itemsSetup, this);
	},
	
	itemsSetup: function(el, index){
		el.addEvent('mouseenter', this.mouseEnter.bindWithEvent(this, [el, index]));
		el.addEvent('mouseleave', this.mouseLeave.bindWithEvent(this, [el, index]));
		this.fireEvent('init', [el, index]);
	},
	
	mouseEnter: function(e, el, index){
		this.fireEvent('enter', [e, el, index]);
	},
	
	mouseLeave: function(e, el, index){
		this.fireEvent('leave', [e, el, index]);
	}
	
});

Menu.Fx = new Class({
	
	Extends: Menu,
	
	options: {
		//fxChildSelector: null
	},
	
	initialize: function(element, options){
		this.itemsFx = [];
		this.parent(element, options);
	},
	
	itemsSetup: function(el, index){
		this.itemsFx[index] = new Fx.Elements(
			[this.options.fxChildSelector ? el.getElement(this.options.fxChildSelector) : el, el.getElement(this.options.subMenuSelector)],
			{link: 'cancel'}
		);
		this.parent(el, index);
	}
	
});
