/*
# This script was written by Robb Garrioch
#
#          Copyright © 2001-2006
#
# All rights reserved. Property of Data Menus.
# Contact robb@datamenus.com for information.
*/
function dostuff()
{
    checkBrowser()
}
function checkBrowser()
{    
    var b = navigator.appName
    if (b == "Netscape")
        this.b = "ns"
    else if (b == "Microsoft Internet Explorer")
        this.b = "ie"
    else
        this.b = b
    this.v = parseInt(navigator.appVersion)
    this.ns =  (this.b == "ns" && this.v >= 4)
    this.ns3 = (this.b == "ns" && this.v < 4)    
    this.ns4 = (this.b == "ns" && this.v == 4)
    this.ns5 = (this.b == "ns" && this.v == 5)
    this.ie =  (this.b == "ie" && this.v >= 4)
    this.ie3 = (this.b == "ie" && this.v < 4)   // might not be relavent
    this.ie4 = (navigator.userAgent.indexOf('MSIE 4') > 0)
    this.ie5 = (navigator.userAgent.indexOf('MSIE 5') > 0)    
    this.ie6 = (navigator.userAgent.indexOf('MSIE 6') > 0)    
    if(this.ie5 || this.ie6 || this.ns5)
        this.dom = (this.ie5 || this.ie6 || this.ns5)
    this.min = (this.ns || this.ie) // do we have the minimum browser specs
}
is = new checkBrowser();            // Browser object instance required for CSS layer fixes
function gohref(url)
{
    window.location = url
}
function setbgcolor(id, color)
{
    if(is.ns4)
    {
        document.layers[id].document.bgColor = color
    }
    else if(is.ie4)
    {
        document.all[id].style.backgroundColor = color
    }
    else if(is.dom)
    {
        str = "document.getElementById('" + id + "').style.backgroundColor = '" + color + "'"
        eval(str)
    }
}
function menu(arrname, opt)
{
    if(opt == 'in')
    {
        if(isstateone(arrname))		// if state is one then roll menu in
        {
            rollmenu(arrname, 'in')
            clearstate(arrname)
        }
    }
    else if(opt == 'out')
    {
        rollmenu(arrname, 'out')
        setstate(arrname)
    }
    else if(opt == 'dual')
    {
        if(isstateone(arrname))	// if state is one then roll menu in
        {
            rollmenu(arrname, 'in')
            clearstate(arrname)
        }
        else			// is state is zero then roll menu out
        {
            rollmenu(arrname, 'out')
            setstate(arrname)
        }
    }
}
function isstateone(arrname)
{
    var str2 = "tempstate = " + arrname + "state"
    eval(str2)
    if(tempstate == 1)
        return true
    else
        return false    
}
function setstate(arrname)
{
    var str
    str = arrname + "state = 1"
    eval(str)
}
function clearstate(arrname)
{
    var str
    str = arrname + "state = 0"
    eval(str)
}
// opt can be 'out', 'in'
function rollmenu(arrname, opt)
{
    var str
    var temparr = new Array()
    str = "temparr = " + arrname
    eval(str)
    for(var t = 0; t < temparr.length; t++)
    {
        if(opt == "out")
        {
            showlayer(temparr[t])
        }
        if(opt == "in")
        {
            hidelayer(temparr[t])
        }
    }
}
function unrollall()
{
    //window.status = ""
    for(var b = (allarr.length - 1); b >= 0; b--)
    {
        if(isstateone(allarr[b]))
        {
            rollmenu(allarr[b], 'in')
            clearstate(allarr[b])
        }
    }
}
function unrollchildren(currarrname)
{
    for(var b = (allarr.length - 1); b >= 0; b--)
    {
        if(allarr[b] == currarrname)
            return
        if(isstateone(allarr[b]))
        {
            rollmenu(allarr[b], 'in')
            clearstate(allarr[b])
        }
    }
}
function getstyleobj(id)
{
    if(document.getElementById && document.getElementById(id))
    {
	return document.getElementById(id).style;
    }
    else if (document.all && document.all(id))
    {  
 	return document.all(id).style;
    } 
    else if (document.layers && document.layers[id])
    { 
 	return document.layers[id];
    }
    else
 	return false;
}
function showlayer(id)
{
    var idobj = getstyleobj(id);
    if(idobj)
    {
        idobj.visibility = 'visible';
        return true;
    }
    else
        return false;
}
function hidelayer(id)
{
    var idobj = getstyleobj(id);
    if(idobj)
    {
        idobj.visibility = 'hidden';
        return true;
    }
    else
        return false;
}
