function navOver(imgName)
{
	var curSrc = document.images[imgName].src;
	if(curSrc.indexOf("_off.gif") != -1)
	{
		document.images[imgName].src = curSrc.replace("_off.gif","_on.gif");
	}
	else
	{
		document.images[imgName].src = curSrc.replace("_on.gif","_off.gif");
	}
}

// flash tests..
var isDOM = (document.getElementById) ? true : false;
var isIE = (navigator.appName == "Microsoft Internet Explorer") ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
var isNetscape = (!isOpera && (navigator.appName.indexOf("Netscape") != -1 && navigator.userAgent.indexOf("4.") != -1)) ? true : false;
var isMac = (navigator.userAgent.indexOf("Mac") != -1) ? true : false;

var bUsedHTML = ((isDOM || isIE || isNetscape) && !isMac) ? true : false
var iLatestFlashVersion = 9;
var iMinimumFlashVersion = 6;
var iFlashVersion = -1;

// Variable must be global for VBScript to work correctly.
var thisFlashVersion;
function flash_getIEVersion() {

	var thisMaxVersion = false;
	for(var currentVersion=iMinimumFlashVersion; currentVersion<=iLatestFlashVersion; currentVersion++) {
		document.write('<SCR'+'IPT LANGUAGE="VBScript">\n');
		document.write('on error resume next\n');
		document.write('thisFlashVersion = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+currentVersion+'")))\n');
		document.write('</SCR'+'IPT>\n');

		if(thisFlashVersion) {
			thisMaxVersion = currentVersion;
		}
	}
	return thisMaxVersion;
}

function flash_setVersion() {
	if (navigator.plugins.length > 0) {
		// Plugin detect, no VBScript support
		navigator.plugins.refresh(false);
		numPlugins = navigator.plugins.length;
		for(var i=0; i<numPlugins; i++)	{
			plugDesc = navigator.plugins[i].description;
			iFlashVersion = (plugDesc.indexOf("Flash") != -1) ? parseInt(plugDesc.charAt(parseInt(plugDesc.indexOf("Flash"))+6)) : 0;
			if(iFlashVersion > 0) {
				return;
			}
		}
	} else if(!isMac && (isIE || isOpera)) {
		// No plugin detect, VBScript support
		iFlashVersion = flash_getIEVersion();
	} else {
		// No plugin detect, no VBScript support
		iFlashVersion = iLatestFlashVersion;
	}
}

/* START NAVIGATION */
var menuOffDelay = 100;
onMenus = new Array();

function showMenu(whichMenu)
{
	onMenus.push(whichMenu);
	var windowHeight = getWindowHeight();
	var windowWidth = getWindowWidth();
	navTop = 123 + (windowHeight > 1195 ? ((windowHeight - 1195) / 2) : 0 );
	navLeft = 0 + (windowWidth > 800 ? ((windowWidth - 800) / 2) : 0 );

	var dropmenuobj = document.getElementById(whichMenu);
	switch(whichMenu)
	{
		case "communityNav" :
			dropmenuobj.style.top = navTop;
			dropmenuobj.style.left = navLeft + 64;
			break;
		case "locationNav" :
			dropmenuobj.style.top = navTop;
			dropmenuobj.style.left = navLeft + 139;
			break;
	
		case "newsNav" :
			dropmenuobj.style.top = navTop;
			dropmenuobj.style.left = navLeft + 238;
			break;
	}
	dropmenuobj.style.visibility="visible"
}

function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function getWindowWidth() {
	var windowWidth = 0;
	if (typeof(window.innerWidth) == 'number') {
		windowWidth = window.innerWidth;
	}
	else {
		if (document.documentElement && document.documentElement.clientWidth) {
			windowWidth = document.documentElement.clientWidth;
		}
		else {
			if (document.body && document.body.clientWidth) {
				windowWidth = document.body.clientWidth;
			}
		}
	}
	return windowWidth;
}



function hideMenu(whichMenu)
{
	for(i=0;i<onMenus.length;i++)
	{
		if(onMenus[i] == whichMenu)
		{
			onMenus[i] = null;
			break;
		}
	}
	setTimeout("removeMenuNow('" + whichMenu + "');",menuOffDelay);
}

function removeMenuNow(whichMenu)
{
	var shouldBeVisible = false;
	for(i=0;i<onMenus.length;i++)
	{
		if(onMenus[i] == whichMenu)
		{
			shouldBeVisible = true;
			break;
		}
	}
	if(!shouldBeVisible)
	{
		var dropmenuobj = document.getElementById(whichMenu)
		dropmenuobj.style.visibility="hidden"
	}
}

/* END NAVIGATION */
