//
// Drop Down Menu Functions
//

window.onerror=handleErr;


/*************************************************************************************
			OUTLET VARS

	trendCat :		Trendcategory value needed for the Weekly Specials querystring
	isFinalCall :	Set to 'true' to turn ON Final Call.   *This is CASE sensitive
					Set to 'false' to turn OFF Final Call. *This is CASE sensitive
*************************************************************************************/
var trendCat = 405;
var isFinalCall = true;

var numMenus = 6;

var deptImgs = new Array();
var mnOpts = new Array();

document.onmouseover = hideAllMenus;
document.onclick = hideAllMenus;

function handleErr() {
	return true;
}

function mnSetUpMenuItems() {
	var mnItem;
	var fcPath = "<tr><td nowrap><a name='mnItm' id='olFinal' href='#'>Final Call</a></td></tr>"
	
	if (isFinalCall != true)
		fcPath = "";


	if (document.all){
		mnItem = document.all.mnItm;
		for (var i = 0; i < mnItem.length; i++) {
			mnItem[i].mnNum = i;
			mnItem[i].parentElement.onmouseover = mnOver;
			mnItem[i].parentElement.onmouseout = mnOut;
			mnItem[i].parentElement.onclick = mnClick;
			mnItem[i].onclick = mnClick;
		}
	}else{
		var j = 0;
		for (var i = 0; i < document.links.length; i++) {
			if (document.links[i].name == "mnItm") {
				document.links[i].mnNum = j++;
				document.links[i].parentNode.onmouseover = mnOver;
				document.links[i].parentNode.onmouseout = mnOut;
				document.links[i].onclick = mnClick;
			}
		}
	}
}


function mnOver() {
	var o = this;
	if (o.tagName == 'A') o = o.parentNode;
	o.style.backgroundColor = '#306552';
	
}
function mnOut() {
	var o = this;
	if (o.tagName == 'A') o = o.parentNode;
	o.style.backgroundColor = '#548C79';
}


function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM
	return document.layers[objectId];
    } else {
	return false;
    }
}

function changeObjectVisibility(objectId, newVisibility) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.visibility = newVisibility;
	return true;
    } else {
	return false;
    }
}

function showMenu(menuNumber, eventObj, labelID) {
	if(navigator.appVersion.indexOf('MSIE 6') != -1 || isNS6 || navigator.appVersion.indexOf('MSIE 5.5') != -1) {
		hideAllMenus();

		eventObj.cancelBubble = true;
		var menuId = 'menu' + menuNumber;
    
		if(document.all) {
			var FmenuId = 'F' + menuId;
			getRect(menuId,FmenuId);
			changeObjectVisibility(FmenuId, 'visible');
		}
 
		if(!document.layers){
			if(changeObjectVisibility(menuId, 'visible')) {
				return true;
			} else {
				return false;
			}
		}
	}
 }

function hideAllMenus() {
    for(counter = 0; counter <= numMenus; counter++) {
	changeObjectVisibility('menu' + counter, 'hidden');
	changeObjectVisibility('Fmenu' + counter, 'hidden');
    }
}

function getRect(objDiv,objFr) {
	document.all(objFr).style.height = document.all(objDiv).offsetHeight;
	document.all(objFr).style.width = document.all(objDiv).offsetWidth;
}

//
//End Drop Down Menu Functions
//