var mootabs = new Class({
												
	initialize: function(el, props) {
		//options
		this.options = {
			initialTitle: props.initialTitle || 0
		};
		
		//main element reference
		this.el = $(el);
		
		//titles
		this.titles = $$('.tab-titles li');
		this.titles.each(function(t) {
			t.store('content_id', t.get('title'));
			t.set('title', '');
		});
		this.titles.addEvent('click', function() {
			$$('.tab-content').setStyle('display', 'none');
			$$('.tab-titles li').removeClass('current');
			$(this.retrieve('content_id')).setStyle('display', 'block');
			this.addClass('current');
		});
		
		//show initial tab
		this.show(this.options.initialTitle);
	},
	
	show: function(title) {
		if(isNaN(title)) {
			var title_fire = false;
			this.titles.each(function(t) {
				if(t.retrieve('content_id') == title) {
					title_fire = t;
				}
			});
			if(title_fire) {
				title_fire.fireEvent('click');
				return true;
			}
		}
		else if(this.titles[title]) {
			this.titles[title].fireEvent('click');
			return true;
		}
		
		//show first tab if the other methods fail
		this.titles[0].fireEvent('click');
		return true;
	}
	
});
