var ss = document.styleSheets[0];
if (ss.insertRule) {
	ss.insertRule(".tabhide { display: none }", 0); // Mozilla
} else if (ss.addRule) {
	ss.addRule(".tabhide", "display: none"); // IE
}

var mootabs;
function tabloader() {
	mootabs = {
		tabs: $$('#tabs .tab'),
		tabareas: $$('#tabareas .tabcontent'),
		init: function() {
			this.tabs.each(function(t,i) {
				t.addEvent('click', this.change.bind(this,i));
			}, this);
			this.change(0);
		},
		change: function(to) {
			this.tabs.each(function(t, i) {
				if (i==to) t.addClass('tabactive');
				else t.removeClass('tabactive');
			});
			this.tabareas.each(function(t, i) {
				if (i==to) t.removeClass('tabhide');
				else t.addClass('tabhide');
			});
		}
	}
	mootabs.init();
}
window.addEvent('domready', tabloader);