// JavaScript Document

// Menu toggling
function nav_toggle (element) {
	
	// This gives the active tab its look
	var navid = document.getElementById('nav');
	var navs = navid.getElementsByTagName('li');
	var navsCount = navs.length;		
	
	for(j = 0; j < navsCount; j++) {
		active = (navs[j].id == element.parentNode.id) ? "active" : "";
		navs[j].className = active;
	}
	
	// remove focus from top nav
	if(element) element.blur();
}

// Menu toggling
function nav_clear () {
	
	// This gives the active tab its look
	var navid = document.getElementById('nav');
	var navs = navid.getElementsByTagName('li');
	var navsCount = navs.length;		
	
	for(j = 0; j < navsCount; j++) navs[j].className = ""; 
}

var nav_int = 0;

// Starts a timer for clearing up
function nav_restartTimer ()
{
	nav_clearTimer ();	
	nav_int=setTimeout("nav_clear();",2000);
}

// Stops the clear up timer
function nav_clearTimer ()
{	
	clearTimeout(nav_int);
}