window.addEvent('domready', function() {

	$$('div[id^=menu]').each(function(el) {
		el.set('morph', {duration:400, transition:Fx.Transitions.Quint.easeOut, wait:false});
		el.addEvent('mouseleave', function(e) {
			new Event(e).stop();
			var height = this.getStyle('height').toInt(); 
			if (height < 1) return this.morph({ 'height': 85, 'opacity': 0.5}); 
			else return this.morph({ 'height': 0 , 'opacity': 0.0});
		});
	});
	
	$$('.menuButton').each(function(el) {
		el.addEvent('click', function(e) {
			new Event(e).stop();
			var target = $('menu'+this.getProperty('rel'));
			var height = target.getStyle('height').toInt();
			if (height < 1) return target.morph({ 'height': 85, 'opacity': 0.8}); 
			else return target.morph({ 'height': 0 , 'opacity': 0.0});
		});
	});
	
});