/***********************************************
* Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and 100s more
***********************************************/

var drivetabs={
	subcontainers:[], last_accessed_tab:null,

	revealsubmenu:function(curtabref){
		this.hideallsubs()
		if (this.last_accessed_tab!=null)
			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")).style.display="block"
		curtabref.className="current"
		this.last_accessed_tab=curtabref
	},

	revealsubmenu1:function(curtabref){
		this.hideallsubs()
		if (curtabref.getAttribute("rel")) //If there's a sub menu defined for this tab item, show it
			document.getElementById(curtabref.getAttribute("rel")).style.display="block"
		curtabref.className="mo"
		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") //store id of submenu div of tab menu item
			else 
				continue
			if (i==selectedIndex){ //if this tab item should be selected by default
				tabItems[i].className="current"
				this.revealsubmenu(tabItems[i])
			} else {
//			tabItems[i].onmouseover=function(){
//				drivetabs.revealsubmenu(this)
//			}
				tabItems[i].onmouseover=function(){
					drivetabs.revealsubmenu1(this)
				}
				tabItems[i].onmouseout=function(){
					this.className=""
					drivetabs.hideallsubs()
					document.getElementById(tabItems[selectedIndex].getAttribute("rel")).style.display="block"
				}
			}
//			tabItems[i].onmouseout=function(){
//				drivetabs.revealsubmenu(tabItems[selectedIndex])
//			}
		} //END FOR LOOP
	}

}
