/*
Modules:
	- Domready
	- Fx.Tween
	- Element.Event
	- Selectors
*/


var menu = {
	initialize: function() {
		$$('a.projects').each(function(el) {
			// Get the parent list item and the submenu ul
			var li = el.getParent('li');
			var ul = el.getNext('ul');
			
			// The submenu is hidden by default, but if we don't set the opacity the fade won't work correctly on the first try
			ul.setStyle('opacity', 0);
			
			// Apply the events to the parent li
			li.addEvent('mouseenter', function(){
				ul.fade(1);
			});
			
			li.addEvent('mouseleave', function(){
				ul.fade(0);
			});

		});
	}
}

	
window.addEvent('domready', function() {
	menu.initialize();
});
