/* $Id: menutool.js,v 1.4 2004/10/05 02:23:26 tt Exp $ */
/** begin menutool functions **/

function Rollover( base_name )
{
	this.name = base_name;
	this.image_dir = "/images";
	this.img = null;

	this.Load = doRollLoad;
	this.Over = doRollNull;
	this.Out = doRollNull;

}

function doRollNull() { ; }

function doRollLoad()
{
	this.img = new Array();
	this.img[0] = new Image();
	this.img[0].src = this.image_dir + "/" + this.name + ".gif";
	this.img[1] = new Image();
	this.img[1].src = this.image_dir + "/" + this.name + "_o.gif";
	this.Over = doRollOver;
	this.Out = doRollOut;
}

function doRollOver()
{
	if( document.images )
	{
		image = document.images[ this.name ];
		image.src = this.img[1].src;
	}
}

function doRollOut()
{
	if( document.images )
	{
		image = document.images[ this.name ];
		image.src = this.img[0].src;
	}
}

function doRollDown()
{
	if( document.images && (this.src3 != '') )
	{
		image = document.images[ this.name ];
		image.src = this.img[2].src;
	}
}

MenuRollovers = Array();
function MenuRollover( base_name, src1, src2, src3 )
{
	this.name = base_name;
	this.img = null;
	this.src1 = src1;
	this.src2 = src2;
	this.src3 = src3;

	if( this.src3 + "" == "undefined" )
	{
		this.src3 = "";
	}

	this.Load = doMenuRollLoad;
	this.Over = doRollNull;
	this.Out = doRollNull;
	this.Down = doRollNull;

	MenuRollovers[ MenuRollovers.length ] = this;
	this.loaded = false;

}

function doMenuRollLoad()
{
	this.img = new Array();
	this.img[0] = new Image();
	this.img[0].src = this.src1;
	this.img[1] = new Image();
	this.img[1].src = this.src2;
	if( this.src3 != "" )
	{
		this.img[2] = new Image();
		this.img[2].src = this.src3;
	}
	this.Over = doRollOver;
	this.Out = doRollOut;
	if( navigator.userAgent.indexOf('Mac') == -1 )
	{
		this.Down = doRollDown;
	}
}

function MenuRollover_OnLoad()
{
	for( i=0; i<MenuRollovers.length; i++ )
	{
		MenuRollovers[i].Load();
	}
	for( i=0; i<FormRollovers.length; i++ )
	{
		FormRollovers[i].Load();
	}
}

FormRollovers = Array();
function FormButton( src1, src2, src3 )
{
	this.img = null;
	this.src1 = src1;
	this.src2 = src2;
	this.src3 = src3;

	this.Load = doMenuRollLoad;
	this.Over = doRollNull;
	this.Out = doRollNull;
	this.Down = doRollNull;

	FormRollovers[ FormRollovers.length ] = this;
}

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}

function addUnLoadEvent(func) {
	var oldonunload = window.onunload;
	if (typeof window.onunload != 'function') {
		window.onunload = func;
	} else {
		window.onunload = function() {
			oldonunload();
			func();
		}
	}
}

addLoadEvent(MenuRollover_OnLoad);

/** end menutool functions **/
/** $Id: htmltools.js,v 1.1 2003/08/08 09:20:13 tt Exp $ **/
/** htmltools javascript functions **/

function toggle_checkbox(frm,el)
{
	document.forms[frm].elements[el].checked = !document.forms[frm].elements[el].checked;
	if( document.forms[frm].elements[el].onchange )
	{
		document.forms[frm].elements[el].onchange();
	}
}

/** end htmltools javascript functions **/
