var menuArray = new Array("comp_nav","assets_nav","investor_nav","sustain_nav");
var overArray  = new Array("goldTab","platTab","diamTab","expTab");
var imgArray = new Array("gold_arrow","plat_arrow","diam_arrow","explo_arrow");

var timeStart = new Boolean(false);
var timeOutID;
var timeConstant = 2000;

function hideNavs()
{
	for (i=0;i<menuArray.length;i++)
	{
		document.getElementById(menuArray[i]).style.display = "none";
	}
}

function navLink(URL)
{
	window.location.href= URL;
}

/***** showNav new navigation script *****/
function showNav(id,classID)
{
	if (timeStart == true)
	{
		clearInterval(timeOutID);
		timeStart = false;
	}
	document.getElementById(id).style.display = "block";
//	document.getElementById(id).className = classID;
//	document.getElementById(id).style.cursor = "pointer";
	
	timeOutID = setInterval('clearMenu()',timeConstant);
	timeStart = true;
}

function hideDiv(id,classID)
{
	stopTimer();
	document.getElementById(id).style.display = "none";
//	document.getElementById(id).className = classID;
}

function clearMenu()
{
	clearInterval(timeOutID);
	timeStart = false;
}

function stopTimer()
{
	clearInterval(timeOutID);
	timeStart = false;
}

function startTimer()
{
	if (timeStart == true)
	{
		clearInterval(timeOutID);
		timeStart = false;
	}	
	timeOutID = setInterval('clearMenu()',timeConstant);
	timeStart = true;
}
/****** end new navigation *****/

function showDiv(id)
{
	myDiv = document.getElementById(id);
	
	if (myDiv.style.display == "block")
	{
		myDiv.style.display = "none";
	}
	else
	{
		hideNavs();
		myDiv.style.display = "block";
	}
}

function showClass(id,classID)
{
	document.getElementById(id).className = classID;
	document.getElementById(id).style.cursor = "pointer";
}
function showClassGrey(id,classID,img,imgName)
{
	for (i=0;i<overArray.length;i++)
	{
		if (document.getElementById(overArray[i]))
		{
			document.getElementById(overArray[i]).className = "topBlue";
		//	document.getElementById(overArray[i]).src = "images/redarrow.gif";
		}
	}
	for (i=0;i<imgArray.length;i++)
	{
		if (document.getElementById(imgArray[i]))
		{
		//	document.getElementById(overArray[i]).className = "topBlue";
			document.getElementById(imgArray[i]).src = "images/redarrow.gif";
		}
	}
	
	document.getElementById(id).className = classID;
	document.getElementById(id).style.cursor = "pointer";
	document.getElementById(img).src = "images/" + imgName + ".gif";
}

function showContent(secondBlockName) {

   // -------------------------------------------------------------------------------
   // This function is called to display or hide the relevant Block of content
   // -------------------------------------------------------------------------------

   var secondBlockObject = null;
   if (document.getElementById(secondBlockName)) {
      // Define object for second Block navigation block
      secondBlockObject = document.getElementById(secondBlockName);
   }
   if (lastDisplayedObject != null && secondBlockObject != lastDisplayedObject) {
      // Make previously Displayed block collapse if still visible
      lastDisplayedObject.style.display = "none";
   }
   if (secondBlockObject != null && secondBlockObject != lastDisplayedObject) {
      // Determine whether to expand or collapse second Block block
      if (secondBlockObject.style.display == "none") {
         secondBlockObject.style.display = "block";
      }
      lastDisplayedObject = secondBlockObject;
   }
}

function mailpage()
{
  mail_str = "mailto:?subject= " + document.title;
  mail_str += "&body= I recommend you read this -- " + document.title;
  mail_str += ". You should check this out at, " + location.href; 
  location.href = mail_str;
}

function goThere()
{
	window.location.hash = document.myform.select1.value;
}
function imgOpen(url)
{
	window.open(url,'','scrollbars=yes,resizable=yes,toolbars=no,menu=no,outerWidth=800,outerHeight=600');
}