///var overIdOn;

// set up an array of drop down menus; these need to match the id attribute value
var calMenuIds = new Array();

calMenuIds[20] = 'calendarTools';
calMenuIds[21] = 'calendarViewOptions';
calMenuIds[22] = 'calendarKey';

// each menu gets an over variable so that we can tell one should be on when a user flips
// between 2 back and forth. Of course if there was a class that each menu was an instance
// of we wouldn't need this, but I didn't feel like writing that now did I ;)
over20 = false;
over21 = false;
over22 = false;

// turn all menus off
function allOffCal() {

	// loop on through
	for (i=20;i<calMenuIds.length;i++) {
	
		// tricky part; make sure we're not turning something off that's supposed to be on.
		if (eval('over'+i+' != true')) {
		
			// turn that thang off!
			eval("document.getElementById('"+calMenuIds[i]+"').className = 'menu hidden'");
		
		}
		
	}
		
}

// turn a specific menu on; parameter is the id attribute value of the menu to be visible
function navOnCal(navId, overId) {

	// kill any setTimeout() calls that may be running.
	clearTimeout();
	
	// turn everything else off, which will make sure we don't also turn this one off.
	allOffCal();
	
	// turn that thang on!
	document.getElementById(navId).className = 'menu visible';
	
	overIdOn = -1;
	
}

// turn a specific menu off
function navOffCal(navId, overId) {
	
	// toggle it's over status
	eval('over'+overId+' = false');
	
	// turn that thang off!
	document.getElementById(navId).className = 'menu hidden';
	
}

// check to see if something's still supposed to be on. When a main nav item is moused over, it
// sets the over status of the associated menu to on. Parameters are the id attribute value of the
// menu in question, and the interger part of the over var. Comparing these enables us to turn off anything
// that should be off while keeping what should be on, on.
function checkNavCal(navId, overId) {
	
	if (calMenuIds[overId] == navId) {
		
		clearTimeout();
		
		navOffCal(calMenuIds[overId], overId);
		
		navOnCal(navId, overId);
		
	} else {
		
		navOnCal(navId, overId);
		
	}
	
}