var simpleMenu = new Class({
	options: {
		onActive: Class.empty,
		onBackground: Class.empty,
		show: null
	},
	
	initialize: function(togglers, elements, options){
		this.togglers = $$(togglers);
		this.elements = [];
		this.index = null;
		elements = $$(elements);
		
		this.togglers.each(function(toggler, index){
			var element = this.elements[index] = elements[index] || null;
			if(element){
				toggler.addEvent('click', function(e){
					this.display(index);
				}.bind(this));
				element.setStyle('display', 'none');
			}
		}, this);
		
		this.setOptions(options);
		
		if(this.options.show != null && this.togglers[this.options.show]){
			this.display(this.options.show);
		}
	},
	
	display: function(index){
		if(this.elements[this.index]){
			this.elements[this.index].setStyle('display', 'none');
			this.fireEvent('onBackground', [this.togglers[this.index], this.elements[this.index]]);
		}

		if(this.elements[index]){
			this.index = index;
			this.elements[index].setStyle('display', '');
			this.fireEvent('onActive', [this.togglers[this.index], this.elements[this.index]]);
		}
	}
});
simpleMenu.implement(new Events, new Options);