//topNav.js

var pageURLArr = new Array("index.htm","about.htm","resources.htm","innovations.htm","news.htm","gallery.htm","mmtech.htm","contact.htm")
var menuSpeed=4;
var manualMenus=true;// can be set to false - more elegant but performs poorly with dial-ups

// mozilla doesn't know the widths until you set them
var mozillaWidthArr= new Array(74,132,124,55,63,141,84)

function navInit(index)
{
	if(index!=-1) 
	{
		
		for(i=1;i<menuNum+1;i++)
		{
			 ns5  || manualMenus?  menuItemArr[i].moveTo(-200,0) :  menuItemArr[i].moveTo(-menuItemArr[i].w,0);	
			
		}
		
		currentItem.moveTo(1,0,1,10);
		topAreaDetector.show();
	}
	else
	{

		var xPos=1;
		for(i=1;i<menuNum+1;i++)
		{
			menuItemArr[i].fadeIn();
			menuItemArr[i].moveTo(xPos,0);
			ns5 || manualMenus ? xPos+= mozillaWidthArr[i-1] : xPos+=menuItemArr[i].w;
		}
		currentItem.hide();
	}
	
	globalNavContainer.fadeIn();
	if (ie5 && !(ie5_5 || ie6)) 	
	{
			setTimeout("globalNavContainer.hide();",200);
			setTimeout("globalNavContainer.show();",500);
	}
		
	menuOn=true;

		
}


function navGoto(index)
{
	setTimeout("window.location.href = '"+pageURLArr[index]+"?mI="+index+"';",1);
}



function navShow()
{

	if(!menuOn || currentJustUp) return;
	setTimeout("showMenus();",1)	
	setTimeout("hideCurrent();",1)	
	topAreaDetector.hide();
}

function navHide()
{
	hideMenus();
	showCurrent();
	topAreaDetector.show();
}

function hideMenus()
{
	navDetector.hide();
	for(i=1;i<menuNum+1;i++)
	{
		menuItemArr[i].fadeOut();
		menuItemArr[i].easeTo(-menuItemArr[i].w,0,1,menuSpeed);
		
	}
}

function showMenus()
{

	var xPos=1;
	for(i=1;i<menuNum+1;i++)
	{
		menuItemArr[i].fadeIn();
		menuItemArr[i].easeTo(xPos,0,1,menuSpeed);	
		ns5 || manualMenus ? xPos+= mozillaWidthArr[i-1] : xPos+=menuItemArr[i].w;
	}
	navDetector.show();
}

var currentJustUp=false;
function showCurrent()
{
		currentItem.fadeIn();
		currentItem.easeTo(1,0,1,menuSpeed);
}

function hideCurrent()
{
		currentItem.fadeOut();
		currentItem.easeTo(-currentItem.w,0,1,menuSpeed);
}