
Event.observe( document, 'click', function() { navigation.close_menu(); } );

var AL_navigation = Class.create( {
	
	  current_menu : null
	, timelimit : 300
	, status : false
	, timer : null

	, initialize : function()
	{
	}
	
	, drop_menu : function( id )
	{
		$( id ).style.display = 'block';
		
		if ( this.current_menu != id )
		{
			this.close_menu( this.current_menu );
		}

		this.current_menu = id;
		
		this.clear_timer( id );
	}

	, close_menu : function( id )
	{
		if ( id )
		{
			$( id ).style.display = 'none';
		}
		else if ( this.current_menu )
		{
			$( this.current_menu ).style.display = 'none';
		}
		
		this.current_menu = null;
	}
	
	, clear_timer : function( id )
	{
		if ( this.timer )
		{
			clearTimeout( this.timer );
		}
		
		this.timer = null;
	}
	
	, mouse_out : function( id )
	{
		this.timer = setTimeout( function(){ $( id ).style.display = 'none'; }, this.timelimit );
	}

} );

navigation = new AL_navigation();
