var NavigationPanel = new Class({

	Implements: [Options, Elements, Events],

	//options
	options: {
		duration: 1000,
		delay: 0,
		panel: $empty,		//Needs to be pashed a element from the new NavigationPanel() declaration;
		wrapper: $empty,
		onEnable: $empty,
		onDisable: $empty
	},
	//implements
	Implements: [Options,Events],

	//initialization
	initialize: function(container, options)
	{
		//set options
		this.setOptions(options);

		this.container = ($type(container) == 'element') ? container : $(container);
		this.active = false;
		this.wrapper = this.options.wrapper;
		this.containerSlider 	= new Fx.Tween(this.options.panel, 	{ 
				transition: Fx.Transitions.Quart.easeOut, 
				duration: this.options.duration
				}
			).set('margin-top', ($(this.options.panel).getHeight() * -1));
			
			this.wrapperSlider 		= new Fx.Tween(this.wrapper,	{ transition: Fx.Transitions.Quart.easeOut, duration: this.options.duration
			});
			this.showTimer = $empty;
		
			var self = this
			
			this.container.addEvents({
				'mouseenter' : function()
				{
					self.showTimer = self.show.delay(500, self);
					//this.show();
				},
				'mouseleave' : function()
				{
					$clear(self.showTimer); 
					self.hide();
				},
				'click' : function(e)
				{
					self.show();
				}
			});
		},
		show: function()
		{
			var self = this;
			if (!this.active)
			{
				this.active = true;
				this.container.addClass('hover');
				this.containerSlider.pause().start('margin-top', 0);
				this.wrapperSlider.pause().start('height', $(this.options.panel).getHeight()).chain(function(){
					self.enable();
				});
			}
		},
		hide: function()
		{
			if(this.active)
			{
				this.active = false;
				this.container.removeClass('hover');
				this.containerSlider.pause().start('margin-top', ($(this.options.panel).getHeight() * -1));
				this.wrapperSlider.pause().start('height', 0);
			}
			this.disable();			
		},
		enable: function() {
			this.fireEvent('onEnable');
		},
		disable: function() {
			this.active = false;
			this.fireEvent('onDisable');
		}
});
