ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false

// Show/Hide functions for non-pointer layer/objects
function show(id) {

// loop over all divs and hide or set timeout
for(i=1; i<=5; i++) {
thisDiv = "divmenu" + i;

if(thisDiv == id) { 
if (thisDiv == "divmenu1"){clearTimeout(timeoutID1)}
if (thisDiv == "divmenu2"){clearTimeout(timeoutID2)}
if (thisDiv == "divmenu3"){clearTimeout(timeoutID3)}
if (thisDiv == "divmenu4"){clearTimeout(timeoutID4)}
if (thisDiv == "divmenu5"){clearTimeout(timeoutID5)}
// show current div
if (ns4) document.layers[thisDiv].visibility = "show"
else if (ie4) document.all[thisDiv].style.visibility = "visible"
else if(!document.all && document.getElementById) document.getElementById(thisDiv).style.visibility = "visible"
}
else { 
// if div object is found on page, hide it
hide2(thisDiv);
}
}
}

// Show/Hide functions for non-pointer layer/objects
function show2(id, p_strAnchorId) {
// get top and left pos of image
objElement = document.getElementById(p_strAnchorId);
intTop = getAbsoluteTopPosition(objElement) - 230;
    intLeft = getAbsoluteLeftPosition(objElement) - 186;

if (id == "divmenu1"){clearTimeout(timeoutID1)}
if (id == "divmenu2"){clearTimeout(timeoutID2)}
if (id == "divmenu3"){clearTimeout(timeoutID3)}
if (id == "divmenu4"){clearTimeout(timeoutID4)}
if (id == "divmenu5"){clearTimeout(timeoutID5)}

if (ns4) {
document.layers[id].visibility = "show";
document.layers[id].top = intTop;
document.layers[id].left = intLeft;
}
else if (ie4) {
document.all[id].style.visibility = "visible";
document.all[id].style.top = intTop;
document.all[id].style.left = intLeft;
}
else if(!document.all && document.getElementById) {
document.getElementById(id).style.visibility = "visible";
document.getElementById(id).style.top = intTop;
document.getElementById(id).style.left = intLeft;
}
}

var timeoutID1 = 0
var timeoutID2 = 0
var timeoutID3 = 0
var timeoutID4 = 0
var timeoutID5 = 0

function hide(num) {
if (num == 1){timeoutID1 = setTimeout("hide2('divmenu1')",600)}
else if (num == 2){timeoutID2 = setTimeout("hide2('divmenu2')",600)}
else if (num == 3){timeoutID3 = setTimeout("hide2('divmenu3')",600)}
else if (num == 4){timeoutID4 = setTimeout("hide2('divmenu4')",600)}
else if (num == 5){timeoutID5 = setTimeout("hide2('divmenu5')",600)}
}

function hide2(id) {

// if div object is found on page, hide it
if (document.getElementById(id) != null) {
if (ns4) document.layers[id].visibility = "hide"
else if (ie4) document.all[id].style.visibility = "hidden"
else if(!document.all && document.getElementById) document.getElementById(id).style.visibility = "hidden"
}

if (id == "divmenu1" && document.images.nav2 != undefined)
{rollover('nav2','Nav2Off')}
if (id == "divmenu2" && document.images.nav6 != undefined)
{rollover('nav6','Nav6Off')}
if (id == "divmenu3" && document.images.nav1 != undefined)
{rollover('nav1','Nav1Off')}
if (id == "divmenu4" && document.images.nav13 != undefined)
{rollover('nav13','Nav13Off')}
if (id == "divmenu5" && document.images.nav7 != undefined)
{rollover('nav7','Nav7Off')}
}
/*******************************************************************************
 * Description: Returns the absolute top position of an HTML Element
 * Parameters:p_objElement- the element object to get the top position of
 * Returns:The absolute top position in pixcels
 *
 * History
 * verdatewhocomment
 * -----------------------------------------------------------------------------
 * 210-Jan-2003Graeme WilkinsonRemoved Debug alert boxes
 * 107-Jan-2003Graeme WilkinsonCreated
 ******************************************************************************/
function getAbsoluteTopPosition(p_objElement)
{
    if (!p_objElement && this)
    {
        p_objElement = this;
    }

    var nTopPos = p_objElement.offsetTop;
    var p_objElement = p_objElement.offsetParent;
    while (p_objElement != null)
    {
        nTopPos += p_objElement.offsetTop;
        p_objElement = p_objElement.offsetParent;
    }

    return nTopPos;
} // end of function getAbsoluteTopPosition

/*******************************************************************************
 * Description: Returns the absolute Left position of an HTML Element
 * Parameters:p_objElement- the element object to get the top position of
 * Returns:The absolute top position in pixcels
 *
 * History
 * verdatewhocomment
 * -----------------------------------------------------------------------------
 * 110-Feb-2003Graeme WilkinsonCreated
 ******************************************************************************/
function getAbsoluteLeftPosition(p_objElement)
{

    if (!p_objElement && this)
    {
        p_objElement = this;
    }

    var nTopPos = p_objElement.offsetLeft;
    var p_objElement = p_objElement.offsetParent;

    while (p_objElement != null)
    {

        nTopPos += p_objElement.offsetLeft;
        p_objElement = p_objElement.offsetParent;
    }

    return nTopPos;
} // end of function getAbsoluteLeftPosition
