var rules = {
	'table.tabs tr' : function(e) {
		e.tabSet = e.parentNode
		if (Element.visible(e)) {
			e.tabSet.activeTab = e;
		}
	},
	'table.tabs th' : function(e) {
		e.tabSet = e.parentNode.parentNode
		e.onclick = function() {
			var tabId = this.id.substring(0,this.id.indexOf('-header'));
			var tab = $(tabId);
			if (this.tabSet.activeTab != tab) {
				this.className = 'active';
				$(this.tabSet.activeTab.id+'-header').className = '';
				Element.show(tab);
				Element.hide(this.tabSet.activeTab);
				this.tabSet.activeTab = tab;
			}
		}
	}
};

Behaviour.register(rules);
