var menus    	= new Array();
var menuTimeout = null;
var hideWhich   = null;

var menuItem				= new Array();
menuItem["edtools"]			= {section:"edtools",id:"edtools",link:"#"};
menuItem["athletetools"] 	= {section:"athletetools",id:"athletetools",link:"#"};
menuItem["community"] 		= {section:"community",id:"community",link:"#"};
menuItem["shopping"] 		= {section:"shopping",id:"shopping",link:"#"};
menuItem["activesingles"] 	= {section:"activesingles",id:"activesingles",link:"/activesingles/"};
menuItem["advantage"] 		= {section:"advantage",id:"advantage",link:"#"};

function hideAllSubsections() {
	for( var i in menuItem ) {
		hideSubsection("subsection_" + menuItem[i].id);
	}
}

function showSubsection(menuId) {
	getElem( "subsection_" + menuId ).style.display="block";
}

function hideSubsection(menuId) {
	if( getElem( "subsection_" + hideWhich ) ) {
		getElem( "subsection_" + hideWhich ).style.display="none";
	}
}		

function hiSectionMenu(menuId) {
	if( hideWhich ) {
		document.images[hideWhich].src = '/images/navigation/global/' + hideWhich + '.gif';
	}
	document.images[menuId].src = '/images/navigation/global/' + menuId + '_over.gif';
	clearTimeout(menuTimeout);
	hideAllSubsections();
	showSubsection( menuId );
	return true;
}

function loSectionMenu(menuId) {
	//document.images[menuId].src = '/images/navigation/global/' + menuId + '.gif';
	hideWhich = menuId;
	//menuTimeout=setTimeout('hideSubsection()',4000)
	return true;
}

function hideAllMenus() {
	//document.images[hideWhich].src = '/images/navigation/global/' + hideWhich + '.gif';
	for( var i in menuItem ) {
		if (document.images[i]) {
			document.images[i].src = '/images/navigation/global/' + menuItem[i].id + '.gif';
		}
	}
	hideAllSubsections();
}

/**/function hiSubsection(menuId) {
	clearTimeout(menuTimeout);
}

function getElem( idString ) {
	var obj = null;
	if ( document.getElementById ) {
		obj = document.getElementById( idString );
	} else if ( document.layers
				&& document.layers[idString] ) {
		obj = document.layers[idString]
	} else if ( document.all
				&& document.all[idString] ) {
		obj = document.all[idString]
	}
	return obj;
}

var preloadFlag = false;
function preloadImages()
{
	if (document.images)
	{
		preloadImgArray = new Array();
		for( var i in menuItem ) {
			preloadImgArray[menuItem[i].id]		= new Image();
			preloadImgArray[menuItem[i].id].src	= "/images/navigation/global/" + menuItem[i].id + "_over.gif";
		}
		preloadFlag = true;
	}
}
preloadImages();
