/*
 *	Copyright 2000, GE Power Systems, Inc.
 *
 * Notes:
 *		- This menu system can only be utilized after the standard_lib.js file, the xmlString.js file and then the xmlParser_lib.js file have been
 *			loaded into the web page. Attempting to alter this order will result in errors. Refer to the documentation
 *			for further help.
 */

xmlElement.prototype.doomChildren = _doomChildren;
xmlElement.prototype.doomsday = _doomsday;
xmlElement.prototype.flipOpposite = _flipOpposite;
xmlElement.prototype.flipMe = _flipMe;
xmlElement.prototype.isPastRightEdge = _isPastRightEdge;
xmlElement.prototype.structObj = _structObj;


myMenu = new Object();
myMenu = readXML(theXMLIs);
myMenu.levelDepth = 0;
myMenu.varRef = "myMenu";
myMenu.ie5Fix = _ie5Fix;
myMenu.ie5FixIt = _ie5FixIt;

function _isInternalTrigger() {
    return (this.thisParent.getPropValue("useInternalTriggers") == "yes")
}

function _structObj()
{
    if (this.levelDepth != 0) this.levelDepth = this.thisParent.levelDepth + 1;
    if (this.levelDepth == 1)
    {
        this.doomsdayId = "";
        this.varRef = this.thisParent.varRef + ".subResources[" + this.getArrayPosition() + "]";
        this.divName = this.getPropValue("layerTriggerPrefix");
        this.menuPrefix = this.divName;
        this.arrowHref = (this.getPropValue("arrowHref") != null)?this.getPropValue("arrowHref"):topLevelArrow;
        this.arrowHeight = (this.getPropValue("arrowHeight") != null)?this.getPropValue("arrowHeight"):11;
        this.arrowPadding = (this.getPropValue("arrowPadding") != null)?this.getPropValue("arrowPadding"):null;
        this.arrowWidth = (this.getPropValue("arrowWidth") != null)?this.getPropValue("arrowWidth"):9;
        this.backColor = (this.getPropValue("backColor") != null)?this.getPropValue("backColor"):"#000000";
        this.bgOffColor = (this.getPropValue("bgOffColor"))?this.getPropValue("bgOffColor"):"#f5f5ea";
        this.bgOnColor = (this.getPropValue("bgOnColor") != null)?this.getPropValue("bgOnColor"):"#888871";
        this.boxBorder = (this.getPropValue("boxBorder") != null)?parseInt(this.getPropValue("boxBorder")):1;
        this.boxBorderColor = (this.getPropValue("boxBorderColor") != null)?this.getPropValue("boxBorderColor"):"#000000";
        this.drop = (this.getPropValue("drop") != null)?this.getPropValue("drop"):"down";
        this.eTOffsetX = (this.getPropValue("eTOffsetX"))?parseInt(this.getPropValue("eTOffsetX")):0;
        this.eTOffsetY = (this.getPropValue("eTOffsetY"))?parseInt(this.getPropValue("eTOffsetY")):20;
        this.fontFamily = (this.getPropValue("fontFamily") != null)?this.getPropValue("fontFamily"):"Verdana";
        this.fontColor = (this.getPropValue("fontColor") != null)?this.getPropValue("fontColor"):"#443322";
        this.fontOnColor = (this.getPropValue("fontOnColor") != null)?this.getPropValue("fontOnColor"):"#ffffff";
        this.fontSize = (this.getPropValue("fontSize") != null)?this.getPropValue("fontSize"):"12px";
        this.fontWeight = (this.getPropValue("fontWeight") != null)?this.getPropValue("fontWeight"):"normal";
        this.globalShiftX = (this.getPropValue("globalShiftX") != null)?parseInt(this.getPropValue("globalShiftX")):-4;
        this.globalShiftY = (this.getPropValue("globalShiftY") != null)?parseInt(this.getPropValue("globalShiftY")):2;
        this.hideSelect = (this.getPropValue("hideSelect") != null)?(this.getPropValue("hideSelect") == "yes")?true:false:false;
        this.intBorder = (this.getPropValue("intBorder") != null)?parseInt(this.getPropValue("intBorder")):0;
        this.ns4CssFix = (this.getPropValue("ns4CssFix") == "yes" && isNS4)?4:0;
        this.padding = (this.getPropValue("padding") != null)?this.getPropValue("padding"):null;
        this.paddingBottom = (this.padding == null)?(this.getPropValue("paddingBottom") != null)?this.getPropValue("paddingBottom"):"0px":this.padding;
        this.paddingLeft = (this.padding == null)?(this.getPropValue("paddingLeft") != null)?this.getPropValue("paddingLeft"):"4px":this.padding;
        this.paddingRight = (this.padding == null)?(this.getPropValue("paddingRight") != null)?this.getPropValue("paddingRight"):"0px":this.padding;
        this.paddingTop = (this.padding == null)?(this.getPropValue("paddingTop") != null)?this.getPropValue("paddingTop"):"0px":this.padding;
        this.orientation = (this.getPropValue("orientation") != null)?this.getPropValue("orientation"):"h";
        this.xPos = (this.getPropValue("startX") != null)?parseInt(this.getPropValue("startX")):0;
        this.yPos = (this.getPropValue("startY") != null)?parseInt(this.getPropValue("startY")):0;
        this.width = (this.getPropValue("width") != null)?parseInt(this.getPropValue("width")):150;
        this.height = (this.getPropValue("height") != null)?parseInt(this.getPropValue("height")):20;
        this.delay = (this.getPropValue("delay") != null)?parseInt(this.getPropValue("delay")):225;
        this.rootRef = this.thisParent;
        this.masterHeight = this.height;
        this.masterWidth = this.width;
        this.menuNum = this.getArrayPosition();
        this.menuSystemPoint = this;
        this.hasChildActive = false;
        this.isInternalTrigger = _isInternalTrigger;
        this.widthStack = 0;
        //change
        if (this.orientation == "v" && this.subResources.length > 0 && this.getPropValue("useInternalTriggers") == "yes")
        {
            this.backDivName = this.divName + "back";
            this.backHeight = ((this.height + this.intBorder) * (this.thisParent.subResources.length + 1)) + this.intBorder + (2 * this.boxBorder);
            this.backWidth = this.width + (2 * this.intBorder) + (2 * this.boxBorder);
            this.backXPos = this.xPos - this.intBorder - this.boxBorder;
            this.backYPos = this.yPos - this.intBorder - this.boxBorder;
        }

    }
    if (this.levelDepth == 2)
    {
        this.ns4CssFix = this.thisParent.ns4CssFix;
        this.orientation = this.thisParent.orientation;
        if (this.orientation != "v")
        {
            this.xPos = this.thisParent.xPos + this.thisParent.widthStack + this.getArrayPosition() + this.ns4CssFix;
            this.yPos = this.thisParent.yPos + this.ns4CssFix;
        }
        else
        {
            this.xPos = this.thisParent.xPos + this.ns4CssFix;
            //change
            this.yPos = this.thisParent.yPos + ((this.thisParent.height + this.thisParent.intBorder) * this.getArrayPosition());
        }
        this.isInternalTrigger = _isInternalTrigger;
        this.localWidth = (this.getPropValue("localWidth") != null)?parseInt(this.getPropValue("localWidth")):null;
    }
    if (this.levelDepth >= 2)
    {
        this.menuPrefix = this.thisParent.menuPrefix;
        this.menuSystemPoint = this.thisParent.menuSystemPoint;
        this.drop = this.thisParent.drop;
        this.isOn = false;
        this.isOver = false;
        if (this.levelDepth > 2)this.isInternalTrigger = this.thisParent.isInternalTrigger;
        this.arrowHref = (this.getPropValue("arrowHref") != null)?this.getPropValue("arrowHref"):this.thisParent.arrowHref;
        this.arrowHeight = (this.getPropValue("arrowHeight") != null)?this.getPropValue("arrowHeight"):this.thisParent.arrowHeight;
        this.arrowPadding = (this.getPropValue("arrowPadding") != null)?this.getPropValue("arrowPadding"):null;
        this.arrowWidth = (this.getPropValue("arrowWidth") != null)?this.getPropValue("arrowWidth"):this.thisParent.arrowWidth;
        this.backColor = (this.getPropValue("backColor") != null)?this.getPropValue("backColor"):this.thisParent.backColor;
        this.bgOffColor = (this.thisParent.getPropValue("bgOffColor") != null)?this.thisParent.getPropValue("bgOffColor"):this.thisParent.bgOffColor;
        this.bgOnColor = (this.thisParent.getPropValue("bgOnColor") != null)?this.thisParent.getPropValue("bgOnColor"):this.thisParent.bgOnColor;
        this.boxBorder = (this.getPropValue("boxBorder") != null)?parseInt(this.getPropValue("boxBorder")):this.thisParent.boxBorder;
        this.boxBorderColor = (this.getPropValue("boxBorderColor") != null)?this.getPropValue("boxBorderColor"):this.thisParent.boxBorderColor;
        this.eTOffsetX = this.thisParent.eTOffsetX;
        this.eTOffsetY = this.thisParent.eTOffsetY;
        this.fontFamily = this.thisParent.fontFamily;
        this.fontColor = (this.thisParent.getPropValue("fontColor") != null)?this.thisParent.getPropValue("fontColor"):this.thisParent.fontColor;
        this.fontOnColor = (this.thisParent.getPropValue("fontOnColor") != null)?this.thisParent.getPropValue("fontOnColor"):this.thisParent.fontOnColor;
        this.fontSize = (this.thisParent.getPropValue("fontSize") != null)?this.thisParent.getPropValue("fontSize"):this.thisParent.fontSize;
        this.fontWeight = (this.thisParent.getPropValue("fontWeight") != null)?this.thisParent.getPropValue("fontWeight"):this.thisParent.fontWeight;
        this.globalShiftX = (this.thisParent.getPropValue("globalShiftX") != null)?parseInt(this.thisParent.getPropValue("globalShiftX")):this.thisParent.globalShiftX;
        this.globalShiftY = (this.thisParent.getPropValue("globalShiftY") != null)?parseInt(this.thisParent.getPropValue("globalShiftY")):this.thisParent.globalShiftY;
        this.hideSelect = this.menuSystemPoint.hideSelect;
        this.intBorder = (this.getPropValue("intBorder") != null)?parseInt(this.getPropValue("intBorder")):this.thisParent.intBorder;
        this.padding = (this.thisParent.padding != null)?(this.thisParent.getPropValue("padding") != null)?this.thisParent.getPropValue("padding"):this.thisParent.padding:null;
        this.paddingTop = (this.thisParent.padding == null)?(this.thisParent.getPropValue("paddingTop") != null)?this.thisParent.getPropValue("paddingTop"):this.thisParent.paddingTop:this.thisParent.padding;
        this.paddingRight = (this.thisParent.padding == null)?(this.thisParent.getPropValue("paddingRight") != null)?this.thisParent.getPropValue("paddingRight"):this.thisParent.paddingTop:this.thisParent.padding;
        this.paddingBottom = (this.thisParent.padding == null)?(this.thisParent.getPropValue("paddingBottom") != null)?this.thisParent.getPropValue("paddingBottom"):this.thisParent.paddingBottom:this.thisParent.padding;
        this.paddingLeft = (this.thisParent.padding == null)?(this.thisParent.getPropValue("paddingLeft") != null)?this.thisParent.getPropValue("paddingLeft"):this.thisParent.paddingLeft:this.thisParent.padding;
        this.orientation = this.thisParent.orientation;
        this.divName = this.thisParent.divName + "m" + this.getArrayPosition();
        this.backDivName = this.divName + "back";
        this.delay = this.thisParent.delay;
        this.rootRef = this.thisParent.rootRef;
        this.cancelCode = "";
        this.getDivPoint = _getDivPoint;
        this.getNodesValue = _getNodesValue;
        this.highlightFromChild = _highlightFromChild;
        this.unHighlightFromChild = _unHighlightFromChild;
        this.showIt = _showIt;
        this.hideIt = _hideIt;
        this.width = (!this.localWidth)?(this.thisParent.getPropValue("width") != null)?parseInt(this.thisParent.getPropValue("width")):this.thisParent.masterWidth:this.localWidth;
        this.height = (this.thisParent.getPropValue("height") != null)?parseInt(this.thisParent.getPropValue("height")):this.thisParent.masterHeight;
        this.masterWidth = this.width;
        this.masterHeight = this.height;
        this.backWidth = (this.subResources.length > 0)? (this.getPropValue("width") != null)?parseInt(this.getPropValue("width")) + (2 * this.intBorder) + (2 * this.boxBorder):this.width + (2 * this.intBorder) + (2 * this.boxBorder):null;
        this.backHeight = (this.subResources.length > 0)? (this.getPropValue("height") != null)?(parseInt(this.getPropValue("height")) + this.intBorder) * this.subResources.length + this.intBorder + (2 * this.boxBorder):((this.height + this.intBorder) * this.subResources.length) + this.intBorder + (2 * this.boxBorder):null;

        this.dropX = (this.levelDepth >= 4)?"right":null;

        if (this.levelDepth == 2) this.thisParent.widthStack += this.width;
        this.menuNum = this.thisParent.menuNum;
        if (this.drop == null || this.drop == "down")
        {
            if (this.orientation != "v")
            {
                if (this.levelDepth == 3)
                {
                    this.xPos = this.thisParent.xPos;
                    this.yPos = this.thisParent.yPos + ((this.height + this.intBorder) * this.getArrayPosition()) + this.intBorder + this.thisParent.height;
                }
                else if (this.levelDepth >= 4)
                {
                    this.xPos = this.thisParent.xPos + this.thisParent.width + this.globalShiftX;
                    this.yPos = this.thisParent.yPos + ((this.height + this.intBorder) * this.getArrayPosition()) + this.globalShiftY;
                }

                if (this.subResources.length > 0 && this.levelDepth == 2)
                {
                    this.backXPos = this.xPos - this.intBorder - this.boxBorder;
                    this.backYPos = this.thisParent.yPos + this.thisParent.height + this.ns4CssFix - this.boxBorder;
                }
                else if (this.subResources.length > 0 && this.levelDepth >= 3)
                {
                    this.backXPos = this.xPos + this.width + this.globalShiftX - this.intBorder - this.boxBorder;
                    this.backYPos = this.yPos - this.intBorder + this.globalShiftY - this.boxBorder;
                }
            }
            else
            {
                //change
                if (this.levelDepth == 3)
                {
                    this.xPos = this.thisParent.xPos + this.thisParent.width + this.globalShiftX;
                    this.yPos = this.thisParent.yPos + ((this.height + this.intBorder) * this.getArrayPosition()) + this.intBorder + this.globalShiftY;
                }
                else if (this.levelDepth >= 4)
                {
                    this.xPos = this.thisParent.xPos + this.thisParent.width + this.globalShiftX;
                    this.yPos = this.thisParent.yPos + ((this.height + this.intBorder) * this.getArrayPosition()) + this.globalShiftY;
                }

                if (this.levelDepth == 2 && this.subResources.length > 0)
                {
                    this.backXPos = this.xPos + this.width + this.globalShiftX - this.intBorder - this.boxBorder;
                    this.backYPos = this.thisParent.yPos + ((this.thisParent.height + this.thisParent.intBorder) * this.getArrayPosition()) + this.ns4CssFix - this.boxBorder + this.globalShiftY;
                }
                else if (this.levelDepth >= 3 && this.subResources.length > 0)
                {
                    this.backXPos = this.xPos + this.width + this.globalShiftX - this.intBorder - this.boxBorder;
                    this.backYPos = this.yPos - this.intBorder + this.globalShiftY - this.boxBorder;
                }
            }
        }
        else if (this.drop == "up")
        {
            if (this.levelDepth == 3) this.xPos = this.thisParent.xPos;
            if (this.levelDepth == 3) this.yPos = this.thisParent.yPos - ((this.height + this.intBorder) * (this.getArrayPosition() ) + 1) - this.thisParent.height - this.intBorder - this.boxBorder;
            if (this.levelDepth >= 4) this.xPos = this.thisParent.xPos + this.thisParent.width + this.intBorder + this.boxBorder + this.globalShiftX;
            if (this.levelDepth >= 4) this.yPos = this.thisParent.yPos - ((this.height + this.intBorder) * this.getArrayPosition()) + this.globalShiftY;

            if (this.subResources.length > 0 && this.levelDepth == 2) this.backXPos = this.xPos - this.intBorder - this.boxBorder;
            if (this.subResources.length > 0 && this.levelDepth == 2) this.backYPos = this.thisParent.yPos - ((this.thisParent.height + this.intBorder) * this.subResources.length) - (2 * this.boxBorder) - 1 - this.intBorder;
            if (this.subResources.length > 0 && this.levelDepth >= 3) this.backXPos = this.xPos + this.width + this.globalShiftX;
            if (this.subResources.length > 0 && this.levelDepth >= 3) this.backYPos = this.yPos + this.height - this.boxBorder - ((this.thisParent.height + this.intBorder) * this.subResources.length) + this.globalShiftY;
        }

        if (!this.isInternalTrigger())
        {
            this.externalTriggerName = (this.levelDepth == 2)?this.divName + "Trigger":this.thisParent.externalTriggerName;
            this.getRealXPos = _getRealXPos;
            this.getRealYPos = _getRealYPos;
            this.oldRealXPos = this.xPos;
            this.oldRealYPos = this.yPos;
            this.checkReposition = _checkReposition;
            this.doReposition = _doReposition;
        }
    }
}
//end method _structObj()

function _highlightFromChild()
{
    if (this.levelDepth == 2 && this.isInternalTrigger())
    {
        changeBgColor(this.divName, this.bgOnColor);
        if (this.subResources.length > 0)
        {
            changeFontColor(this.divName + "CellId", this.fontOnColor);
        }
        else
        {
            changeFontColor(this.divName, this.fontOnColor);
        }
    }
    else if (this.levelDepth > 2)
    {
        changeBgColor(this.divName, this.bgOnColor);
        if (this.subResources.length > 0)
        {
            changeFontColor(this.divName + "CellId", this.fontOnColor);
        }
        else
        {
            changeFontColor(this.divName, this.fontOnColor);
        }
        this.thisParent.highlightFromChild();
    }
}

function _unHighlightFromChild()
{
    if (this.levelDepth == 2 && this.isInternalTrigger())
    {
        changeBgColor(this.divName, this.bgOffColor);
        if (this.subResources.length > 0)
        {
            changeFontColor(this.divName + "CellId", this.fontColor);
        }
        else
        {
            changeFontColor(this.divName, this.fontColor);
        }
    }
    else if (this.levelDepth > 2)
    {
        changeBgColor(this.divName, this.bgOffColor);
        if (this.subResources.length > 0)
        {
            changeFontColor(this.divName + "CellId", this.fontColor);
        }
        else
        {
            changeFontColor(this.divName, this.fontColor);
        }
        this.thisParent.unHighlightFromChild();
    }
}

function _getRealXPos()
{
    return getRealLeft(this.externalTriggerName);
}

function _getRealYPos()
{
    return getRealTop(this.externalTriggerName);
}

function _checkReposition()
{
    var tempXPos = this.getRealXPos();
    var tempYPos = this.getRealYPos();
    if (tempXPos != this.oldRealXPos || tempYPos != this.oldRealYPos)
    {
        recurseObjArray(this, "currentObject.doReposition()");
    }
}

function _doReposition()
{
    if (this.levelDepth == 2)
    {
        this.oldRealXPos = this.getRealXPos();
        this.oldRealYPos = this.getRealYPos();
        this.xPos = this.oldRealXPos;
        this.yPos = this.oldRealYPos;
        if (this.drop == null || this.drop == "down")
        {
            if (this.orientation != "v")
            {
                if (this.subResources.length > 0) this.backXPos = this.xPos - this.intBorder - this.boxBorder;
                if (this.subResources.length > 0) this.backYPos = this.yPos + this.globalShiftY + this.eTOffsetY - this.intBorder - this.boxBorder;
            }
            else
            {
                if (this.subResources.length > 0) this.backXPos = this.xPos + this.eTOffsetX - this.intBorder - this.boxBorder + this.globalShiftX;
                if (this.subResources.length > 0) this.backYPos = this.yPos + this.globalShiftY + this.eTOffsetY + this.intBorder + this.boxBorder;
            }
        }
        else if (this.drop == "up")
        {
            if (this.subResources.length > 0) this.backXPos = this.xPos - this.intBorder - this.boxBorder + this.globalShiftX;
            if (this.subResources.length > 0) this.backYPos = this.yPos - ((this.thisParent.height + this.intBorder) * this.subResources.length) - 1 - this.intBorder - this.boxBorder + this.globalShiftY;
        }
    }
    if (this.levelDepth == 3)
    {
        this.oldRealXPos = this.oldRealXPos;
        this.oldRealYPos = this.thisParent.oldRealYPos;
        if (this.drop == null || this.drop == "down")
        {
            if (this.orientation != "v")
            {
                this.xPos = this.thisParent.xPos;
                this.yPos = this.thisParent.yPos + ((this.height + this.intBorder) * (this.getArrayPosition())) + this.eTOffsetY + this.globalShiftY;
                if (this.subResources.length > 0) this.backXPos = this.xPos + this.width + this.globalShiftX - this.intBorder - this.boxBorder;
                if (this.subResources.length > 0) this.backYPos = this.yPos - this.intBorder - this.boxBorder + this.globalShiftY;
            }
            else
            {
                this.xPos = this.thisParent.xPos + this.eTOffsetX + this.globalShiftX;
                this.yPos = this.thisParent.yPos + ((this.height + this.intBorder) * (this.getArrayPosition()) + 1) + this.boxBorder + this.eTOffsetY + this.globalShiftY;
                if (this.subResources.length > 0) this.backXPos = this.xPos + this.width + this.globalShiftX - this.intBorder - this.boxBorder;
                if (this.subResources.length > 0) this.backYPos = this.yPos - this.intBorder - this.boxBorder + this.globalShiftY;
            }
        }
        else if (this.drop == "up")
        {
            this.xPos = this.thisParent.xPos + this.globalShiftX + this.eTOffsetX;
            this.yPos = this.thisParent.yPos - ((this.height + this.intBorder) * (this.getArrayPosition() ) + 1) - this.intBorder - this.eTOffsetY + this.globalShiftY;
            if (this.subResources.length > 0) this.backXPos = this.xPos + this.width + this.globalShiftX;
            if (this.subResources.length > 0) this.backYPos = this.yPos + this.height - ((this.thisParent.height + this.intBorder) * this.subResources.length) + this.globalShiftY - this.boxBorder;
        }
    }
    if (this.levelDepth >= 4)
    {
        this.oldRealXPos = this.oldRealXPos;
        this.oldRealYPos = this.thisParent.oldRealYPos;
        if (this.drop == null || this.drop == "down")
        {
            this.xPos = this.thisParent.xPos + this.thisParent.width + this.globalShiftX;
            this.yPos = this.thisParent.yPos + ((this.height + this.intBorder) * this.getArrayPosition()) + this.globalShiftY;
            if (this.subResources.length > 0) this.backXPos = this.xPos + this.width + this.intBorder + this.boxBorder + this.globalShiftX;
            if (this.subResources.length > 0) this.backYPos = this.yPos - this.intBorder - this.boxBorder + this.globalShiftY;
        }
        else if (this.drop == "up")
        {
            this.xPos = this.thisParent.xPos + this.thisParent.width + this.intBorder + this.boxBorder + this.globalShiftX;
            this.yPos = this.thisParent.yPos - ((this.height + this.intBorder) * this.getArrayPosition()) + this.globalShiftY;
            if (this.subResources.length > 0) this.backXPos = this.xPos + this.width + this.globalShiftX;
            if (this.subResources.length > 0) this.backYPos = this.yPos + this.height - ((this.thisParent.height + this.intBorder) * this.subResources.length) - this.boxBorder + this.globalShiftY;
        }
    }
    moveLayerAbs(this.divName, this.xPos, this.yPos);
    if (this.subResources.length > 0) moveLayerAbs(this.backDivName, this.backXPos, this.backYPos);
}

function _getDivPoint() //needs to be run after divs are written--sets pointers to the div's in the DOM
{
    if (isNS4) return document.layers[this.divName];
    if (isIE4) return document.all[this.divName];
    if (isIE5 || isIE6 || isIE7 || isNS5) return document.getElementById(this.divName);
}
//end method _getDivPoint()

function _getNodesValue()
{
    var imgAlign = (isNS4)?"bottom":"absmiddle";
    var arrowHTML = "<img src=\"" + this.arrowHref + "\" align=\"" + imgAlign + "\"alt=\"\" width=\"" + this.arrowWidth + "\" height=\"" + this.arrowHeight + "\" border=\"0\">";
    var tableStartHTML;
    var tableMiddleHTML;
    var tableEndHTML;
    if (this.arrowPadding == null)
    {
        tableStartHTML = '<table border="0" cellpadding="0" cellspacing="0" width="' + this.width + '"><tr><td id="' + this.divName + 'CellId" width="' + (this.width - parseInt(this.paddingLeft) - parseInt(this.paddingRight) - this.arrowWidth - this.boxBorder - this.intBorder) + '">';
        tableMiddleHTML = '</td><td width="' + (this.arrowWidth + parseInt(this.paddingLeft) + this.boxBorder + this.intBorder - this.globalShiftX) + '">';
        tableEndHTML = '</td></tr></table>';
    }
    else
    {
        tableStartHTML = '<table border="0" cellpadding="0" cellspacing="0" width="' + this.width + '"><tr><td id="' + this.divName + 'CellId" width="100%">';
        if ((serverPath != null) && (globalPath != null)) {
            tableMiddleHTML = '<img src="' + serverPath + globalPath + 'img/spacer.gif" width="' + parseInt(this.arrowPadding) + '" height="1" alt="" />';
        }
        else
        {
            tableMiddleHTML = '<img src="img/spacer.gif" width="' + parseInt(this.arrowPadding) + '" height="1" alt="" />';
        }
        tableEndHTML = '</td></tr></table>';
    }
    if ((serverPath != null) && (globalPath != null)) {
        var ns4ImgPadding = (isNS4)?'<img src="' + serverPath + globalPath + 'img/spacer.gif" width="' + (this.boxBorder + this.intBorder - this.globalShiftX) + '" height="1" border="0" />':'';
    }
    else
    {
        var ns4ImgPadding = (isNS4)?'<img src="img/spacer.gif" width="' + (this.boxBorder + this.intBorder - this.globalShiftX) + '" height="1" border="0" />':'';
    }
    return (this.subResources.length)?tableStartHTML + this.nodeValues.join("") + tableMiddleHTML + arrowHTML + tableEndHTML:this.nodeValues.join("");
}

function initObjTree()
{
    recurseObjArray(myMenu, "currentObject.structObj()");
}

function _isPastRightEdge()
{
    var pageEdge = (isNS4 || isNS5)?window.innerWidth:document.body.clientWidth;
    return ((this.xPos + this.width) > pageEdge && this.levelDepth > 3)
}
//end constructor _isPastRightEdge()

function _flipOpposite()
{
    if (this.levelDepth > 3)
    {
        this.dropX = (this.dropX == "right")?"left":"right";
        recurseObjArray(this, "currentObject.flipMe()");
    }
}

function _flipMe()
{
    var biggerWidth = (this.dropX == "right")?this.thisParent.width:this.width;
    this.xPos = this.thisParent.xPos + (biggerWidth + this.globalShiftX) * ((this.dropX == "left")?-1:1);
    if (this.thisParent.backXPos != this.thisParent.subResources[0].xPos - this.thisParent.intBorder - this.thisParent.boxBorder) this.thisParent.backXPos = this.thisParent.subResources[0].xPos - this.thisParent.intBorder - this.thisParent.boxBorder;
    (isNS4 && !isIE7)?this.getDivPoint().left = this.xPos:this.getDivPoint().style.left = this.xPos;
    moveLayerAbs(this.thisParent.backDivName, this.thisParent.backXPos, this.thisParent.backYPos);
}

function _showIt()
{//contains all logic for showing layers based on "this" object
    if (this.menuSystemPoint.doomsdayId != "") clearTimeout(this.menuSystemPoint.doomsdayId);
    if (this.thisParent.cancelCode) window.clearTimeout(this.thisParent.cancelCode);
    if (!this.isInternalTrigger() && this.levelDepth == 2) this.checkReposition();
    if (this.subResources.length > 0)
    {
        if (this.subResources[0].isPastRightEdge())
        {
            for (flipLoop = 0; flipLoop < this.subResources.length; flipLoop++)
            {
                this.subResources[flipLoop].flipOpposite();
            }
        }
        else if (this.subResources[0].dropX == "left")
        {
            var scrWidth = (isNS4 || isNS5)?window.innerWidth:document.body.clientWidth;
            if (scrWidth - this.xPos > this.width + this.subResources[0].width - this.globalShiftX)
            {
                for (flipLoop = 0; flipLoop < this.subResources.length; flipLoop++)
                {
                    this.subResources[flipLoop].flipOpposite();
                }
            }
        }
    }
    if (this.subResources.length != 0)
    {
        for (g = 0; g < this.subResources.length; g++)
        {
            if (this.subResources[g].subResources.length != 0)
            {
                this.subResources[g].doomsday();
            }
        }
    }
    var exitedSibling = false;
    for (m = 0; m < this.thisParent.subResources.length; m++)
    {
        if (this.thisParent.subResources[m].cancelCode != "")
        {//if a sibling has a timeout cued
            if (this.thisParent.subResources[m].subResources.length > 0) changeVisible(this.thisParent.subResources[m].backDivName, false);
            clearTimeout(this.thisParent.subResources[m].cancelCode);
            for (p = 0; p < this.thisParent.subResources.length; p++)
            {
                if (this != this.thisParent.subResources[p])
                {
                    for (q = 0; q < this.thisParent.subResources[p].subResources.length; q++)
                    {
                        this.thisParent.subResources[p].subResources[q].doomsday();
                    }
                }
            }
        }
    }
    changeBgColor(this.divName, this.bgOnColor);
    if (this.subResources.length > 0)
    {
        changeFontColor(this.divName + "CellId", this.fontOnColor);
    }
    else
    {
        changeFontColor(this.divName, this.fontOnColor);
    }
    if (this.subResources.length > 0)
    {
        changeVisible(this.backDivName, true);
        for (h = 0; h < this.subResources.length; h++)
        {
            changeVisible(this.subResources[h].divName, true);
        }
    }
    this.isOn = true;
    if (this.hideSelect && myMenu.selectsAreVisible && (isIE4 || isIE5 || isIE6 || isIE7))
    {
        myMenu.hideSelects();
    }
}

function _hideIt()
{//contains all logic for hiding necessary layers based on "this" object
    changeBgColor(this.divName, this.bgOffColor);
    if (this.subResources.length > 0)
    {
        changeFontColor(this.divName + "CellId", this.fontColor);
    }
    else
    {
        changeFontColor(this.divName, this.fontColor);
    }
    this.cancelCode = window.setTimeout("hideChildren(\"" + this.divName + "\")", this.delay);
    this.menuSystemPoint.doomsdayId = window.setTimeout(this.menuSystemPoint.varRef + ".doomsday()", this.delay);
    this.isOn = false;
}

function hideChildren(divName1)
{
    var tempObj = getObjectsByObjValue(myMenu, "divName", divName1);
    if (tempObj[0].subResources.length > 0)
    {
        for (g = 0; g < tempObj[0].subResources.length; g++)
        {
            changeVisible(tempObj[0].subResources[g].divName, false);
        }
    }
    tempObj[0].cancelCode = "";
}

function _doomsday()
{
    recurseObjArray(this, "currentObject.doomChildren();");
    if (this.hideSelect && (isIE4 || isIE5 || isIE6 || isIE7))myMenu.showSelects();
}

function _doomChildren()
{
    if (currentObject.levelDepth > 2) changeVisible(currentObject.divName, false);
    if (currentObject.subResources.length > 0 && currentObject.levelDepth > 1) changeVisible(currentObject.backDivName, false);
}

function processCSS(passedMenu)
{
    document.write("<style>");
    recurseObjArray(passedMenu, "writeCSSFromObj(currentObject)");
    document.write("</style>");
}
//end function processCSS()

function writeCSSFromObj(currentObject1)
{
    var mouseCursor = (isNS5)?"default":"hand";
    if (currentObject1.levelDepth == 1 && isNS4)
    {
        document.write("a.ns4Fix" + currentObject.getArrayPosition() + ":link {color:" + currentObject1.fontColor + ";text-decoration:none;}\n" +
                       "a.ns4Fix" + currentObject.getArrayPosition() + ":active {color:" + currentObject1.fontColor + ";}\n" +
                       "a.ns4Fix" + currentObject.getArrayPosition() + ":visited {color:" + currentObject1.fontColor + ";}\n");
    }
    if (currentObject1.levelDepth == 2 && !currentObject1.isInternalTrigger())
    {
        document.write("\n#" + currentObject1.divName + "Trigger {position:relative;left:0;top:0;}\n");
    }
    if (currentObject1.levelDepth >= 2)
    {
        document.write("\n#" + currentObject1.divName + " {position:absolute;padding-Top:" + currentObject1.paddingTop + ";padding-Right:" + currentObject1.paddingRight +
                       ";padding-Bottom:" + currentObject1.paddingBottom + ";padding-Left:" + currentObject1.paddingLeft + ";font-weight:" + currentObject1.fontWeight +
                       ";text-align:left;cursor:" + mouseCursor + ";visibility:hidden;font-family:\"" + currentObject1.fontFamily + "\";font-size:" + currentObject1.fontSize +
                       ";color:" + currentObject1.fontColor + ";}");
        if (currentObject1.subResources.length > 0)
        {
            var stringThing = "\n#" + currentObject1.divName + "CellId {font-weight:" + currentObject1.fontWeight +
                              ";text-align:left;cursor:" + mouseCursor + ";font-family:\"" + currentObject1.fontFamily + "\";font-size:" + currentObject1.fontSize +
                              ";color:" + currentObject1.fontColor + ";}";
            document.write(stringThing);
        }
    }
    if (currentObject1.subResources.length > 0 && currentObject1.levelDepth != 0)
    {
        document.write("\n#" + currentObject1.backDivName + " {position:absolute;text-align:left;cursor:default;visibility:hidden;border:" + currentObject1.boxBorder + "px solid " + currentObject1.boxBorderColor + ";}");
    }
}
//end function writeDivFromObj()

function initAllMenuLayers()
{
    recurseObjArray(myMenu, "initMenuLayer(currentObject)");
    if (isIE4 || isIE5 || isIE6 || isIE7)
    {
        var menuHidesSelect = false;
        for (var x = 0; x < myMenu.subResources.length; x++)
        {
            if (myMenu.subResources[x].hideSelect && menuHidesSelect != true)
            {
                myMenu.selectArray = document.getElementsByTagName("select");
                myMenu.visStateArray = new Array();
                for (var m = 0; m < myMenu.selectArray.length; m++)
                {
                    var noCSSHide = (isIE5 || isIE6 || isIE7)?determineCSSVisibility(myMenu.selectArray[m]):true;
                    var noCSSDisplayNone = (isIE5 || isIE6)?determineCSSDisplay(myMenu.selectArray[m]):true;
                    var noMenuHide = (isIE5 || isIE6)?(myMenu.selectArray[m].getAttribute('noMenuHide') == "true"):false;
                    myMenu.visStateArray[m] = ((myMenu.selectArray[m].style.visibility != "hidden") && noCSSHide && noCSSDisplayNone && !noMenuHide)?true:false;
                }
                myMenu.hideSelects = _hideSelects;
                myMenu.showSelects = _showSelects;
                myMenu.selectsAreVisible = true;
                menuHidesSelect = true;
            }
        }
        myMenu.ie5Fix();
    }
}
//end function initAllLayers()

function determineCSSDisplay(pElement)
{
    if (isIE5 || isIE6)
    {
        if (pElement.tagName == "HTML") return true;
        if (pElement.currentStyle.display == "none") return false;
        if (pElement.currentStyle.display == "block" || pElement.currentStyle.display == "inline") return determineCSSDisplay(pElement.parentNode);
    }
}

function determineCSSVisibility(pElement)
{
    if (isIE5 || isIE6)
    {
        if (pElement.tagName == "HTML") return true;
        if (pElement.currentStyle.visibility == "hidden") return false;
        else if (pElement.currentStyle.visibility == "inherit" || pElement.currentStyle.visibility == "visible") return determineCSSVisibility(pElement.parentNode);
        alert("error: determineCSSVisibility failed to obtain a pertinent value");
    }
    alert("error: determineCSSVisibility failing to return value");
}

function _hideSelects()
{
    for (var i = 0; i < this.selectArray.length; i++)
    {
        if (this.visStateArray[i] == true) this.selectArray[i].style.visibility = "hidden";
    }
    this.selectsAreVisible = false;
}

function _showSelects()
{
    for (var i = 0; i < this.selectArray.length; i++)
    {
        if (this.visStateArray[i] == true) this.selectArray[i].style.visibility = "visible";
    }
    this.selectsAreVisible = true;
}

function initMenuLayer(currentObject1)
{
    //change
    if (currentObject1.orientation == "v" && currentObject1.levelDepth == 1 && currentObject1.subResources.length > 0 && currentObject1.getPropValue("useInternalTriggers") == "yes")
    {
        initLayer(currentObject1.backDivName, currentObject1.backColor, currentObject1.levelDepth * 100 + 1, currentObject1.backYPos, currentObject1.backXPos, currentObject1.backWidth, currentObject1.backHeight, 0, currentObject1.backWidth, currentObject1.backHeight, 0, "visible");
    }
    if (currentObject1.levelDepth >= 2)
    {//initLayer(layerId, thisBgColor, thisZIndex, topPos, leftPos, thisWidth, thisHeight, clipTop, clipRight, clipBottom, clipLeft, thisVis)
        var tempVis = (currentObject1.levelDepth == 2)?(currentObject1.isInternalTrigger())?"visible":"hidden":"hidden";
        var tempZ = (currentObject1.levelDepth == 2)?currentObject1.levelDepth * 75:currentObject1.levelDepth * 100;
        initLayer(currentObject1.divName, currentObject1.bgOffColor, tempZ, currentObject1.yPos, currentObject1.xPos, currentObject1.width, currentObject1.height, 0, currentObject1.width, currentObject1.height, 0, tempVis);
        if (currentObject1.subResources.length > 0)
        {
            initLayer(currentObject1.backDivName, currentObject1.backColor, currentObject1.levelDepth * 100 + 1, currentObject1.backYPos, currentObject1.backXPos, currentObject1.backWidth, currentObject1.backHeight, 0, currentObject1.backWidth, currentObject1.backHeight, 0, "hidden");
        }

        if (isNS4 && !isIE7) currentObject1.getDivPoint().captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP | Event.CLICK);
        currentObject1.getDivPoint().onmouseover = new Function("", "handleOver('" + currentObject1.divName + "')");
        currentObject1.getDivPoint().onmouseout = new Function("", "handleOut('" + currentObject1.divName + "')");
        var goToHref = (currentObject1.getPropValue("href"))?currentObject1.getPropValue("href"):"javascript:doNothing()";
        currentObject1.getDivPoint().onclick = new Function("", "window.location='" + goToHref + "';return true;");
    }
}

function handleOver(divName1)
{
    var objHits = getObjectsByObjValue(myMenu, "divName", divName1);
    objHits[0].isOver = true;
    objHits[0].showIt();
    if (objHits[0].levelDepth > 2) objHits[0].thisParent.highlightFromChild();
}
//end function handleOver()

function handleOut(divName1)
{
    var objHits = getObjectsByObjValue(myMenu, "divName", divName1);
    objHits[0].isOver = false;
    objHits[0].hideIt();
    if (objHits[0].levelDepth > 2) objHits[0].thisParent.unHighlightFromChild();
}
//end function handleOver()


function writeAllMenuDivs()
{
    recurseObjArray(myMenu, "writeMenuDiv(currentObject)");
}
//end function writeAllDivs()

function writeMenuDiv(currentObject1)
{
    if (currentObject1.levelDepth >= 2)
    {
        var nsFixStringFront = (isNS4)?"<a class=\"ns4Fix" + currentObject1.menuSystemPoint.getArrayPosition() + "\" href=\"" + currentObject1.getPropValue("href") + "\">":"";
        var nsFixStringEnd = (isNS4)?"</a>":"";
    }
    if ((serverPath != null) && (globalPath != null)) {
        var nsFixBackImg = (isNS4)?'<img src="' + serverPath + globalPath + 'img/spacer.gif" width="' + (currentObject1.backWidth - currentObject1.boxBorder - 11) + '" height="' + (currentObject1.backHeight - currentObject1.boxBorder - 11) + '" border="0" />':'&nbsp';
    }
    else
    {
        var nsFixBackImg = (isNS4)?'<img src="img/spacer.gif" width="' + (currentObject1.backWidth - currentObject1.boxBorder - 11) + '" height="' + (currentObject1.backHeight - currentObject1.boxBorder - 11) + '" border="0" />':'&nbsp';
    }

    if ((currentObject1.levelDepth == 2)) createLayerHTML(currentObject1.divName, nsFixStringFront + currentObject1.getNodesValue() + nsFixStringEnd);
    else if (currentObject1.levelDepth >= 3) createLayerHTML(currentObject1.divName, nsFixStringFront + currentObject1.getNodesValue() + nsFixStringEnd);
    if (currentObject1.subResources.length > 0) createLayerHTML(currentObject1.backDivName, nsFixBackImg);
}
//end method _writeMenuDiv()

var ie5FixTimeoutId;
function _ie5Fix(objRef)
{
    ie5FixTimeoutId = window.setTimeout("myMenu.ie5FixIt()", 200);
}

function _ie5FixIt()
{
    if (isIE5 && window.navigator.appVersion.indexOf("MSIE 5.0") != -1)
    {
        pFirstMenuItemDiv = this.subResources[0].subResources[0].divName;
        document.getElementById(pFirstMenuItemDiv).onmouseover();
        document.getElementById(pFirstMenuItemDiv).onmouseout();
    }
}

initObjTree();
processCSS(myMenu);
