var Tabs = new Class({
	initialize: function(container, active) {
		container = $(container);
		this.active = $chk(active) ? active : 0;
		this.nav = container.getElements('.tabs li');
		this.content = container.getElements('.tabContent');
		
		this.nav.each(function(navItem, i) {
			navItem.addEvent('click', function() {
				this.show(i);
			}.bind(this));
			
			if(this.active == i) {
				this.content[i].morph({
					opacity: 1,
					display: 'block'
				});
				this.nav[i].addClass('active');
			}
			else {
				this.content[i].morph({
					opacity: 0,
					display: 'none'
				});
				this.nav[i].removeClass('active');
			}
		}.bind(this));
	},
	
	show: function(i) {
		if(i != this.active) {
			this.content[this.active].morph({
				display: 'none',
				opacity: 0
			});
			this.content[i].morph({
				display: 'block',
				opacity: 1
			});
			
			this.nav[this.active].removeClass('active');
			this.nav[i].addClass('active');
			
			this.active = i;
		}
	}
});