var Menu = new Class({

	handler: null,
	parent: null,
	submenu: null,
	timer: null,

	initialize: function(e) {
		this.handler = $(e);
		this.parent = this.handler.getParent();
		this.submenu = this.parent.getElement('ul');
		
		var ref = this;
		
		$(this.handler).addEvent('mouseover', function() { ref.show() });
		$(this.submenu).addEvent('mouseover', function() { ref.show() });
		$(this.handler).addEvent('mouseout', function() { ref.hide() });
		$(this.submenu).addEvent('mouseout', function() { ref.hide() });
	},

	show: function() {
		window.clearTimeout(this.timer);
		this.submenu.setStyle('display','block');
	},
	
	hide: function() {
		window.clearTimeout(this.timer);
		
		var ref = this;
		
		this.timer = window.setTimeout(function() {
			ref.submenu.setStyle('display','none');
		},500)
	}
});
	
new Menu('menu_outras');

