function imgON(img, isadmin)
{
    if (!isadmin)
    {
	img.src = "images/" + img.id + "_on.jpg";
    }
    else
    {
	img.src = "../images/" + img.id + "_on.jpg";
    }	
}
function imgOFF(img, isadmin)
{
    if (!isadmin)
    {
	img.src = "images/" + img.id + ".jpg";
    }
    else
    {
	img.src = "../images/" + img.id + ".jpg";
    }	
}

var timerID = null;
var timerOn = false;
var timecount = 1000;
var menu1_offset = 32;
var menu2_offset = 3;
var menu3_offset = 3;
var menu4_offset = 3;
var menu5_offset = 3;

function popMenu(num)
{

    var menu = document.getElementById("menu" + num);
    var pop = document.getElementById("popup_menu" + num);
    var top = topPos(menu) + menu.offsetHeight;
    var left = leftPos(menu) + eval("menu" + num + "_offset");

    //alert(menu.offsetHeight);
    clearMenus();

    pop.style.left = left;
    pop.style.top = top;

    if (pop.style.visibility == "hidden")
    {
	pop.style.visibility = "";
    }
    else
    {
	pop.style.visibility = "hidden";
    }
}

function clearMenus()
{
    document.getElementById("popup_menu1").style.visibility = "hidden";
    document.getElementById("popup_menu2").style.visibility = "hidden";
	document.getElementById("popup_menu3").style.visibility = "hidden";
	document.getElementById("popup_menu4").style.visibility = "hidden";
	document.getElementById("popup_menu5").style.visibility = "hidden";
}

function startTime()
{
    timerID = setTimeout("clearMenus()", timecount);
    timerOn = true;
}

function stopTime()
{
    clearTimeout(timerID);
    timerID = null;
    timerOn = false;
}

function handleOver(num)
{
    clearMenus();
    popMenu(num);
    stopTime();
}

function handleOut()
{
    startTime();
}  

function topPos(el) 
{
    return doPosLoop(el, "Top");
}

function leftPos(el) 
{
    return doPosLoop(el, "Left");
}

function doPosLoop(el, val) 
{
    var temp = el;
    var x = temp["offset" + val];
    while (temp.tagName!="BODY") 
    {
	temp = temp.offsetParent;
	x += temp["offset" + val];
    }
    return x;
}

function getObject(obj)
{
    if (document.getElementById)
    {
	return document.getElementById(obj);
    }
    else if (document.layers)
    {
	return document.layers[obj];
    }
    else if (document.all)
    {
	return document.all[obj];
    }
   
}

function locationLayers(currentLayer,otherLayer1)
{
	document.getElementById(currentLayer).style.display="block";
	document.getElementById(otherLayer1).style.display="none";
}

function toggleLayer(whichLayer,otherLayer)
{
	if (document.getElementById)
{
	// this is the way the standards work
	var style1 = document.getElementById(whichLayer).style;
	style1.display = style1.display? "":"block";
	
	var style2 = document.getElementById(otherLayer).style;
	style2.display = style2.display? "":"none";
}
else if (document.all)
{
	// this is the way old msie versions work
	var style2 = document.all[whichLayer].style;
	style2.display = style2.display? "":"block";
}
else if (document.layers)
{
	// this is the way nn4 works
	var style2 = document.layers[whichLayer].style;
	style2.display = style2.display? "":"block";
}
}