/* Drop Down Menu */

Menu = Class.create({
	initialize: function(container) {
		this.container = container;
		this.level0 = this.container.childElements('li');
		this.level0.each((function(li) {
			li.observe('mouseenter', this.over.bind(li));
			li.observe('mouseleave', this.out.bind(li));
		}).bind(this));
		this.timer;
	},
	over: function(event) {
		if (this.timer) {
			clearTimeout(this.timer);
		}
		this.addClassName('hover');
	},
	out: function(event) {
		var that = this;
		this.timer = setInterval(function(){
			that.removeClassName('hover');
		},60);
		/*this.removeClassName('hover');*/
	}
});
Object.extend(Menu, {
	load: function() {
		new Menu($('mainnav'));
	}
});

Event.observe(window, 'load', Menu.load);