var dolphintabs={
	subcontainers:[], last_accessed_tab:null, currentMenuElement:null,

	revealsubmenu:function(curtabref){
	this.hideallsubs()
	if (this.last_accessed_tab!=null && this.last_accessed_tab.rel!=this.currentMenuElement)
	{
		this.last_accessed_tab.className="";
	}
 	if (curtabref.getAttribute("rel")) 
	{
		//If there's a sub menu defined for this tab item, show it
		document.getElementById(curtabref.getAttribute("rel")+"_Extra").style.display="block"
	}
	curtabref.className="selected"
	this.last_accessed_tab=curtabref
	},

	hideallsubs:function(){
	for (var i=0; i<this.subcontainers.length; i++)
	{
		document.getElementById(this.subcontainers[i]).style.display="none"
	}
	},

	init:function(menuId, selectedIndex){
		var tabItems=document.getElementById(menuId).getElementsByTagName("a")
		for (var i=0; i<tabItems.length; i++){
			if (tabItems[i].getAttribute("rel"))
			{
				this.subcontainers[this.subcontainers.length]=tabItems[i].getAttribute("rel") + "_Extra"; //store id of submenu div of tab menu item
			}
			if (i==selectedIndex)
			{
				//if this tab item should be selected by default
				tabItems[i].className="current"
			}
		tabItems[i].onmouseover=function(){
		dolphintabs.revealsubmenu(this)
		}
		} //END FOR LOOP
		if (selectedIndex==-1)
		{
			this.hideallsubs();
		}
		else
		{
		this.currentMenuElement = tabItems[selectedIndex].getAttribute("rel");
		this.revealsubmenu(tabItems[selectedIndex])
		}
	}
}