var TestMenu = new Class({
	Implements: [Options, Events],
	Binds: ['slideIn', 'hide', 'slideOut'],
	options: {
	/*	onIn: $empty,
		onInStart: $empty,
		onOut: $empty,
		hoverGroupOptions: {}, */
		fxOptions: {
		    hideOverflow: false,
			duration: 400,
			transition: 'expo:out',
			link: 'cancel',
			mode: 'horizontal'			 
		},
		outFx: false
	},
	initialize: function(menu, options) {
		this.menu = document.id(menu);
		this.setOptions(options);
		this.makeSlider();
		this.hoverGroup = new HoverGroup($merge(this.options.hoverGroupOptions, {
		    elements: [this.menu],
		    onEnter: this.slideIn,
		    onLeave: this.options.outFx ? this.slideOut : this.hide
		}));		
	},
	makeSlider: function(){
	    this.slider = new Fx.SlideHack(this.menu, this.options.fxOptions).hide();
	},
	slideIn: function() {
	    this.fireEvent('inStart');
	    this.slider.slideIn().chain(function() {
	        this.fireEvent('in');
	    } .bind(this));
	    this.visible = true;
	    return this;
	},
	slideOut: function(useFx) {
	    this.hoverGroup.active = true;
	    this.slider.slideOut().chain(this.hide);
	    return this;
	},
	hide: function() {
	    $clear(this.hoverGroup.assertion);
	    this.hoverGroup.active = false;
	    this.slider.cancel();
	    this.slider.slideOut().chain(function() {
	        this.fireEvent('out');
	    } .bind(this));	    	   
	    this.visible = false;
	    return this;
	},
	isVisible: function() {
	    return this.visible;
	}
});

window.addEvent('domready', function() {
    var menu = new TestMenu('menu');
});
