Event.observe( document, 'dom:loaded', function(){
    $$('ul.submenu').each( function( elem ){
	elem.hide();
	elem.hide_timer = 0;
	elem.up().observe( 'mouseover', function(){
	    if( this.hide_timer != 0 ){ clearTimeout( this.hide_timer ); }
	    //var layout = new Element.Layout(this.up());
	    var offset = 0;
	    //if( layout.get('height') < 25 ) offset = -10; // for single-liners
	    //this.setStyle({ top: (layout.get('top')+offset)+'px' });
	    this.show();
	}.bind( elem ));
	elem.parentNode.observe( 'mouseout', function(){
	    this.hide_timer = window.setTimeout( function(){ 
		this.hide();
	    }.bind( this ), 50 );
	}.bind( elem ));
    });
});
