var mookSelectMenu = new Class({	
	Implements: [Options, Events],
	options: {
		title: "Select an Action...",
		class_extras: '',
		name: ''
	},
	initialize: function(container, menuItems, options) {
		this.setOptions(options);
		this.container = $(container);
		this.menuItems = menuItems;
		this.title = this.options.title;
		this.createMenu();
	},
	createMenu: function() {
		var el = new Element('select', {
			id: 'mookSelectMenu',
			'class': 'mookSelectMenu '+this.options.class_extras,
			name: this.options.name,
			events: {
				'change': function(){
					var item = el.getElement(':selected').get('value');
					this.fireEvent('select', item);
				}.bind(this)
			}
		}).adopt(
			this.createOptions()
		).inject(this.container, 'top');
	},
	/* internal function to create option entries */
	createOptions: function() {
		var optArray = new Array();
		this.menuItems.each(function(item, index) {
			var el = new Element('option', {
				value: item['value'],
				text: item['text']
			});
			optArray.push(el);
		});
		return optArray;
	}.protect()
});
