var SlideMenu = new Class({
	Implements: Options,
	options: {
		mode: "vertical",
		duration:500,
		menu: null
	},
	initialize: function(element, options) {
		this.setOptions(options);
		this.container = $(element);
		if (this.options.menu == null) this.menu = this.container.getElement(".sm_menu");
		else this.menu = $(this.options.menu);
		this.menu.addClass("sm_menu");
		this.container.addClass("sm_container");
		this.setEvents();
		this.initSlider();
	},
	setEvents: function() {
		this.container.addEvent('mouseenter', this.show.bind(this));
		this.container.addEvent('mouseleave', this.hide.bind(this));
	},
	initSlider: function() {
		initSize = this.container.getSize();
		this.container.setStyle("width", initSize.x);
		this.container.setStyle("height", initSize.y);
		this.menu.style.display = "block";
		this.slider = new Fx.Slide(this.menu, this.options).hide();
		this.slider.wrapper.setStyle("width", this.menu.getSize().x);
	},
	show: function() {
		this.slider.cancel();
		this.slider.slideIn();
	},
	hide: function() {
		this.slider.cancel();
		this.slider.slideOut();
	}
});

SlideMenu.initAll = function (options) {
	if (!$chk(options)) options = {};
	if ($chk(options.elements)) elements = options.elements; else elements = $$(".sm_container");
	delete options.elements;
	elements.each(function(item) {
		new SlideMenu(item, this);
	}, options);
}