// NAVIGATION SPECIFIC SCRIPTS FOR IE:

// CONSTANTS [if not elsewhere declared]

// GLOBALS [if not elsewhere declared]

// FUNCTIONS [including specific function implementations]
function navLinkOff(theLink) {
	if (pageLoaded) {
		if (versionNo>=5) {
			theLink.style.color = LINK_COLOR_OFF;
			theLink.style.backgroundColor = LINK_BG_OFF;
		} else {
			theLink.style.textDecoration = 'none';
		}
	}
}

function navLinkOn(theLink) {
	if (pageLoaded) {
		if (versionNo>=5) {
			theLink.style.color = LINK_COLOR_ON;
			theLink.style.backgroundColor = LINK_BG_ON;
		} else {
			theLink.style.textDecoration = 'underline';
		}
	}
}

function logoLinkRoll(theLink) {
	if (pageLoaded) {
		theLink.style.color = ' ';
		theLink.style.backgroundColor = ' ';
	}

}

function displayMenu(menu) {

	if (pageLoaded) {
		window.clearTimeout(intervalID);	// clear any timouts
		// close the menus
		for (var i=0; i<MENU_NAMES.length; i++) {
			if (MENU_NAMES[i] == menu) {
				var menuID = i;
			} else {
				closeMenu(MENU_NAMES[i]);
			}
		}
		currentMenu = menu;
		show(menu);
		animateMenu(menu, menuID, layerHeight[menuID], DIR_OPEN);
	}
}

function closeMenu(menu) {
	if (pageLoaded) {
		// clear the interval ID
		window.clearTimeout(intervalID);
		// get the ID of menu
		for (var i=0; i<MENU_NAMES.length; i++) {
			if (MENU_NAMES[i] == menu) {
				var menuID = i;
				break;
			}
		}
		window.clearTimeout(animIntervals[menuID]);
		animateMenu(menu, menuID, 1, DIR_CLOSE);
	}
}

function navMouseOut() {
	if (pageLoaded) intervalID = window.setTimeout("closeMenu(\'" + currentMenu + "\');", MENU_TTL);
}

// SPECIFIC FUNCTIONS JUST FOR THIS.

function animateMenu(objName, objID, destHeight, dir) {
// this function animates the object's height. ObjName should be a string

	var theObj = getObject(objName);
	var curHeight = theObj.pixelHeight
	curHeight += dir;
	
	if ( ((destHeight <= curHeight) && (dir > 0)) || ((destHeight>=curHeight) && (dir<0) ) ) {
		// you have reached the goal.
		window.clearTimeout(animIntervals[objID]);
		theObj.pixelHeight = destHeight;
		
		// if you are closing then hide the menu
		if (dir == DIR_CLOSE) {
			hide(objName);
		}
		return(true);
	} else  {
		// change the height and call this recursively.
		theObj.pixelHeight = curHeight;
		var functionCall = 'animateMenu(\'' + objName + '\',' + objID + ',' + destHeight;
		functionCall += ',' + dir + ');';
		animIntervals[objID] = window.setTimeout(functionCall, FRAME_RATE);
	}

}


