//*******************************************************************
//  FileName: button_util.js
//	Utilities for handling button mouse over, out, and click actions
//	Copyright (C) Jim Graham & Greg Newman 2003
//*******************************************************************

//***************************************************************************************
//	Functions
//***************************************************************************************

function DoMouseOver(Button)
{	
	document.images[Button].src="images/"+Button+"2.gif";
}

function DoMouseOut(Button)
{	
	document.images[Button].src="images/"+Button+"1.gif";
}

function DoClick(URL)
{	
	//window.top.frames["mainFrame"].location=URL; commented out by Greg
	window.location=URL;
}

//***************************************************************************************
//	Button Functions
//
//	These functions create buttons from graphics that can change as the mouse moves over
//	them.  The name of the button is used as the name of the file with 1.gif,2.gif, or 3.gif
//	added.
//
//	The buttons can be organized into radio groups using the Button_DoSet() function
//
//	1 - normal image
//	2 - mouse over image
//	3 - tool selected image
//
//***************************************************************************************

function Button_DoSetTool(ImagePath,NewTool)
//
//	Handles clicks in radio button groups
//
{
	document.images[NewTool].src=ImagePath+NewTool+"3.gif";

	var PreviousTool=document.SelectForm.CurrentTool.value;
	
	document.images[PreviousTool].src=ImagePath+PreviousTool+"1.gif"; // PreviousName

	document.SelectForm.CurrentTool.value=NewTool; // jjg added
}

function Button_DoMouseOver(ImagePath,ButtonName)
{	
 	var CurrentPath=document.images[ButtonName].src;
	
	var Number=CurrentPath.substr(CurrentPath.length-5,1);
	
//	alert("Number="+Number);
	
	if (Number!=3) // if not down
	{
		document.images[ButtonName].src=ImagePath+ButtonName+"2.gif"; // show mouse over image
	}
}

function Button_DoMouseOut(ImagePath,ButtonName)
{	
//	alert("MouseOut="+document.images[ButtonName].src);
//	alert("MouseOut="+ImagePath);
	
	var CurrentPath=document.images[ButtonName].src;
	
	var Number=CurrentPath.substr(CurrentPath.length-5,1);
	
//	alert("Number="+Number);
	
	if (Number!=3) // if not down
	{
		document.images[ButtonName].src=ImagePath+ButtonName+"1.gif"; // show up image
	}
}
