// **********************
// David Hong - Team X
// Copyrighted 2003

// - Javascript page for GE Totten & Assocaites, LLC
// web site
// ************************


/************* DROP DOWN MENU **************/
var arrMenuImageName = new Array();
var arrMenuImage = new Array("fastener", "fluidtherm", "breox", "ht_mod", "equist_silver", "bubble_eliminator", "grindosonic", "ivf", "probes");

var timeOut;	// holder for the setTimeOut
//var arrMenuName = new Array("coOverview", "research", "consulting", "products", "forums", "testEquip");
var arrMenuName = new Array("research", "consulting", "products", "testEquip");

var newWin;	// Popup window object

preloadImages();

// show menuObj
// menuObj is the name of the menu to open
function mouseOver(menuObj){
	clearTimer();
	hideAllMenus();
	
	// show the menu
	if(document.getElementById){
		document.getElementById(menuObj + "Menu").style.visibility = "visible";
		document.getElementById(menuObj + "MenuItem").style.backgroundColor = "#ffcc33";
	}
}

function mouseOverMenu(menuObj){
	clearTimer();
	if(document.getElementById){
		/*document.getElementById(menuObj + "MenuItem").style.backgroundColor = "#33ff00";*/
	}
}

// Hide the menu after 1000th of a second after the mouse leave the menu
function mouseOut()
{
	if(document.getElementById)
	{
		timeOut = setTimeout("hideAllMenus();", 1000);
	}

}

// hide all of the menus
function hideAllMenus(){
	if(document.getElementById){
		for (x = 0; x < arrMenuName.length; x++){
			/*alert(arrMenuName[x] + "Menu");*/
			document.getElementById(arrMenuName[x] + "Menu").style.visibility = "hidden";
			document.getElementById(arrMenuName[x] + "MenuItem").style.backgroundColor = "#eeeeee";	
		}
	}
}

// Clear the timer
function clearTimer()
{
	if(timeOut)
	{
		clearTimeout(timeOut);
	}
}


/***************** IMAGE ROLLOVER *************/

// Preload Images
function preloadImages(){
	var imagePath = "images/home_";
	for(x = 0; x < arrMenuImage.length * 2; x = x + 2)
	{
		arrMenuImageName[x] = new Image();
		arrMenuImageName[x+1] = new Image();
		arrMenuImageName[x].src = imagePath + arrMenuImage[x/2] + ".jpg";
		arrMenuImageName[x+1].src = imagePath + arrMenuImage[x/2] + "_gray.jpg";
//		document.write(arrMenuImageName[x].src + " " + arrMenuImageName[x + 1].src + "<br />");
	}
}

// objName is the image object to swap
// imgName is name of the image to swap into objName
function swapImage(objName, imgName){
	if(document.getElementById){
		document.getElementById(objName).src = "images/home_" + imgName + ".jpg";
	}
}

/***************** END OF IMAGE ROLLOVER *************/

/***************** OTHERS ****************/
// Print the copy right year
function printCopyRight() {
	currentDate = new Date();
	
	//document.write("<br />");
	if(currentDate.getFullYear() > 2003)
	{
		document.write(" - " + currentDate.getFullYear() + "<br />");
	}
}

// Print the current page"s URL
function printURL() {
	document.write("This page\'s URL: " + window.location.href);
}

function openWindow(theURL,winName,features) {
	// Close an already opened window
	if(newWin != null) {
		newWin.close();
	}
	newWin = window.open(theURL,winName,features);
}