function imgOn(imgName) 
{
	if(document[imgName])
	{
  		document[imgName].src = "gui/"+ imgName + "_over.gif";
	}
}
	
function imgOff(imgName) 
{
	if(document[imgName])
	{
		document[imgName].src = "gui/"+ imgName + ".gif"; 
	}
}

function imgOnAdmin(imgId)
{
	document.getElementById(imgId).src = "../gui/" + imgId + "_over.gif";
}


function imgOffAdmin(imgId)
{
	document.getElementById(imgId).src = "../gui/" + imgId + ".gif";
}
	  
sfHover = function() 
{
	if(document.getElementById("navbar"))
	{
		var sfEls = document.getElementById("navbar").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

function openpopup(s){
winpops=window.open(s,"","width=770,height=410,status,scrollbars=1")
}

// Cross-browser function to add a function to the onload event.
function AddOnload(myfunc)
{

	if(window.addEventListener)	// FireFox
	{
		window.addEventListener('load', myfunc, false);
	}
	else if(window.attachEvent)	// IE
	{
		window.attachEvent('onload', myfunc);
	}
	else if (window.onload)
	{
		var func = window.onload; 
		window.onload = function()
		{
			func();
			myfunc();
		}
	}
	else
	{
		window.onload = myfunc();
	}
}


// The hover function:
//  If there is a child sub-menu, show it on mouseover, hide it on mouseout!
var sfHover = function()
{
	var menu = document.getElementById("menu");
	if (!menu)
	{
		return;
	}
	var listItems = menu.getElementsByTagName("LI");
	for (var i = 0; i < listItems.length; i++)
	{
		listItems[i].onmouseover = function()
		{
			if (this.getElementsByTagName("UL").length > 0)
			{
				// Show the sub-menu
				this.getElementsByTagName("UL").item(0).style.display = "block";
			}
		}
		listItems[i].onmouseout = function()
		{
			if (this.getElementsByTagName("UL").length > 0)
			{
				// Hide the sub-menu
				this.getElementsByTagName("UL").item(0).style.display = "none";
			}
		}
	}
}

AddOnload(sfHover); // Activate the menus when the page loads...