// JavaScript Document
	
	window.addEvent("domready",function(){
										
		// the custom "myheight" property
		// which we'll use to store the height of each <ul> submenu
		Element.Properties.myheight = {
	 
			get: function(){
        		return this.myheight;
		    },
			
			set: function(value){ 
				this.myheight = value; 
				this.setAttribute('myheight', value); 
			}
	 
		};										
										
		// Get all list items that have a submenu (nested ul tags)
		$$('.menu_left li').each(function(li){
										  
			var submenu_check = li.getElement('ul');
			
			// Get the height of the submenu and store it
			// in a custom property of the li called "myheight"
			if (submenu_check) {
				li.set('myheight',submenu_check.getSize().y);
				submenu_check.setStyle('height','0px');
			}
			
			li.addEvent('mouseenter', function() {

				// Show the mouseover state of the link
				this.getElement('a').addClass('selected');
								
				if (submenu_check) {
					// Show the submenu
					el = this.getElement('ul');					
					el.set('tween', {wait:false, duration:400, transition:Fx.Transitions.Cubic.easeOut});
					el.tween('height',this.get('myheight'));
				}
				
			});
			
			li.addEvent('mouseleave', function() {
				
				// Hide the mouseover state of the link
				this.getElement('a').removeClass('selected');
								
				if (submenu_check) {
					// Hide the submenu
					el = this.getElement('ul');
					el.tween('height',0);
				}
			});			
			
		});
										
	});
