/*
	I have updated following functions
	hideSB();
	showSB();
	The logic works as this.
	When a mouse pointer comes on one of the menu headers that overlap the listbox,
	the list box is hidden.
	
	I have removed any call from the html page which u had, because thats not needed.
	
	Khalid...remove all of this comment after u see what is changed..:-)
*/

/* DHTML Fly-Out Menus*/
function hideSB(menuObj){

	if(menuObj.id=="indusMenu" || menuObj.id=="legalMenu" ){
 		if (document.getElementById("sb") != null){
			document.getElementById("sb").style.visibility="hidden";
		}
	}else{
		showSB(menuObj);
	}
}
function showSB(menuObj){
	if (document.getElementById("sb") != null){
			document.getElementById("sb").style.visibility="visible";
	} 
}


if (!document.getElementById)
    document.getElementById = function() { return null; }

function initializeMenu(menuId, triggerId) {
    var menu = document.getElementById(menuId);
    var trigger = document.getElementById(triggerId);
	
		// Fix scroll at the bottom
	menu.style.left = (trigger.offsetLeft + trigger.offsetWidth - menu.offsetWidth) + "px"

    if (menu == null || trigger == null) return;

	// Fix IE mouseout Bug
	menu.style.backgroundColor = "#e5e5e5";


	menu.onmouseout = function() {
		menu.style.visibility = "hidden";
		showSB(menu); //new function call to show the listbox
	}
	
    trigger.onmouseout = function() {
		menu.style.visibility = "hidden";
		showSB(menu); //new function call to show the listbox
    }

	menu.onmouseover = function() {
		menu.style.visibility = "visible";
		hideSB(menu);	//new function call to hide the listbox	
	}
	
    trigger.onmouseover = function() {
        menu.style.left = this.offsetLeft + "px";
		hideSB(menu); //new function call to hide the listbox
		// Right-align last menu
		if (trigger.className == "last") {
			menu.style.left = (trigger.offsetLeft + trigger.offsetWidth - menu.offsetWidth) + "px"
		}

		menu.style.visibility = "visible";
    }
}


window.onload = function() {
    initializeMenu("aboutFercMenu", "aboutFercNav");
	initializeMenu("docsMenu", "docsNav");
	initializeMenu("pressMenu", "pressNav");
	//initializeMenu("congMenu", "congNav");
	initializeMenu("indusMenu", "indusNav");
	initializeMenu("legalMenu", "legalNav");
	initializeMenu("custMenu", "custNav");
	initializeMenu("congressMenu", "congressNav");
	initializeMenu("enforcementMenu", "enforcementNav");
	initializeMenu("forMenu", "forNav");
	initializeMenu("careerMenu", "careerNav");
	initializeMenu("contactMenu", "contactNav");
	initializeMenu("helpMenu", "helpNav");

}
function ShowDate() {
	// Return today's formatted date

	var now = new Date();

	var month = now.getMonth();
	switch (month) {
		case 0: month = "January"; break;
		case 1: month = "February"; break;
		case 2: month = "March"; break;
		case 3: month = "April"; break;
		case 4: month = "May"; break;
		case 5: month = "June"; break;
		case 6: month = "July"; break;
		case 7: month = "August"; break;
		case 8: month = "September"; break;
		case 9: month = "October"; break;
		case 10: month = "November"; break;
		case 11: month = "December"; break;
	}

	return (month + " " + now.getDate() + ", " + now.getFullYear());
}