function TabbedNavigation(tabs, contentContainers, activeClassName) {
	var self = this; // to be used in closures below
	
	this.tabs = tabs;
	this.active = -1;
	this.activeClassName = activeClassName;
	
	this.tabs.each(function(el, n) {
		if (Element.hasClassName(el.parentNode, self.activeClassName)) {
			self.active = n;
		}
		
		el.onclick = self.tabClicked.bind(self, n);
		el.onmouseover = self.tabOver;
		el.onmouseout = self.tabOut
	});
	
	if (contentContainers) {
		for (i=0; i<contentContainers.length; i++) {
			if (Element.hasClassName(contentContainers[i], activeClassName)) {
				this.active = i;
				break;
			}
		}
	}
}
TabbedNavigation.prototype = {
	tabClicked: function(n) {
		this.hideAll();
		
		Element.addClassName(this.tabs[n].parentNode, this.activeClassName);
		
		this.active = n;
		
		return false;
	},
	tabOver: function() {
		Element.addClassName(this, "hovered");
	},
	tabOut: function() {
		Element.removeClassName(this, "hovered");
	},
	showAll: function() {
		for (i=0; i<this.tabs.length; i++) {
			Element.addClassName(this.tabs[i].parentNode, this.activeClassName);
		}
	},
	hideAll: function() {
		for (i=0; i<this.tabs.length; i++) {
			Element.removeClassName(this.tabs[i].parentNode, this.activeClassName);
		}
		this.active = -1;
	}
}