function moan(t) {
    if (t._itemRef != _itemRef) _popi(t._itemRef)
}

function clearTimeOutFunc($) {
    clearTimeout($)
    return _n
}

_ns6B = "" 	// Global variable to fix a scrollbar bug in Mozilla 1.6 code - can be removed soon
_dBT = 0
_dBL = 0

function _DC() {
    if (!_W.contextObject && _trueItemRef == -1) _AClose()
}

function _5($) { return eval($) }

function _ns6AP(v) {
    if ((ns6 && !ns60) && _M[14] == "fixed") {
        p = gpos(v)
        spos(v, p[0] - _sT, p[1] - _sL);
    }
}
function gMY(e) {
    _ns6B = "" // Fixes a scrollbar bug in Mozilla 1.6 code - can be removed soon

    if (ns6) {
        X_ = e.pageX;
        Y_ = e.pageY;
        _ns6B = e.target.id // Set the object variable, Fixes a scrollbar bug in Mozilla 1.6 code - can be removed soon
    }
    else {
        e = event
        X_ = e.clientX;
        Y_ = e.clientY;
    }
    if (!op && _d.all && _dB) {
        X_ += _dB.scrollLeft;
        Y_ += _dB.scrollTop;
        if (IEDtD && !mac) { Y_ += _sT; X_ += _sL; }
    }

    //_d.forms[0][0].value=inDragMode + " - " + Date()

    if (inDragMode) {
        var g = gmobj(menuVar + DragLayer);
        spos(g, Y_ - DragY, X_ - DragX);

        if (ie55) {
            g = gmobj("iFM" + _m[DragLayer].ifr);
            if (g) spos(g, Y_ - DragY, X_ - DragX)
        }

        return 0
    }
    doMenuResize(focusedMenu)
    //MouseX=X_;
    //MouseY=Y_;
    mmMouseMove()
    _TtM()
    //return 0
}

if (!_W.disableMouseMove) _d.onmousemove = gMY
_dC = _DC
if (_d.onmousedown) _dC = _dC + _d.onmousedown
_d.onmousedown = _dC

_TbS = "<table class=milonictable border=0 cellpadding=0 cellspacing=0 style='line-height:normal;padding:0px' "
//_aN=999;

function spos(g, t, l, h, w)                       // Set position and dimensions of a menu, in fact any HTML Object that supports positioning and dimension changes
{
    _px = "px";                                    // Some browsers, especially DTD browsers need to have a measurement type included with the value.
    var s = g.style;                               // set _gs as the objects style reference
    if (w < 0) w = 0
    if (h < 0) h = 0
    if (w + " " == $u) w = _n
    if (h + " " == $u) h = _n
    if (op)                                       // If Opera 6 or 5 - No need to bother with Opera 7+
    {
        _px = "";                              // Opera5/6 doesnt like values declared with a measurement type so need to drop it
        // it also needs height and width returned as pixelHeight and pixelWidth
        if (w != _n) s.pixelWidth = w;         // set the objects width
        if (h != _n) s.pixelHeight = h         // set the objects height
    }
    else {
        if (w != _n) s.width = w + _px;          // .width works fine for most browsers
        if (h != _n) s.height = h + _px;         // .height does too
    }

    if (!isNaN(t) && t != _n) s.top = t + _px;                    // .top works with every browser
    if (!isNaN(l) && l != _n) s.left = l + _px                    // .left does too
}
$_ = 6;


function gpos(g)                                   // gpos returns dimensions of a menu or HTML Object
{
    if (!g) return
    var h = g.offsetHeight;                         // h is the height
    var w = g.offsetWidth;                          // w is the width	

    //if(ns6&&w==0)w=$pU(g.style.width)        // Added this to fix a bug in Netscape 6.0 -May need to restrict to just this browser.

    if (op5) {
        h = g.style.pixelHeight;            // Opera 5 and Opera 6 need to be different
        w = g.style.pixelWidth	             // This helps make Milonics life that little bit harder :o)
    }

    var o = g                                     // Declare a temporary object reference
    var t = 0                                         // set top value to zero by default
    var l = 0                                         // set left value to zero by default

    //alert(o.id + " - " + o.style.position + " - " + o.offsetParent.style.position)
    var foundObject = 0
    while (o != _n)                              // Loop through all offsettops 
    {
        t += o.offsetTop;
        l += o.offsetLeft;

        /* if(ie&&foundObject>0)
        {
        alert(o.id)
        if(parseInt(o.currentStyle.borderRightWidth)>0)l+=parseInt(o.currentStyle.borderRightWidth)
        if(parseInt(o.currentStyle.borderBottomWidth)>0)t+=parseInt(o.currentStyle.borderBottomWidth)
        }
        if(o.id.indexOf("menu")>-1)foundObject=1		
        if(parseInt(o.currentStyle.borderRightWidth)>0)alert(parseInt(o.currentStyle.borderRightWidth) + " - " + o.id)
        if(parseInt(o.currentStyle.borderBottomWidth)>0)t+=parseInt(o.currentStyle.borderBottomWidth)
        if(o.id=="el0")
        {
        alert(o.id + " - " +o.currentStyle.borderWidth)
        }
        alert(o.offsetTop + " - " + o.style.margin + " - " + o.style.padding)
        if(g.id=="el5")alert(o.style.position + " - " + o.tagName + " - " + o.offsetTop + " - " + o.id)
        if(o.id=="bannerRoles")	{
        alert(o.tagName)
        if(o.tagName=="DIV")showObjProps(o)
        }
        alert(o.currentStyle.position)
        */
        o = o.offsetParent;              // Incluing the parent values.
    }

    if (sfri)                                     // If the browser is Safari will need to make small adjustment
    {
        l -= _dBL                             // deduct document.body.offsetLeft from the left value
        t -= _dBT                             // deduct document.body.offsetTop from the top value
    }

    if (mac && _dB)                                      // IE on the Mac takes the margin into account, this bit fixes it.
    {
        _mcdb = _dB.currentStyle
        _mcf = _mcdb.marginTop
        if (_mcf) t = t + $pU(_mcf)              // if a Top margin has been specified (Default is 10 by the way)
        _mcf = _mcdb.marginLeft
        if (_mcf) l = l + $pU(_mcf)              // if a Left margin has been specified (Default is 10 by the way)
    }

    //_g1=new Array(t,l,h,w);                 // put all the above found values into an array for passing back to the caller
    return (new Array(t, l, h, w))                                 // Go for it...
}

C$ = 1;
_flta = "return 0";
if (ie55) _flta = "try{if(ap.filters){return 1}}catch(e){}"
_d.write("<" + "script>function getflta(ap){" + _flta + "}<" + "/script>");

function _applyFilter(g, m)                   // This function applies the filter to the menu we are about to open
{
    if (getflta(g))// If browser supports filter and filter is found. . . . .
    {
        var s = g.style
        var f = (s.visibility == $6) ? _m[m][16] : _m[m][15];
        //if(s.visibility==$6)f=_m[m][16]; else f=_m[m][15]  // Toggle between the outFilter or overFilter depending if we are showing or hiding the menu
        if (f)                                  // If a filter has actually been found, apply it
        {
            if (g.filters[0]) g.filters[0].stop();  // Stop the current filter, if one is still running.
            var i = "";                             // clear the filter string before we build the filter
            i = "FILTER:";                      // Initialize the filter string
            f = f.split(";");                  // Split the filter property by the ';' character
            for (var x = 0; x < f.length; x++)         // loop through each declared filter property
            {
                i += " progid:DXImageTransform.Microsoft." + f[x];
                if ($tU(_nv).indexOf("MSIE 5.5") > 0) x = _aN; // IE5.5 has a bug when delclaring more than one filter
            }
            s.filter = i                // set the objects filter to be the new filter 
            g.filters[0].apply(); 	         // Apply the filter
        }
    }
}

function _playFilter(g, m)                    // This function plays the filter
{
    if (getflta(g))// If browser supports filter and filter is found. . . . .	
    {
        _flt = (g.style.visibility == $6) ? _m[m][15] : _m[m][16];
        if (_flt) g.filters[0].play();
    }
}

/* **********************************
* Variables for FireFox slide down effect
*********************************** */
var myOpenInterval = 0;
var myGrowIntervals = 0;
var myOpenMenu = -1;
var myCloseInterval = 0;
var myShrinkIntervals = 0;
var mySingleCloseInterval = 0;
var mySingleShrinkIntervals = 0;

function menuDisplay(_mD, v)                 // A function for actually showing or hiding the menu. (m=menu to display, v=show flag)
{
    //alert(menuDisplay.caller)
    var o = gmobj(menuVar + _mD);                 // Get an Object reference to the menu

    if (!o) return
    var s = o.style
    //_M=_m[_mD]
    _m[_mD][22] = o                        // The object reference for each menu is now stored in an array element to help speed things up a little in other functions
    //alert(o.id + " - " + v)
    //alert(menuVar+m + " - " + o + " - " + v)
    if (v)                                // If we are showing the menu. . . . .
    {
        M_hideLayer(_mD, v)
        if (_kLm != Math.ceil(_mLt * _fLm.length)) _mi = []
        if (!_startM) _m[_mD][23] = 1
        // DO NOT CHANGE THE FOLLOWING LINE WITHOUT UPDATING MENUBUILDER.PHP TO REFLECT THIS CHANGE.
        if ((_m[_mD][7] == 0 && _ofMT == 1)) return;  // if the menu has been told to close then stop and go back
        // DO NOT CHANGE THE PREVIOUS LINE WITHOUT UPDATING MENUBUILDER.PHP TO REFLECT THIS CHANGE.
        if (s.visibility != $6) // Unless the menu to show isn't already visible, show it.
        {
            if (ns72) {
                /* ******************
                * START FIREFOX SPECIFIC CODE
                ********************* */
                // CHANGE THIS TO BE THE NUMBER OF THE MAIN BAR
                if (_mD == 6) {
                    s.visibility = $6; // visibleVar	 // Show the menu
                }
                else {
                    myShrinkIntervals = 0;
                    myGrowIntervals = 0;
                    s.maxHeight = 0 + 'px';
                    s.overflow = 'hidden';
                    s.visibility = $6; // visibleVar	 // Show the menu
                    myOpenMenu = _mD;
                    window.clearTimeout(myOpenInterval);
                    window.clearTimeout(myCloseInterval);
                    window.clearTimeout(mySingleCloseInterval);
                    myOpenInterval = window.setInterval('growMenu(' + _mD + ')', 1);
                    //myCloseInterval = window.setInterval('shrinkMenu(' + _mD + ')', 1);
                }

                /* ***********************
                * END FIREFOX SPECIFIC CODE
                *********************** */
            }
            else {

                _applyFilter(o, _mD);          // Apply the Internet Explorer 5.5+ filters and transitions
                //if((ns6||ns7)&&(!_m[m][14]&&!_m[m][7]))s.position="fixed"; // Set the position in Netscape 6/7, this is used to show abive Flash etc.

                if (!_m[_mD][27]) s.zIndex = _zi; else s.zIndex = _m[_mD][27];
                //alert(_m[_mD][27])

                s.visibility = $6 // visibleVar	 // Show the menu
                _playFilter(o, _mD)

                _SoT(_mD, 1)                     // Set the menu to be on top of other html objects.

                mmVisFunction(_mD, v)
                // Activate the Internet Explorer 5.5+ filters and transitions

                if (!_m[_mD][7]) _m[_mD][21] = _itemRef; // Let the menu know which menu item opened it
                _mnuD++                          // increment the menu display counter, used for setting on top in IE
            }
        }
    }
    else // if we are hiding the menu. . . . . .
    {
        if (_m[_mD][21] > -1 && _itemRef != _m[_mD][21]) itemOff(_m[_mD][21]);

        /*	if(ns7) {
        window.clearTimeout(myCloseInterval);
        myCloseInterval = window.setInterval('shrinkMenu(' + _mD + ')', 1);
        _SoT(_mD,0);
        } else {
        */
        if (ns6 || s.visibility == $6) {
            //if(!ie&&_m[_mD][13]=="scroll")s.overflow=$5 // hiddenVar
            if (!(ie || op7) && _m[_mD][13] == "scroll") s.overflow = $5 // hiddenVar // added op7 to fix bug with browser flickering 31st may 2005
            hmL(_mD)
            //gmobj("mmlink"+m).style.width="0px"
            _SoT(_mD, 0)                // Remove any objects that allow for menus to be on top.
            mmVisFunction(_mD, v)
            _applyFilter(o, _mD);          // Apply the Internet Explorer 5.5+ filters and transitions
            //if(!_m[_mD][14]&&ns6)s.position=B$;		
            s.visibility = $5;
            /*	s.visibility=$5 // hiddenVar   // Hide the menu								
            if(ns6||mac)
            if(!ie)s.top="-9999px"
            */
            _playFilter(o, _mD)            // Activate the Internet Explorer 5.5+ filters and transitions
            _mnuD--                          // decrement the menu display counter, used for setting on top in IE

            //	}
        }
        _m[_mD][21] = -1; // Tell the menu it does not have an opening menu item anymore		
    }
}

/* *******************************
* Start FireFox Slide Down Effect Methods
******************************* */
function growMenu(_mD) {
    var o = gmobj(menuVar + _mD);
    if (!o) return
    var s = o.style;

    if (s.maxHeight.replace('px', '') < _m[_mD][0].length * 40) {
        s.maxHeight = (myGrowIntervals * (_m[_mD][0].length) * 1.7) + 'px';
        myGrowIntervals++;
    }
    else {
        window.clearTimeout(myOpenInterval);
        myOpenInterval = 0;
        myGrowIntervals = 0;
    }

}

function shrinkMenu(_mD) {
    var sm = 0;
    var i = 0;

    for (i = 0; i < 6; i++) {
        var o = gmobj(menuVar + i);
        var s = o.style;
        if (i != myOpenMenu) {
            if (s.maxHeight != '') {
                if (s.maxHeight.replace('px', '') > 0) {
                    sm = 1;
                    if ((s.maxHeight.replace('px', '') - _m[i][0].length * 1.7) < 0) {
                        s.maxHeight = '0px';
                    }
                    else {
                        s.maxHeight = (s.maxHeight.replace('px', '') - _m[i][0].length * 1.7) + 'px';
                    }
                }
                else {
                    s.visibility = $5;
                    if (!ie) s.top = "-9999px";
                }
            }
        }

    }

    if (sm == 0) {
        window.clearTimeout(myCloseInterval);
        myCloseInterval = 0;
        myShrinkIntervals = 0;
    }
}

function shrinkSingleMenu(_mD) {
    var o = gmobj(menuVar + _mD);
    var s = o.style;

    if (myShrinkIntervals > 75) {

        window.clearTimeout(mySingleCloseInterval);
        mySingleCloseInterval = 0;
        mySingleShrinkIntervals = 0;

        s.visibility = $5;

    }
    else {

        s.maxHeight = (500 - (mySingleShrinkIntervals * 10)) + 'px';
        mySingleShrinkIntervals++;
    }
}

/* ******************************
* End FireFox Slide Down Effect Methods
****************************** */

function closeAllMenus()                // This function closes all menus when they are no longer needed, it helps keep things tidy
{
    //alert(closeAllMenus.caller)
    if (inEditMode) return
    var g = arguments // used to indicate the menu that closeAllMenus does NOT close
    //_Mtip=clearTimeOutFunc(_Mtip);
    //_W.status=""
    if (_oldel > -1) itemOff(_oldel, 1);       // If a menu item (not part of the heirarchy) is currently on, switch it off
    _oldel = -1;                          // Ensure that we reset the oldel variable
    _oMT = clearTimeOutFunc(_oMT);

    for (var a = 0; a < _m.length; a++)         // Loop through all the menus ensuring that they get closed
    {
        var M = _m[a]
        if (M && !M[7] && !M[10] && g[0] != a) {
            //alert(g[0] + " - " + _a)
            menuDisplay(a, 0); // Close the menu if it's not set to always visible or keepalive
            M_hideLayer(a, 0)

            /* if(ie55&&M[6].type!="tree") // Added this because menus were very slow when using filters and transitions
            {
            gmobj("menu"+_a).innerHTML=""
            M[23]=0
            } */
        }
        else {
            hmL(a)
        }
    }
    //_mnuD=0                             // Reset the IFRAME counter to zero so that we don't have too many IFRAMES, this is only a problem for https://
    _zi = _WzI;                            // Reset the starting ZIndex counter
    _itemRef = -1;                        // Reset the current menu item reference
    // Deleted the above line because it was resetting _itemRef prematurely for menu sample 15. Reinstated due to popup menus hanging 19-11-2004
    //_sm=new Array; //Removed this line in version 5.478 to ensure that the menu removed all sub menus
    _masterMenu = -1
    //alert()
    if (_W.resetAutoOpen) _ocURL()
}
function getMenuByItem(v)           // Return a reference to a menu by one of its items
{
    if (v + " " == $u) return -1;
    return _mi[v][0];
}
function getParentMenuByItem(v)               // Return a reference to a menuitems parent menu, this value will depend on who called the menu and can be different
{
    var t = getMenuByItem(v);                     // Set t as the items parent menu
    if (t == -1) return -1;                        // If the item does not have a parent go back to where we cam e from
    for (var x = 0; x < _mi.length; x++) if (_mi[x] && _mi[x][3] == _m[t][1]) return _mi[x][0];              // If the menu item has a link to a submenu. i.e. a "showmenu=" command then:-
    // Return the menu items parent menu. This is stored in the menu items slot of [0]	
}
_mLt = 100;

function getParentItemByItem(v)               // Return a reference to the menuitem that opened a menu by a menuitem - Phew!
{
    var t = getMenuByItem(v);
    if (t == -1) return -1;
    for (var x = 0; x < _mi.length; x++) if (_mi[x][3] == _m[t][1]) return x;
}

function getMenuByName(v)            // Get a reference to a menu by its name, as the function suggests :-))
{
    v = $tL(v)             // Set the name to lowercase so that we can remove case sensitivity, makes the users life easier so it's a good thing
    for (var x = 0; x < _m.length; x++) if (_m[x] && v == _m[x][1]) return x;
}

_mot = 0
//filter="FILTER: progid:DXImageTransform.Microsoft.Fade(duration=0.4);"
function itemOn()                              // This function sets the properties for when the user moves the mouse or keys over a menu item. It toggles, colors, images and other properties
{
    var g = arguments
    var i = g[0]
    var I = _mi[i];                                  // set I variable to the current "menuitem" object, this means less code	
    if (I[96]) return
    hrgm = gmobj("mmlink" + I[0])
    hrs = hrgm.style
    _lnk = gmobj("lnk" + i)

    if (I[42] && g[1]) _5(I[42]);

    if ((I[34] == "header" && !I[2]) || I[34] == "form") {   // If the item has been declared as a Header stop and go back, no need to carry on at this point
        gmobj(menuVar + I[0]).onselectstart = _n
        hrs.visibility = $5 // hiddenVar
        return
    }

    _mot = clearTimeOutFunc(_mot);                             // Clear the mouseOut timer, because a mouse event has now taken place
    _gmi = gmobj("el" + i); 		             // Get object reference to menu item			

    if (_gmi.itemOn == 1)                           // if the item is already set to ON, no point redoing everything so go back to caller
    {
        spos(hrgm, _gmi.t, _gmi.l, _gmi.h, _gmi.w)
        hrs.visibility = $6 // visibleVar
        return
    }
    _gmi.itemOn = 1                                // Set the objects itemOn property to true

    _pMnu = _m[I[0]]
    if (!_pMnu[9] && mac) {
        hrgp = gpos(gmobj("pTR" + i));
        if (!hrgp) hrgp = gpos(_gmi);
    }
    else hrgp = gpos(_gmi);
    _pm = gmobj(menuVar + I[0])
    _pp = gpos(_pm)
    if (_pm.style.visibility != $6) _pm.style.visibility = $6 // visibleVar
    if (hrgm) {
        hrgm._itemRef = i
        hrgm.href = _jv // javascript:void(0)
        if (sfri) hrgm.href = _n
        if (I[2]) hrgm.href = I[2]
        if (I[34] == "disabled") hrgm.href = _jv // javascript:void(0)
        hrs.visibility = $6 // visibleVar
        if (I[76]) hrgm.title = I[76]; else hrgm.title = ""
        hrgm.target = "_self"
        if (!I[57] && I[35]) hrgm.target = I[35]  //removed this cuz target was never executed unless targetfeatures was specified

        //hrs.background="green"
        hrs.zIndex = 1;
        if (I[34] == "html") {
            hrs.zIndex = -1;
            hrs = _gmi.style
        }

        if ((I[86] || I[34] == "dragable") && inDragMode == 0) {
            if (_lnk) _lnk.href = _jv
            drag_drop(I[0], i)
            hrs.zIndex = -1;
        }

        //if(I[34]=="tree")_gmi.pt=_n
        if (_gmi.pt != _pp[0] || _gmi.pl != _pp[1] || _gmi.ph != _pp[2] || _gmi.pw != _pp[3]) {
            _bwC = 0
            if (!hrgm.border && hrgm.border != I[25]) {
                hrs.border = I[25]
                hrgm.border = I[25]
                hrgm.C = $pU(hrs.borderTopWidth) * 2
            }
            if (hrgm.C) _bwC = hrgm.C

            var b = _m[I[0]][6][65]

            _tlcor = 0
            if (mac) if (_m[I[0]][12]) _tlcor = _m[I[0]][12]

            if (konq || sfri || _OpV) _tlcor -= b

            _gmi.t = hrgp[0] - _pp[0] + _tlcor
            _gmi.l = hrgp[1] - _pp[1] + _tlcor

            if (ff15 && _m[I[0]][13] == "scroll") {
                _gmi.t = _gmi.t + (b)
                _gmi.l = _gmi.l + (b)
            }

            if (!IEDtD && ie) _bwC = 0;

            _gmi.h = hrgp[2] - _bwC
            _gmi.w = hrgp[3] - _bwC
            _gmi.pt = _pp[0]
            _gmi.pl = _pp[1]
            _gmi.ph = _pp[2]
            _gmi.pw = _pp[3]
        }

        spos(hrgm, _gmi.t, _gmi.l, _gmi.h, _gmi.w)
    }

    //if(_m[I[0]].Ti==i)return //If tab menu and item matches, do not change anything

    _Cr = (ns6) ? _n : "";
    //if(ns6)_Cr=_n; else _Cr=""
    hrs.cursor = _Cr

    if (I[59]) {
        if (I[59] == "hand" && ns6) I[59] = "pointer"
        hrs.cursor = I[59];
    }
    //I[3]="M_doc*"

    if (I[32] && I[29]) gmobj("img" + i).src = I[32]  // Change the items main image if an "overimage" has been declared
    if (I[3] && I[3] != "M_doc*" && I[24] && I[48]) gmobj("simg" + i).src = I[48] // Change the items subImage if one has been declared

    if (_lnk && !itemClicked) {
        _lnk.oC = _lnk.style.color
        //alert(I[6])
        if (I[6]) _lnk.style.color = I[6]; 	// Change font color for on MouseOver	
        if (I[26]) _lnk.style.textDecoration = I[26];
    }

    if (I[53]) {
        //hrgm.className=I[53]
        _gmi.className = I[53]
        if (_lnk) _lnk.className = I[53]
        //if(gmobj("td"+i))gmobj("td"+i).className=I[53]
    }

    if (!itemClicked) if (I[5]) _gmi.style.background = I[5]; // Change background color for on MouseOver
    itemClicked = 0

    if (I[47]) _gmi.style.backgroundImage = "url(" + I[47] + ")"; // Change background image for on MouseOver

    if (I[71] && I[90]) {
        if (gmobj("sep" + i)) gmobj("sep" + i).style.backgroundImage = "url('" + I[90] + "')"; // Change searator image for on MouseOver
    }

    if (!mac) {
        if (I[44]) _lnk.style.fontWeight = "bold";
        if (I[45]) _lnk.style.fontStyle = "italic";
    }

    //Stop the menu from collapsing TAV
    if (ns7) {
        if (I[0] != 6) {
            myOpenMenu = I[0];

            var o = gmobj(menuVar + myOpenMenu);
            var s = o.style;

            if ((s.maxHeight.replace('px', '') < _m[myOpenMenu][0].length * 20) && (myOpenInterval == 0)) {
                if (s.visibility != $6) s.visibility = $6 // visibleVar
                myOpenInterval = window.setInterval('growMenu(' + myOpenMenu + ')', 1);
            }
        }
    }
    //
    //alert(_itemRef)

}

_kLm = _5($qe("6C4E756D")); // "licenseNumber"

//_oip=[]
function itemOff()        // This function sets the properties for when the user moves the mouse off keys out of a menu item. It toggles, colors, images and other properties
{
    var g = arguments
    var i = g[0]

    if (i == -1) return;
    _gmi = gmobj("el" + i);
    if (!_gmi) return
    //alert(_gmi.itemOn)
    if (_gmi.itemOn == 0) return
    _gmi.itemOn = 0
    _trueItemRef = -1
    _gs = _gmi.style
    var I = _mi[i];

    //alert(I[3] + " - " + I[24]  + " - " + I[48] + " - " + I[32] + " - " + I[29] + " - " + gmobj("simg"+i))	
    _tI = gmobj("img" + i)
    if (_tI && I[29]) _tI.src = I[29]
    if (I[3] && I[24] && I[48]) gmobj("simg" + i).src = I[24]
    _lnk = gmobj("lnk" + i)
    if (_lnk) {
        if (_startM || op) _lnk.oC = I[8]  // removed this bit because it broke the Visited link color.
        //alert(_lnk.oC)
        if (I[34] != "header") _lnk.style.color = _lnk.oC
        if (I[26]) _lnk.style.textDecoration = "none";
        if (I[33]) _lnk.style.textDecoration = I[33];
    }

    if (I[54]) {
        /* if(!I[72])
        {
        hrgm=gmobj("mmlink"+I[0])
        hrgm.className=I[54]
        } */
        _gmi.className = I[54]
        if (_lnk) _lnk.className = I[54]
        //if(gmobj("td"+i))gmobj("td"+i).className=I[54]
    }
    if (I[7]) _gs.background = I[7];
    if (I[9]) _gs.border = I[9]
    if (I[46]) _gs.backgroundImage = "url(" + I[46] + ")";
    if (I[71]) {
        s_I = gmobj("sep" + i)
        if (s_I) s_I.style.backgroundImage = "url(" + I[71] + ")"; // Change background image for on MouseOver
    }

    if (!mac) {
        if (I[44] && (I[14] == "normal" || !I[14])) _lnk.style.fontWeight = "normal";
        if (I[45] && (I[13] == "normal" || !I[13])) _lnk.style.fontStyle = "normal";
    }
    //if(!_startM&&I[43]&&g[1])_5(I[43]);
}

function closeMenusByArray(v) {
    for (var a = 0; a < v.length; a++) {
        if (v[a] != _mnu) {
            _m3 = _m[v[a]];
            if (_m3 && !(_m3[7])) menuDisplay(v[a], 0)
        }
    }
}

function getMenusToClose() {
    _st = -1;
    _en = _sm.length;
    _mm = _iP;
    if (_iP == -1) {
        if (_sm[0] != _masterMenu) return _sm;
        _mm = _masterMenu;
    }
    for (_b = 0; _b < _sm.length; _b++) {
        if (_sm[_b] == _mm) _st = _b + 1;
        if (_sm[_b] == _mnu) _en = _b;
    }

    if (_st > -1 && _en > -1) {
        _tsm = _sm.slice(_st, _en);
    }
    return _tsm
}

function _cm3() {
    _tar = getMenusToClose();
    closeMenusByArray(_tar);
    for (_b = 0; _b < _tar.length; _b++) {
        if (_tar[_b] != _mnu) _sm = remove(_sm, _tar[_b]);
    }
}

function _getDims()                              // This function gets the dimensions of the browser window, used for collision detection etc.
{
    _dB = _d.body;
    if (!_dB) return
    _dBT = _dB.offsetTop
    _dBL = _dB.offsetLeft
    if (!op && (_d.all || ns72)) {
        _mc = _dB;
        if (IEDtD && !mac && !op7) _mc = _d.documentElement
        if (!_mc) return;
        _bH = _mc.clientHeight;
        /* ****************************
        * JJ : Hard-coded a large window width to ensure that the right most menus did not move to 
        *      avoid the vertical scroll bar if the window was small.
        * JJ : Original code was re-instated so we could detect the chrome to hide shadows in FF.
        *      This functinality was moved there.
        * ************************** */
        _bW = _mc.clientWidth;
        //_bW = 100000;
        _sT = _mc.scrollTop;
        _sL = _mc.scrollLeft;
        if (konq) _bH = _W.innerHeight;
        //if(ns72)_bW=_bW-8
    }
    else {
        _bH = _W.innerHeight;
        /* ****************************
        * JJ : Hard-coded a large window width to ensure that the right most menus did not move to 
        *      avoid the vertical scroll bar if the window was small.
        * JJ : Original code was re-instated so we could detect the chrome to hide shadows in FF.
        *      This functinality was moved there.		
        **************************** */
        _bW = _W.innerWidth;
        //_bW = 100000;
        if (ns6 && _d.documentElement.offsetWidth != _bW) _bW = _bW - 16
        _sT = self.scrollY;
        _sL = self.scrollX
        if (op) {
            _sT = _dB.scrollTop;
            _sL = _dB.scrollleft;
        }
    }
}
_fLm = _5($qe("6C55524C")); // lURL
//alert($qe("6C6963656E736555524C"))
function c_openMenu(i) {
    var I = _mi[i]
    if (I[3]) {
        _oldMC = I[39];
        I[39] = 0;
        _oldMD = _menuOpenDelay;
        _menuOpenDelay = 0;
        _gm = gmobj(menuVar + getMenuByName(I[3]));
        _ofMT = 1
        if (_gm.style.visibility == $6 && I[40]) {
            menuDisplay(getMenuByName(I[3]), 0);
            itemOn(i);
        }
        else {
            _popi(i);
        }
        _menuOpenDelay = _oldMD;
        I[39] = _oldMC;
    }
    else {
        if (I[2] && I[39]) _5(I[2])
    }
}
function getOffsetValue(v) {
    var vv = 0;
    if (v) vv = v
    if (isNaN(v) && v.indexOf("offset=") == 0) vv = $pU(v.substr(7, 99));
    return vv
}
/* 
Args:
0      1 - Menu name to display
1      2 - Positioning
1 = By mouse position
"objectname" = By HTML Object
2      3 - Top Offset     if 0 is used will fix position based on HTML Object
3      4 - Left Offset
4      5 - Disable Collision Detection True or False
5      6 - Menu Opening Delay   
*/
function popup() {
    _itemRef = -1;
    var g = arguments
    _MT = clearTimeOutFunc(_MT);
    _oMT = clearTimeOutFunc(_oMT);
    if (g[0]) {
        _mnu = getMenuByName(g[0]);
        if (_mnu >= 0 && !_m[_mnu].tooltip) closeAllMenus(_mnu)

        //if(_W.t_M&&g[0]!=_m[t_M][1])closeAllMenus(_mnu)
        _M = _m[_mnu]
        if (!_M) return
        if (!_M[23]) BDMenu(_mnu)
        _tos = 0
        if (g[2]) _tos = g[2]
        _los = 0
        if (g[3]) _los = g[3]
        _gm = gmobj(menuVar + _mnu)
        if (!g[1] && (_M[2] || _M[3])) {
            _tP = _n
            _lT = _n
            if (!isNaN(_M[2])) _tP = _M[2]
            if (!isNaN(_M[3])) _lT = _M[3]
            spos(_gm, _tP, _lT)
        }

        //alert(_tos + " - " + _los)
        _sm[_sm.length] = _mnu
        /* if(_W._puP)_m[_puP][7]=0
        if(_M[10])_M[7]=1
        _puP=_mnu */
        $pS = 0;
        if (!_startM && _M[13] == "scroll") $pS = 1
        if (g[1]) {
            if (!_gm) return
            _gp = gpos(_gm)
            if (g[1] == 1) {
                if (_M[2]) if (isNaN(_M[2])) _tos = getOffsetValue(_M[2]); else { _tos = _M[2]; Y_ = 0 } // if the above has either an offset or fixed position then we need to set it	
                if (_M[3]) if (isNaN(_M[3])) _los = getOffsetValue(_M[3]); else { _los = _M[3]; X_ = 0 } // if the above has either an offset or fixed position then we need to set it
                if (!_M[25]) {
                    if (Y_ + _gp[2] + 16 > (_bH + _sT)) _tos = _bH - _gp[2] - Y_ + _sT - 16
                    if (X_ + _gp[3] > (_bW + _sL)) _los = _bW - _gp[3] - X_ + _sL - 6
                }
                spos(_gm, Y_ + _tos, X_ + _los);
            }
            else {
                _po = gmobj(g[1])
                _pp = gpos(_po)
                if (!_M[25]) {
                    if (!$pS) if (_pp[0] + _gp[2] + 16 > (_bH + _sT)) _tos = _bH - _gp[2] - _pp[0] + _sT - 16
                    if (_pp[1] + _gp[3] > _bW + _sL) _los = _bW - _gp[3] - _pp[1] + _sL - 2
                }
                _ttop = (_pp[0] + _pp[2] + getOffsetValue(_M[2]) + _tos) + _dBT
                spos(_gm, _ttop, (_pp[1] + getOffsetValue(_M[3]) + _los));
                //alert(_ttop + " - " + (_pp[1]+getOffsetValue(_M[3])+_los))	
                if (g[4]) _M.ttop = _ttop // .ttop is used to FIX the position for scrolling menus	
            }
            _ns6AP(_gm) // Fixes the menus position based on position=fixed for Mozilla based browsers
        }
        _oldbH = -1;
        _zi = _zi + 1
        _oMT = clearTimeOutFunc(_oMT);
        _moD = (g[5]) ? g[5] : 0;
        if (!_startM) _oMT = _StO("menuDisplay(" + _mnu + ",1)", _moD);
        //_fixMenu(_mnu)
        _SoT(_mnu, 1)
        if ($pS) _check4Scroll(_mnu)
        //_ofMT=0 // added this 20th September 2005 to see if it helps with context menu not showing in Firefox and also fix Ruths problems
        _M[21] = -1;
    }
}

function popdown() {
    _ofMT = 1
    _MT = _StO("closeAllMenus()", _menuCloseDelay)
    _oMT = clearTimeOutFunc(_oMT);
}

function BDMenu(m) {
    if (op5 || op6) return
    if (_W.buildAfterLoad) createNewMenus(m)
    _gm = gmobj(menuVar + m)
    if (!_gm) return
    //_gm.left=-10000	
    //if(_W.buildOffScreen)
    if (!_m[m][23]) spos(_gm, -9999) // Removes flicker on some browsers (firefox) when user mouses over an item when using menus openonclick
    innerText = _drawMenu(m, 0)
    //alert(innerText)
    _mcnt--
    /* ****************************	
    * JJ: Tricky hack here, have to add inner bottom and right borders here hard-coded for firefox
    **************************** */
    if (ns72)
        innerText = "<div style='border-right: solid 1px #C9CBCD;border-bottom:solid 1px #C9CBCD;'>" + innerText + "</div>"
    _gm.innerHTML = innerText
    //if(m==6)_d.f1.t1.value=innerText
    _fixMenu(m)
}
_masterMenu = -1
/* _mLb=_5($qe("6C566572")); // lVer
alert(_mLb)
_d.write("<div id=andydiv style='position:absolute;top:200px;left:700px'>sssss</div>")
*/
function _popi(i) {
    if (_itemRef > -1 && _itemRef != i) hmL(_mi[_itemRef][0])
    //_itemRef=i	
    var I = _mi[i]
    if (!I[65]) I[65] = 0;                         // Set I as the menu item variable - Saves on space
    I[3] = $tL(I[3])
    _mopen = I[3]; 					          // Get the name of the menu to display, if any
    _mnu = getMenuByName(_mopen);
    var _M = _m[_mnu]
    if (_M) {
        if (_M[21] > -1 && _M[21] != i) {
            itemOff(_M[21])
        }
        _M[21] = i;
    }

    if (I[34] == "ToolTip") return;             // If this menu has been set to ToolTip, stop and go back to where you came from.
    if (!I || _startM || inDragMode) return
    _pMnu = _m[I[0]]
    _MT = clearTimeOutFunc(_MT);
    //alert(I)
    //alert(inEditMode)
    if (_m[I[0]][7] && _masterMenu != I[0] && !inEditMode) {
        hmL(_masterMenu)
        closeMenusByArray(_sm)
        _oMT = clearTimeOutFunc(_oMT);
        _sm = []
        if (!_W.resetAutoOpen) _DC()
    }
    /* _M=_m[_mnu]
    if(_mopen)
    {
    alert("BDMEnu"  + " - " + _M[23] + "  - " + _mnu)
    alert(_mnu + " - "+  _mopen) */
    if (_M && !_M[23] && _mopen) BDMenu(_mnu)
    //}
    if (_oldel > -1)                                // if we have an old element
    {
        _gm = 0;
        if (I[3]) {
            _gm = gmobj(menuVar + getMenuByName(I[3]));
            if (_gm && _gm.style.visibility == $6 && i == _oldel) {
                itemOn(i, 1)
                return
            }
        }
        if (_oldel != i) _mOUt(_oldel)
        _oMT = clearTimeOutFunc(_oMT);
    }
    _cMT = clearTimeOutFunc(_cMT);
    _mnu = -1;                            	  // Reset the reference of the menu to open
    //_el=i; 								  // Set _el as current global menu item number	
    _itemRef = i
    showtip()
    _trueItemRef = i
    //alert(_M)
    I = _mi[i]
    _moD = (_M && _M[28]) ? _M[28] : _menuOpenDelay
    if (I[94]) _moD = I[94]
    //alert(i)
    horizMenu = 0; 						          // Set menu orientation flag to Vertical by default
    if (_pMnu[9]) {
        horizMenu = 1;  	              // Set menu orientation flag to Horizontal if this menu is not Vertical	
        if (!_W.horizontalMenuDelay) _moD = 0
    }

    itemOn(i, 1);                               // Change the colors and images for the menu item to indicate "Mouse Over"
    if (!_sm.length) {					      // If this is the first selected menu:-
        _sm[0] = I[0];                // set the first _sm(Selected Menu) array element to mainmenu number
        _masterMenu = I[0];                    // Set the _masterMenu variable
    }

    _iP = getMenuByItem(i);                   // Set Menu Item parent variable
    if (_iP == -1) _masterMenu = I[0];             // If this menu item belongs to a different master, reset the _masterMenu

    _cMT = _StO("_cm3()", _moD);  // Start the timer for opening the menu

    //if(I[39])                                // If Open On Click force the menu to open now
    //{
    if (_mopen && I[39])                   // If Open On Click force the menu to open now
    {
        _gm = gmobj(menuVar + _mnu);
        if (_gm && _gm.style.visibility == $6) {
            _cMT = clearTimeOutFunc(_cMT);
            _tsm = _sm[_sm.length - 1];
            if (_tsm != _mnu) menuDisplay(_tsm, 0);
        }
    }
    //}

    if (_W.forgetClickValue) inopenmode = 0;
    if (_mopen && (!I[39] || inopenmode) && I[34] != "tree" && I[34] != "disabled")                          // If submenu is found, then we need to open it
    {
        _getDims()                               // Get the dimensions of this browser, height, width etc
        _pm = gmobj(menuVar + I[0]);                 // Set _pm as the object for parent menu
        _pp = gpos(_pm);                           // Get the dimensions of the parent menu				
        _mnu = getMenuByName(_mopen);              // Get the reference number of the menu to open		
        if (I[41]) _M[10] = 1                 // If menuitem says keepalive then make menu also say keepalive

        //alert(_pMnu.kAm)
        if (_pMnu.kAm != _n && _pMnu.kAm + " " != $u) {
            /* _m[_pMnu.kAm][7]=0
            alert(_M + " - " +_m[_pMnu.kAm]+" - " + _mi[_m[_pMnu.kAm][21]])
            alert(_pMnu.kAm) */
            _sm[_sm.length] = _pMnu.kAm
        }
        _pMnu.kAm = _n
        if (_M && _M[10]) {
            _pMnu.kAm = _mnu
            //_m[_pMnu.kAm][7]=1
        }

        //if(ie4||op||konq||mac)
        //_fixMenu(_mnu);          // If IE4 or Opera 5/6 fix the dimensions of the menu, by default they are 100% width of browsers window
        if (_mnu > -1)                              // If we have actually found menu to open, run the open code
        {
            //			if(_oldel>-1&&(_mi[_oldel][0]+I[0]))menuDisplay(_mnu,0)	
            _oMT = _StO("menuDisplay(" + _mnu + ",1)", _moD);
            _mnO = gmobj(menuVar + _mnu);   	         // Get the object reference for the menu we need to open 			
            _mp = gpos(_mnO)                       // Get the dimensions of the menu we need to open, used for collision detection etc.
            /* alert(_mp)		
            if(ie4)
            {
            _mnT=gmobj("tbl"+_mnu);
            _tp=gpos(_mnT)
            _mp[3]=_tp[3]	
            } */

            _gmi = gmobj("el" + i)	                 // get reference to the current menu item
            if (!horizMenu && mac) _gmi = gmobj("pTR" + i)
            _gp = gpos(_gmi); 	                 // Get the position of the calling menu item

            if (horizMenu) {
                _left = _gp[1]                     // Set the default Left position for horizontal parent menu
                _top = _pp[0] + _pp[2] - I[65]      // Set the default Top position for horizontal parent menu	
            }
            else {
                _left = _pp[1] + _pp[3] - I[65]     // Set the default Left position for vertical parent menu
                _top = _gp[0]	                     // Set the default Top position for vertical parent menu
            }

            //alert(_top + "  - " + I[65] + "  - "+ _pp)
            if (sfri) {
                if (_pMnu[14] == "relative") {
                    _left = _left + _dBL
                    _top = _top + _dBT
                }
            }
            if (!horizMenu && _pMnu[13] == "scroll" && !op) // This bit makes sure that sub menus are opened correctly from a scrollable menu.
            {
                _top = (ns6 && !ns7) ? _top - gevent : _top - _pm.scrollTop
                //if(ns6&&!ns7)_top=_top-gevent; else	_top=_top-_pm.scrollTop
            }
            if (!_M[25]) {
                // Collision Detection and scrolling menu setup
                if (!horizMenu && (!_M[2] || isNaN(_M[2])))                                    // If the menu looks like it is going off the bottom of the page, move it up.
                {
                    _hp = _top + _mp[2]                        // _hp is used to check for the menu falling over the height of the browser window
                    //if(ns6)_hp+=_sT                           // If this browser is Mozilla based increment _sT

                    //if(_mnu==12)alert((_hp>_bH+_sT) + " -- " + _hp + " - "+ _bH + " - " + _sT + " - "+ _mp[2] + " - " + _top + " - " + _pp)   
                    if (_hp > _bH + _sT) {
                        _top = (_bH - _mp[2]) + _sT - 4   // Set top to ((browser height minus menu height) plus ScrollTop)	
                        //if(ns6)_top-=_sT
                    }
                    /*
                    if(ns6)
                    {
                    if(_top+_mp[2]>_bH)
                    {	
                    if((!_M[10]&&!_M[14])&&_pMnu[7]&&(ns6||ns7))
                    {
                    _top=_top-_sT;
                    }
                    else
                    {
                    _top=_bH-_mp[2]-20
                    }						
                    }
                    else
                    {
                    if((!_M[10]&&!_M[14])&&_pMnu[7]&&(ns6||ns7))
                    {
                    _top=_top-_sT;
                    }						
                    }					
                    }
                    */
                }
                if (_M[2] != _n)                  // If a physical TOP position or OFFSET has been declared, need to use it.
                {
                    if (isNaN(_M[2]) && _M[2].indexOf("offset=") == 0) {
                        _top = _top + getOffsetValue(_M[2])
                    }
                    else {
                        _top = _M[2];
                    }
                }
                if (_M[3] != _n)                  // If a physical LEFT position or OFFSET has been declared, need to use it.
                {
                    if (isNaN(_M[3]) && _M[3].indexOf("offset=") == 0) {
                        _left = _left + getOffsetValue(_M[3])
                    }
                    else {
                        _left = _M[3]
                    }
                }

                if (_left + _mp[3] + 3 > _bW + _sL) // If the menu looks like it's going of too far to the right move it to the left, or switch sides for the submenu
                {
                    if (!horizMenu && (_pp[1] - _mp[3]) > 0) {
                        _left = _pp[1] - _mp[3] - _subOffsetLeft + _pMnu[6][65]
                    }
                    else {
                        /* **********************************
                        * JJ: This is a much better place to override the browser chrome detection than we 
                        *     were using before.  Also using this to detect if we're in FF and hide the drop
                        *     shadow border to make sure it doesn't render
                        ********************************** */
                        //_left=(_bW-_mp[3])-8+_sL
                        if (_bW <= 798) {
                            if (ns72)
                                _mnO.style.borderRight = '0px';
                        }
                    }
                }
                /* **********************************
                * JJ: Added an else clause here so that if we're in FireFox and the chrome
                * doesn't overlap the menu, we still have our drop shadow.
                * ******************************** */
                else {
                    if (ns72)
                        _mnO.style.borderRight = '1px solid rgb(102,102,102)';
                }
            }
            if (horizMenu) {
                if (_M[11] == "rtl" || _M[11] == "uprtl") {
                    /* ******************************** 
                    * JJ: Hack to fix bug in FF where the right-hand menu position kept "jumping"
                    *     over to the right when the browser chroms overlapped the button
                    * ******************************** */
                    _mp[3] = 209
                    /* ******************************* */
                    _left = _left - _mp[3] + _gp[3] + _pMnu[6][65]
                }
                if (_M[11] == "up" || _M[11] == "uprtl" || (_pMnu[5] && _pMnu[5].indexOf("bottom") != -1)) {
                    _top = _pp[0] - _mp[2] - 1 - getOffsetValue(_M[2])
                }
            }
            else {
                if (_M[11] == "rtl" || _M[11] == "uprtl") _left = _pp[1] - _mp[3] - (_subOffsetLeft * 2)
                if (_M[11] == "up" || _M[11] == "uprtl") {
                    _top = _gp[0] - _mp[2] + _gp[2] - getOffsetValue(_M[2])
                }

                _top += _subOffsetTop
                _left += _subOffsetLeft
            }

            if (ns60)                             // This bit fixes a bug in very early Netscape 6.0 browsers, bug doesnt affect anything post Netscape 6.1.
            {
                _left -= _pMnu[6][65]
                _top -= _pMnu[6][65]
            }

            if (mac) {
                _left -= _pMnu[12] + _pMnu[6][65]
                _top -= _pMnu[12] + _pMnu[6][65]
            }

            if (sfri || op) {
                if (horizMenu) {
                    _left -= _pMnu[6][65]
                }
                else {
                    _top -= _pMnu[6][65]
                }
            }

            if (horizMenu && ns6 && _W.fixMozillaZIndex) _left -= _sL

            if (_left < 0) _left = 0                   // If the menu will go too far left set its left position to 2
            if (_top < 0) _top = 0                    // If the menu will go too high set its top position to 2

            if (ns6 && _M[14] == "fixed") {
                //alert(_m[_mi[i][0]][14])
                if (!_m[getParentMenuByItem(i)]) _top -= _sT // only adjust the top position if this menu has a parent.
            }

            spos(_mnO, _top, _left);               // Position the menu in the correct place on the page.
            //alert(_top + " - " + _left)			
            if (_M[5]) _setPosition(_mnu)
            if (!_startM && _M[13] == "scroll") _check4Scroll(_mnu) // If this menu has scroll bars enabled, see if they are required.					

            _zi++;                                   // increment the Z-Index counter 
            //_mnO.style.zIndex=_zi;                   // Set the Z-Index so that all menus appear on top of each other			
            if (_sm[_sm.length - 1] != _mnu) _sm[_sm.length] = _mnu
        }
    }

    isEditMode(i)
    _setPath(_iP);
    _oldel = i;

    if (_ofMT == 0) _oMT = clearTimeOutFunc(_oMT);                          // Clear the menu open timer
    _ofMT = 0;
    /* _itemRef=i
    alert(i)
    JJ: Hack to integrate vs with the menus...
    JJ: Backed out when we moved the VS func. into the menuing.
    vs_tempFunction();  */
}

_sBarW = 0;

function _check4Scroll(m) {
    //_fixMenu(m)
    /*
    _M=_m[m]                      // Set the _M variable to be the menu array data
    _gm=gmobj(menuVar+m);           // Get a reference to the menu object we need to check
    _gm.style.overflow="auto"
    _gm.style.overflowY="scroll"
    spos(_gm,_n,_n,300)
    _Mw=_M[12]*2	
    _gm.style.overflowX="hidden"
    _gm.style.width="auto"
    _gp=gpos(_gm)
    if(ie)
    {
    spos(_gm,_n,_n,_n,(_gp[3])+14)
    }
    //alert(gpos(_gm))	
    return
    */

    if (op) return;              // Don't do anything with scrollable menus if the browser is Opera5, Opera6
    _M = _m[m]                      // Set the _M variable to be the menu array data
    if (!_M) return
    if (_M.ttop) // If this menu has been told to keep it's TOP position take a snapshot of the old top position and set it to _M.ttop
    {
        _o4s = _M[2]
        _M[2] = _M.ttop
    }
    if (_M[2]) horizMenu = 1

    _gm = gmobj(menuVar + m);           // Get a reference to the menu object we need to check
    if (!_gm || _M[9]) return             // If gm is not set (menu object not found) or menus orientation is horizontal - No scroll bars are required
    _mp = gpos(_gm)                     // Get the menus dimensions and positoning, populating the _mp variable	  
    _gmt = gmobj("tbl" + m);           // Get a reference to the menus inner table
    _gt = gpos(_gmt)                    // _gt is the dimensions of the menus inner table
    _MS = _M[6]                        // set the _MS variable to be the menus style object	
    _Bw = _MS[65] * 2
    _Mw = _M[12] * 2

    //_cor=(_MS[65]*2+_M[12]*2)
    _smt = _gt[2]                  // Get the height of the inner table - this will help determine if we need scroll bars
    if (horizMenu) _smt = _gt[2] + _gt[0] - _sT  // If the opening menu is horizontal adjust the _smt value accordingly

    if (_smt < _bH - 16)                   // If the menus height is not taller than the browser windows height this menu may not require scrollbars, need more checks to make sure
    {
        _gm.style.overflow = "";        // set the menus overflow to none, the window could have been resized.
        _top = _n                      // set _top to null

        if (!horizMenu && (_gt[0] + _gt[2] + 16) > (_bH + _sT))  // If the menu looks like it is going off the bottom of the page
        {
            _top = (_bH - _gt[2]) + _sT - 16 // Set top to ((browser height minus menu height) plus ScrollTop)
        }

        /* _ofx=0;
        if(op7)_ofx=_cor
        _ofy=0
        if(mac)_ofy=_cor */
        if (!_M[24]) spos(_gm, _top);
        //_fixMenu(m);
        if (!_M[24]) {
            if (_M.ttop) _M[2] = _o4s
            return	         // If the menus height has been fixed, don't do any more scrolling code
        }
    }

    _gm.style.overflow = "auto"; // Switch the menus scroll bars on
    //if(_pFxd)menuDisplay(m,1)
    _sbw = _gt[3]; // set _sbw to the height of the menu object - This will now need adjusting depending on certain parameters.
    spos(_gm, _n, _n, 50, 40); // Set the height and width to 60 pixels, we need to do this to get the menus scroll bar width

    if (!_gm.$BW) _gm.$BW = _gm.offsetWidth - _gm.clientWidth
    $BW = _gm.$BW

    //alert(_mp)
    if (mac) $BW = 18

    if (IEDtD) // if this document uses DTD docType
    {
        _sbw += $BW - _Bw
        //alert("")
    }
    else {
        if (ie) _sbw += $BW + _Mw; else _sbw += $BW - _Bw
        //alert("")
        if (ns6 && !ns7) _sbw = _gt[3] + 15; // If Netscape 6.0, use default scrollbar width of 15 pixels
        //if(!navigator.vendor)_sbw=_sbw+4; // Should be Mozilla
    }
    //if(ie4)_sbw=_gt[3]+16+_Bw+_Mw; // If IE4.0 use default scrollbar width of 16 pixels

    _top = _n
    if (horizMenu) {
        _ht = _bH - _gt[0] - 16 + _sT
        //if(_pFxd)_ht-=_sT
    }
    else {
        _ht = _bH - 14
        _top = 6 + _sT
    }

    _left = _n
    if (!_M[25] && _mp[1] + _sbw > (_bW + _sL)) _left = (_bW - _sbw) - 2 // If the menu looks like it's going of too far to the right move it to the left, or switch sides for the submenu
    //alert(_bH + " - " + +_bW)
    if (_M[2] && !isNaN(_M[2])) {
        _top = _M[2]
        _ht = (_bH + _sT) - _top - 6
        if (_ht > _gt[2]) _ht = _gt[2]
        //alert(_sbw)
    }

    if (_M[24]) _ht = _M[24]
    //alert(_Mw + " - "  + _Bw + " - " + (_Mw+_Bw))

    if (ns7) _ht = _ht - _Bw - 10
    //if(op7&&_OpV<9)_sbw+=_cor	
    //alert(_top + " - " + _left + " - " + _ht + " - " + _sbw)	
    if (_ht > 0) {
        if (_M[24]) _top = _n
        spos(_gm, _top, _left, _ht + 2 - _M[12], _sbw);
        if (_M[24] && !_M[25]) {
            _mp = gpos(_gm)
            if (_mp[0] + _mp[2] - _sT > _bH) {
                _top = _mp[0] - _mp[2]
            }
            spos(_gm, _top);
        }
        _ns6AP(_gm)
    }

    if (_M.ttop) _M[2] = _o4s // Reset the arrays TOP position back to what is was before we did the scroll code.
}

function _setPath(p) {
    if (p > -1) // p is the menu item of the selected parent menu
    {
        var c = _m[p][21];
        while (c > -1) {
            var i = _mi[c]
            if (i[34] != "tree") itemOn(c);
            if (c == _m[i[0]][21]) return
            c = _m[i[0]][21];
        }
    }
}

function startClose() {
    if (_W.inResizeMode > -1) return
    _mot = _StO('_mOUt(this._itemRef)', 10) // Reinstated this bit for version 5.733 to fix menu opening annoyance
    _MT = _StO("_AClose()", _menuCloseDelay);
    _ofMT = 1;
    focusedMenu = -1
}

function _AClose() {
    //alert(_AClose.caller)
    if (inEditMode) return
    _ns6B = _ns6B.substr(0, 4)	                // Fixes a scrollbar bug in Mozilla 1.6 code - can be removed soon
    if ((_ps > 20040600 && _ps < 20041100) && _ns6B == "mmli" || _ns6B == menuVar) return	// Fixes a scrollbar bug in Mozilla 1.6 code - can be removed soon	
    if (_ofMT == 1) {
        myOpenMenu = -1;
        closeAllMenus();
        inopenmode = 0;
    }
    //_cKA=0 // Reset the close "Keep Alive" Menus flag
}

function stopClose(s) {
    if (_W.inResizeMode > -1) return
    _mot = clearTimeOutFunc(_mot);
    _MT = clearTimeOutFunc(_MT);
    _ofMT = 0;
    focusedMenu = s
    doMenuResize(focusedMenu)
}

function _setCPage(i) {
    if (i[18]) i[8] = i[18];
    if (i[19]) i[7] = i[19];
    if (i[56]) i[29] = i[56];
    if (i[69]) i[46] = i[69];
    if (i[85] && i[3]) i[24] = i[85]
    if (i[72]) i[54] = i[72]
    if (i[75]) i[9] = i[75]
    if (i[92]) i[71] = i[92]
    if (i[102]) i[6] = i[102]
    i.cpage = 1
}

function _getCurrentPage(i) {
    _hrF = _L.pathname + _L.search
    _hx = _Lhr.split("/")
    _fNm = "/" + _hx[_hx.length - 1]
    var I = _mi[i]
    var t = 0
    if (I[77]) if (_hrF.indexOf(I[77]) > -1) t = 1
    if (I[2]) {
        var u = I[2];
        if (_hrF == u || _hrF == u + "/" || u == _Lhr || u + "/" == _Lhr || _fNm == "/" + u) t = 1
    }

    if (t == 1) {
        _setCPage(I)
        _cip[_cip.length] = i;
        //if(_m[I[0]][11]=="tab")setTimeout("clickAction("+_el+")",200)
    }
}

/* function _ifix(_i)
}
return
_G=gmobj("simg"+_i)
if(_G.L)return  // _G.L is for _G.loaded
if(op7)
{
spos(_G,_n,_n,_G.height,_G.width)
spos(gmobj("el"+_i),_n,_n,_G.height,_G.width)
}	
_fixMenu(_mi[_i][0])
_G.L=1
}  */

function _cA(_N, _O, i) {
    var I = _mi[i]
    if (I[_N]) {
        _tmp = I[_N]
        I[_N] = I[_O]
        I[_O] = _tmp
    }
    else return
    var g = gmobj("el" + i)
    g.itemOn = 1
    if (_N == 81 && I[7]) {
        g.style.background = I[7]
        itemClicked = 1
    }
    if (_N == 80 && I[8] && I[1]) {
        gmobj("lnk" + i).oC = I[8]
        gmobj("lnk" + i).style.color = I[8]
        itemClicked = 1
    }

    if (_N == 87 && I[54]) {
        g.className = I[54]
        if (_lnk) _lnk.className = I[54]
    }

    if (_N == 88 && I[46]) {
        //alert(g.style.backgroundImage)
        g.style.backgroundImage = "url(" + I[88] + ")"
        itemOff(i)
    }

    if (_N == 91 && I[71]) {
        gmobj("sep" + i).style.backgroundImage = "url(" + I[91] + ")"
        //itemOff(i)
    }

    /* **** Need to edit these lines to get the images working better for collapse menu.
    return
    alert(gmobj("simg"+i)) */
    _gm = gmobj("simg" + i)
    if (_gm && _N == 83 && I[24] && I[3]) _gm.src = I[24]
    _gm = gmobj("img" + i)
    if (_gm && _N == 82 && I[29]) _gm.src = I[29]
}

function _caA(i) {
    _cA(80, 8, i)
    _cA(81, 7, i)
    _cA(82, 29, i)
    _cA(83, 24, i)
    _cA(87, 54, i)
    _cA(88, 46, i)
    _cA(91, 71, i)
}

itemClicked = 0
function clickAction(i) {
    var I = _mi[i]
    _M = _m[I[0]]

    _i = _itemRef
    if (!I[3] && !I[34]) closeAllMenus()
    _itemRef = _i
    if (_M[11] == "tab") {
        var tm = getMenuByName(I[3])
        if (tm) {
            if (_M.Tm && _M.Tm != tm) {
                _m[_M.Tm][7] = 0
                menuDisplay(_M.Tm, 0)
                gmobj("el" + _M.Ti).itemOn = 1
                _caA(_M.Ti)
                itemOff(_M.Ti)
            }
            if (_M.Tm != tm) _caA(i);
            _M.Tm = tm
            _M.Ti = i
            if (_M.Tm) _m[_M.Tm][7] = 1
        }
    }
    else {
        _caA(i)
    }
    _oTree()
    if (I[62]) return _5(I[62])
    mmClick()
    if (I[2] && I[57]) // Targetfeatures
    {
        //alert(I[2] + " - " + I[35] + " - '" + I[57] + "' - ")
        _ww = open(I[2], I[35], I[57])
        _ww.focus()
        return false
    }
    if (I[2]) // URL
    {
        if (I[34] == "html") _Lhr = I[2]
        if (gmobj("mmlink" + I[0]).tagName == "DIV") _L.href = I[2]
        /* *****************************
        * JJ:  Added the following code to make sure that the flydowns integrate with visual sciences
        ***************************** */
        if (I[104]) //VS Integration
        {
            var method = "GET";
            var lhref = "&link=" + escape(I[2]);
            var lname = "&linkname=" + escape(I[104]);
            var theText = escape(I[1]);
            var ltext = "&linktext=" + theText;
            var dref = "&title=" + document.title;
            var dlink = "&basepage=" + window.location.href;
            var cb = "&cb=" + (new Date()).getTime();
            var url = vs_filename + lhref + lname + ltext + dref + dlink + cb;
            //alert(url);               
            var imObj = new Image();
            imObj.src = url;
            return true;
        }
        return
    }
    inopenmode = 0;
    if (I[39]) {
        inopenmode = 1;
        c_openMenu(i)
    }
    return
}

function _getLink(I, _gli, _M) {
    if (!I[1]) return ""
    _Ltxt = I[1]
    _TiH = ((I[34] == "header" || I[34] == "form" || I[34] == "dragable" || I[86]) ? 1 : 0);
    _ofc = (I[8] ? "color:" + I[8] : "")
    if (!_TiH && I[58] && !I.cpage) _ofc = ""
    _fsize = (I[12] ? ";font-Size:" + I[12] : "");
    _fstyle = (I[13] ? ";font-Style:" + I[13] : ";font-Style:normal");
    _fweight = (I[14] ? ";font-Weight:" + I[14] : ";font-Weight:normal");
    _ffam = (I[15] ? ";font-Family:" + I[15] : "");
    _tdec = (I[33] ? ";text-Decoration:" + I[33] : ";text-Decoration:none;");
    _disb = (I[34] == "disabled" ? "disabled" : "");
    _clss = " "
    if (I[54]) {
        _clss = " class='" + I[54] + "' "
        if (!I[33]) _tdec = " "
        if (!I[13]) _fstyle = " "
        if (!I[14]) _fweight = " "
    }
    else if (I[58]) {
        _clss = " class='" + _m[_mi[_gli][0]][6].linkclass + "' "
    }
    _tpee = " "
    //_tpe=((I[2]&&I[34]!="html")?"a":"div");
    _tpe = "a" // Changed to make the keypress sample work. 20-12-2004
    if (_TiH || !I[2]) _tpe = "div"
    if (_tpe != "a") _tpee = " onclick=clickAction(" + _gli + ") "
    _rawC = (I[78] ? I[78] : "");
    _padd = ""
    //if(ie)_padd+=";padding:"+$pX(I[11]);	
    //_padd=(ie?";padding:"+$pX(I[11]):"");	
    if (_M[8]) _padd += ";text-align:" + _M[8]; else
        if (I[36]) _padd += ";text-align:" + I[36];
    _tpe += _tabnx

    /* _link="<"+_tpe+_tpee+" name=mM1 onfocus='_iF0C("+_gli+")'  href='"+I[2]+"' "+_disb+_clss+" id=lnk"+_gli+" style='border:none;"+_padd+";width:100%;background:transparent;display:block;"+_ofc+_ffam+_fweight+_fstyle+_fsize+_tdec+_rawC+"'>"+_Ltxt+"</"+_tpe+">";
    Removed width=100% due to the effects of DOCTYPE on XP samples - 04-02-2005
    _link="<"+_tpe+_tpee+" name=mM1 onfocus='_iF0C("+_gli+")'  href='"+I[2]+"' "+_disb+_clss+" id=lnk"+_gli+" style='border:none;background:transparent;display:block;"+_ofc+_ffam+_fweight+_fstyle+_fsize+_tdec+_rawC+_padd+"'>"+_Ltxt+"</"+_tpe+">";	  	  
    *******************************************
    * JJ - Added the new "name" item to the link rendering code in order to support visual sciences tagging
    *******************************************
    _link="<"+_tpe+_tpee+" name=mM1 onfocus='_iF0C("+_gli+")'  href='"+I[2]+"' "+_disb+_clss+" id=lnk"+_gli+" style='border:none;background:transparent;display:block;"+_ofc+_ffam+_fweight+_fstyle+_fsize+_tdec+_rawC+_padd+"'>"+_Ltxt+"</"+_tpe+">";	  	  
    TODO:  Add hook here to look for focus and blur events to open and close windows. 
    */
    _link = "<" + _tpe + _tpee + " name='" + I[104] + "' onfocus='_iF0C(" + _gli + ")'  href='" + I[2] + "' " + _disb + _clss + " id=lnk" + _gli + " style='border:none;background:transparent;display:block;" + _ofc + _ffam + _fweight + _fstyle + _fsize + _tdec + _rawC + _padd + "'>" + _Ltxt + "</" + _tpe + ">";

    //alert(_link)	
    return _link;
}

function hmL(_mn) {
    _hm = gmobj("mmlink" + _mn)
    //if(_hm)spos(_hm,-999,-999) // Added to fix keypress menus - 19-12-2004
    if (_hm) _hm.style.visibility = $5 // hiddenVar 
}
function _mOUt(i) {
    var I = _mi[i]
    if (!I) return
    _oMT = clearTimeOutFunc(_oMT);                          // Clear the menu open timer
    hidetip();
    if (i > -1) hmL(I[0])
    itemOff(i, 1)
    o_IR = _itemRef           // take a copy of the new _itemRef
    _itemRef = i             // Change _itemRef to be the same as i so that there are no conflicts
    if (I && I[43]) _5(I[43]); 	// execute mouseoff function
    _itemRef = o_IR           // put the _itemRef value back to what it was again.
}
function _iniIF(M) {
    var m = _m[M]
    if (m && !m.lD) {
        m.Q = clearTimeOutFunc(m.Q)
        m.Z = clearTimeOutFunc(m.Z)
        m.Q = _StO("imgfix(" + M + ")", 500); // Try increasing this value if menus don't fix themselves after loading images
        m.Z = _StO("imgfix(" + M + ")", 80)
        m.lD = 1
    }

}

function imgfix(_mnu) {
    //alert(_m[_mnu][13])
    var M = _m[_mnu]
    if (M && M[13] != "scroll") {
        _fixMenu(_mnu);
        if (M[5]) _setPosition(_mnu);
    }
    else {
        _check4Scroll(_mnu) //Need to get this sorted for scrolling menus that contain images.
    }
    /* alert()
    return
    if(!ie)return
    _gm=gmobj(menuVar+_mnu)	
    _gmT=gmobj("tbl"+_mnu)
    gp=gpos(_gmT)
    spos(_gm,_n,_n,gp[2],gp[3])
    _setPosition(_mnu) */
}

function _getItem(i, _Tel) {
    //keytoactivate
    _it = ""
    _el = _Tel
    var I = _mi[_el]
    _mnu = I[0];
    var _M = _m[_mnu]
    if (_M[11] == "tab") I[39] = 1
    _getCurrentPage(_el);
    if (I[34] == "header") {
        if (I[20]) I[8] = I[20]
        if (I[21]) I[7] = I[21]
        if (I[74]) I[9] = I[74]
    }
    _ofb = (I[46] ? "background-image:url(" + I[46] + ");" : "");
    if (!_ofb) _ofb = (I[7] ? "background:" + I[7] + ";" : "");
    actiontext = " onmouseover=_popi(" + _Tel + ") "
    _link = _getLink(I, _el, _M)
    //_iheight="height:100%;" removed this to fix Netscape 7.1 image bug - 02-08-2004
    _iheight = "height:100%;"
    if (_M[18]) _iheight = "height:" + $pX(_M[18])
    if (I[28]) _iheight = "height:" + $pX(I[28])
    _clss = ""
    if (I[54]) _clss = " class='" + I[54] + "' "
    if (horizMenu) {
        if (i == 0) _it += "<tr>";
        if (I[50]) I[27] = I[50]
    }
    else {
        if (I[49]) I[27] = I[49]
        if (_M[26] && !I[97]) {
            if (i == 0 || (_M[26] == _rwC)) {
                _it += "<tr id=pTR" + _el + ">";
                _rwC = 0
            }
            _rwC++
        }
        else {
            _it += "<tr id=pTR" + _el + ">";
        }
    }

    _subC = 0;       // Does this menu item contain a pointer to a submenu
    if (I[3] && I[24]) _subC = 1; // Set _subC=true if it does		
    _timg = "";
    _bimg = "";
    if (I[34] == "tree") {
        //_it+="<td id=treeI"+_el+" style='border:1px solid black'><img src=/treemenu/desktop/vnode.gif></td>";				
        if (I[3]) {
            _M[8] = "top";
            I[30] = " top";
        }
        else {
            if (I[79]) {
                _subC = 1
                I[24] = I[79]
                I[3] = "M_doc*"
            }
        }
    }

    if (I[29]) {
        _imalgn = "";
        if (I[31]) _imalgn = " align=" + I[31];
        _imvalgn = "";
        if (I[30]) _imvalgn = " valign=" + I[30];
        _imcspan = "";
        if (_subC && _imalgn && I[31] != "left") _imcspan = " colspan=2";
        _imgwd = " ";
        _Iwid = ""
        if (I[38]) {
            _Iwid = " width=" + I[38];
            _imgwd = _Iwid
        }
        _Ihgt = (I[37]) ? " height=" + I[37] : "";
        /*
        _Ihgt="";if(I[37])Ihgt=" height="+I[37];
        ***************************************
        *  Need to add the following if there is an image, even though there might still be text, test with new images
        ***************************************
        _imf=(!I[1])?"onload=_iniIF("+_mnu+")":"";
        _imf="";if(!I[1])_imf="onload=imgfix("+_mnu+")"
        */
        _impad = (I[60]) ? " style='padding:" + $pX(I[60]) + "'" : "";
        /* _impad=""if(I[60])_impad=" style='padding:"+$pX(I[60])+"'"		
        if(I[84])
        alert() */
        _alt = (I[76]) ? " alt='" + I[76] + "'" : "";
        _timg = "<td id=_imgO" + _el + " " + _imcspan + _imvalgn + _imalgn + _imgwd + _impad + ">" + (I[84] ? "<a href='" + I[84] + "'>" : "") + "<img onload=_iniIF(" + _mnu + ",this) border=" + (I[89] ? I[89] : 0) + " style='display:block' " + _Iwid + _Ihgt + _alt + " id=img" + _el + " src='" + I[29] + "'>" + (I[84] ? '</a>' : '') + "</td>";
        //alert(_timg)
        if (I[30] == "top") _timg += "</tr><tr>";
        if (I[30] == "right") {
            _bimg = _timg;
            _timg = "";
        }
        if (I[30] == "bottom") {
            _bimg = "<tr>" + _timg + "</tr>";
            _timg = ""
        }
    }

    _padd = (I[11] ? ";padding:" + $pX(I[11]) : "");
    if (!I[1]) _padd = ""
    _algn = ""
    if (_M[8]) _algn += " align=" + _M[8];
    if (I[61]) _algn += " valign=" + I[61];
    _offbrd = ""
    if (I[9]) _offbrd = "border:" + I[9] + ";"
    _nw = " nowrap ";
    _iw = "";
    if (!horizMenu && _M[17]) _iw = _M[17];
    if (_M[4]) _iw = _M[4];
    if (I[55]) _iw = I[55];
    if (I[55] != _M[6].itemwidth) _iw = I[55];
    if (isNaN(_iw) && _iw.indexOf("%") > -1) _iw = Math.ceil(100 / _M[0].length) + "%"
    if (_M[31]) _nw = "";
    if (_iw) {
        _nw = ""
        _iw = " width=" + _iw
    }
    if (I[97]) {
        _iw += " colspan=" + I[97];
        _rwC = _M[26]
    }
    if (_subC || I[29]) //Sub Image is needed for this item
    {
        _Limg = ""
        _Rimg = ""
        _itrs = ""
        _itre = ""
        if (I[3] && I[24])            // if showmenu and subimage declared
        {
            var _subIR = 0
            //if(_M[11]=="rtl"||_M[11]=="uprtl")_subIR=1						
            //_imf=(_M[13]!="scroll")?" onload=_iniIF("+_mnu+",this)":"";
            _img = "<img id=simg" + _el + " onload=_iniIF(" + _mnu + ",this) src='" + I[24] + "'>"
            _simgP = ""
            if (I[22]) _simgP = ";padding:" + $pX(I[22])
            _imps = "width=1"
            if (I[23]) {
                _iA = "width=1"
                _ivA = ""
                _imP = I[23].split(" ")
                for (var a = 0; a < _imP.length; a++) {
                    if (_imP[a] == "left") _subIR = 1
                    if (_imP[a] == "right") _subIR = 0

                    if (_imP[a] == "top" || _imP[a] == "bottom" || _imP[a] == "middle") {
                        _ivA = "valign=" + _imP[a]

                        //if(_imP[a]=="top")_subIR=1
                        if (_imP[a] == "bottom") _subIR = 0
                    }
                    if (_imP[a] == "center") {
                        _itrs = "<tr>"
                        _itre = "</tr>"
                        _iA = "align=center width=100%"
                    }
                }
                _imps = _iA + " " + _ivA
            }

            _its = _itrs + "<td " + _imps + " style='font-size:1px" + _simgP + "'>"
            _ite = "</td>" + _itre;
            if (_subIR) {
                _Limg = _its + _img + _ite
            }
            else {
                _Rimg = _its + _img + _ite
            }
        }
        _it += "<td " + _iw + " id=el" + _el + actiontext + _clss + " style='padding:0px;" + _offbrd + _ofb + _iheight + ";'>";
        //_TbS="<table class=milonictable border=1 cellpadding=0 cellspacing=0 style='padding:0px' "		
        _pw = " width=100% "
        //alert(I[1])
        //if(I[1]&&_iw)_pw=_iw
        if (_W.noSubImageSpacing) _pw = ""
        _it += _TbS + _pw + " height=100% id=MTbl" + _el + ">";
        _it += "<tr id=td" + _el + ">";
        _it += _Limg
        _it += _timg;

        if (_link)                          // if text has been declared for this item
        {
            _it += "<td " + _pw + _nw + _algn + " style='" + _padd + "'>" + _link + "</td>";
        }
        _it += _bimg;
        _it += _Rimg
        _it += "</tr>";
        _it += "</table>";
        _it += "</td>";
    }
    else {
        /*_TabI=""
        if(_W.includeTabIndex)_TabI=" tabindex="+_el
        if(_link)_it+="<td "+_iw+_clss+_nw+_TabI+" id=el"+_el+actiontext+_algn+" style='"+_padd+_offbrd+_iheight+_ofb+"'>"+_link+"</td>";
        The above (_TabI) was removed as it didn't appear to do anything, tab order still works */
        if (_link) _it += "<td " + _iw + _clss + _nw + " id=el" + _el + actiontext + _algn + " style='" + _padd + _offbrd + _iheight + _ofb + "'>" + _link + "</td>";
    }
    var _sepadd = "";
    if ((_M[0][i] != _M[0][_M[0].length - 1]) && I[27] > 0) {
        _3dBorderProperty = ""
        if (!I[10]) I[10] = I[8]
        _sbg = ";background:" + I[10];
        if (I[71]) _sbg = ";background-image:url(" + I[71] + ");";

        //if(I[27])
        //{
        if (horizMenu) {
            if (I[49]) {
                _sepA = "middle"
                if (I[52]) _sepA = I[52];
                _sepadd = "";
                if (I[51]) _sepadd = "style=padding:" + $pX(I[51])
                _it += "<td id=sep" + _el + " nowrap " + _sepadd + " valign=" + _sepA + " align=left width=1px><div style='font-size:1px;width:" + $pX(I[27]) + ";height:" + $pX(I[49]) + ";" + _3dBorderProperty + _sbg + ";'></div></td>";
            }
            else {
                if (I[16] && I[17]) {
                    _bwid = I[27] / 2
                    if (_bwid < 1) _bwid = 1
                    _brdP = _bwid + "px solid "
                    _3dBorderProperty += "border-right:" + _brdP + I[16] + ";";
                    _3dBorderProperty += "border-left:" + _brdP + I[17] + ";";
                    _3dBorderProperty = ""
                    if (mac || sfri || (ns6 && !ns7)) {
                        _it += "<td style='width:" + $pX(I[27]) + "empty-cells:show;" + _3dBorderProperty + "'></td>"
                    }
                    else {
                        _iT = _TbS + "><td></td></table>"
                        if (ns6 || ns7) _iT = ""
                        _it += "<td style='empty-cells:show;" + _3dBorderProperty + "'>" + _iT + "</td>"
                    }
                }
                else {
                    if (I[51]) _sepadd = "<td nowrap width=" + $pX(I[51]) + "></td>";
                    _it += _sepadd + "<td id=sep" + _el + " style='padding:0px;width:" + $pX(I[27]) + _3dBorderProperty + _sbg + "'>" + _TbS + " width=" + I[27] + "><td style=padding:0px;></td></table></td>" + _sepadd
                    //alert(_sepadd+"<td id=sep"+_el+" style='padding:0px;width:"+$pX(I[27])+_3dBorderProperty+_sbg+"'>"+_TbS+" width="+I[27]+"><td style=padding:0px;></td></table></td>"+_sepadd)
                }
            }
        }
        else {
            if (I[16] && I[17]) {
                _bwid = I[27] / 2
                if (_bwid < 1) _bwid = 1
                _brdP = _bwid + "px solid "
                _3dBorderProperty = "border-bottom:" + _brdP + I[16] + ";";
                _3dBorderProperty += "border-top:" + _brdP + I[17] + ";";
                if (mac || ns6 || sfri || konq || IEDtD || op) I[27] = 0
            }
            if (I[51]) _sepadd = "<tr><td height=" + I[51] + "></td></tr>"
            _sepW = "100%";
            if (I[50]) _sepW = I[50];
            _sepA = "center"
            if (I[52]) _sepA = I[52];
            if (!mac) _sbg += ";overflow:hidden";
            _it += "</tr>" + _sepadd + "<tr><td style=padding:0px; id=sep" + _el + " align=" + _sepA + "><div style='" + _sbg + ";" + _3dBorderProperty + "width:" + $pX(_sepW) + ";padding:0px;height:" + $pX(I[27]) + "font-size:1px;'></div></td></tr>" + _sepadd + "";
        }
        //}			
    }
    //if(I[34]=="tree")_it+="<tr><td valign=top id=OtI"+_el+" style='display:none;'></td></tr>"	
    if (I[34] == "tree") {
        if (ie && !mac) {
            _it += "<tr id=OtI" + _el + " style='display:none;'><td></td></tr>";
        }
        else {
            _it += "<tr><td style='height:0px;' valign=top id=OtI" + _el + "></td></tr>"
        }
    }
    return _it
}

function _fixMenu($U) {
    $M = _m[$U]
    if (!mac && !$M[14]) return
    _gm = gmobj(menuVar + $U);
    if (_gm) {
        _gmt = gmobj("tbl" + $U);
        if (_gmt) {
            $S = _gm.style
            $T = _gmt.offsetWidth
            if ($M[14] == "relative" || $M[13] == "scroll") $S.width = $T + "px";
            if (mac) {
                _cor = ($M[12] * 2 + $M[6][65] * 2)
                _MacA = gpos(_gmt)
                if (_MacA[2] == 0 && _MacA[3] == 0) {
                    _StO("_fixMenu(" + $U + ")", 200);
                    return
                }
                if (IEDtD) _cor = 0
                $S.overflow = $5 // hiddenVar	
                $S.height = $pX(_MacA[2] + _cor)
                $S.width = $pX(_MacA[3] + _cor)
            }
        }
    }
}

/*
function _fixMenu($U)
{
return
_gm=gmobj(menuVar+$U);
if(_gm){
_gmt=gmobj("tbl"+$U);
if(_gmt){
$M=_m[$U]
$S=_gm.style
$T=_gmt.offsetWidth			
_cor=($M[12]*2+$M[6][65]*2)
if(op5)_gm.style.pixelWidth=_gmt.style.pixelWidth+_cor;
if(mac){
_MacA=gpos(_gmt)
if(_MacA[2]==0&&_MacA[3]==0){
_StO("_fixMenu("+$U+")",200);
return
}					
if(IEDtD)_cor=0
$S.overflow=$5 // hiddenVar	
$S.height=$pX(_MacA[2]+_cor)
$S.width=$pX(_MacA[3]+_cor)
}			
else
{				
if($M[14]=="relative"||ns6||_OpV) // added ns6 because screenposition="right" failed on firefox
{
_cor=0;
$S.width=$T+"px";
}				
if($M[17])
{
if(!isNaN($M[17]))$M[17]=$M[17]+"px";
$S.width=$M[17]; 
} 
else if($M[13]=="scroll")
{
if(op7)$T=$T+_cor // Added this line to fix bug with Opera 7/8 removing right hand menu border
$S.width=$T+"px";
}
}			
if($M[31]>0)
{
//_gp=gpos(_gm)
//spos(_gm,_n,_n,_n,1)
if($T>$M[31])spos(_gm,_n,_n,_n,$M[31]);
}
}
}
}
*/

gevent = 0;
function getEVT(evt, _mnu) {
    if (evt.target.tagName == "TD") {
        _egm = gmobj(menuVar + _mnu);
        gevent = evt.layerY - (evt.pageY - _dBT) + _egm.offsetTop;
    }
}
/*
function changeStatus(i)
{
if(i>-1)
{
var I=_mi[i]
if(I[4])
{
_W.status=I[4];
return _t
}
_W.status=""
if(!I[2])return _t
}
}
*/
function $pX() {
    var g = arguments;
    var x = g[1] ? "" : ";"
    var p = (!isNaN(g[0])) ? g[0] += "px" + x : g[0] + x
    return p;
}
/*
function $pX(px)
{			
px=(!isNaN(px))?px+="px;":px+=";"
return px;
}
*/
function _eMD(d) {
    _it = d.split(":");
    return _it[1].replace(/;/g, "")
}

function createNewMenus() {
    _getDims();
    _startM = 0
    //alert(_m.length + " - " + _mcnt)
    for (var y = _mcnt; y < _m.length; y++) {
        var M = _m[y]
        //alert(y)
        var o = _d.createElement("div")
        o.id = "menu" + y
        o.onmouseout = new Function("startClose()");
        o.onmouseover = new Function("stopClose(" + y + ")");
        o.onselectstart = new Function("return _f");
        if (_dB.appendChild) {
            _dB.appendChild(o)
            _drawMenu(y, 0)
            o.className = _cls
            var n = o.style
            if (_padd) n.padding = _eMD(_padd)
            if (M[17]) n.width = M[17] + "px"
            if (M[24]) n.height = M[24] + "px"
            if (_ofb) n.background = _eMD(_ofb)
            if (_borderProperty) n.border = _eMD(_borderProperty)
            o.style.zindex = 999
            o.style.visibility = _visi
            if (_posi) n.position = _eMD(_posi)
            if (_top) n.top = _eMD(_top)
            if (_left) n.left = _eMD(_left)
            if (_bgimg) n.backgroundImage = _eMD(_bgimg);
            if (_mbgc) n.background = _eMD(_mbgc)
            M[23] = 0
        }
    }
}

_ifc = 0
_fSz = "'>"
function _drawMenu() {
    var g = arguments
    _mnu = g[0]
    _begn = g[1]
    _mcnt++
    var _M = _m[_mnu];
    _BAL = g[2]
    //alert(_M[7])
    if (_BAL && _M[7] == null) return
    _mt = "";
    if (!_M) return
    if (_W.noTabIndex) _tabnx = " tabindex=-1 "; else _tabnx = "";
    _MS = _M[6]
    _tWid = "";
    _top = "";
    _left = "";
    if (_M[7] == 0) _M[7] = _n;
    if ((!_M[14]) && (!_M[7])) _top = "top:-" + $pX(_aN);
    if (_M[2] != _n) if (!isNaN(_M[2])) _top = "top:" + $pX(_M[2]);
    if (_M[3] != _n) if (!isNaN(_M[3])) _left = "left:" + $pX(_M[3]);
    _mnuHeight = "";
    if (_M[18]) _mnuHeight = _M[18];
    if (_M[24]) _mnuHeight = _M[24];
    if (_M[9] == "horizontal" || _M[9] == 1) {
        _M[9] = 1;
        horizMenu = 1;
    }
    else {
        _M[9] = 0;
        horizMenu = 0;
    }
    if (_mnuHeight) _mnuHeight = " height=" + _mnuHeight
    _ofb = "";
    if (_MS.offbgcolor) _ofb = "background:" + _MS.offbgcolor;
    _borderProperty = "";
    _brdP = "";
    var bw = "";
    if (_MS[65] || _MS[65] == 0) {
        _brdsty = _MS[64] ? _MS[64] : "solid";
        _brdcol = _MS.offcolor ? _MS.offcolor : "";
        if (_MS[63]) _brdcol = _MS[63]
        if (_MS[65] || _MS[65] == 0) bw = _MS[65]
        _brdP = bw + "px " + _brdsty + " "
        _borderProperty = "border:" + _brdP + _brdcol + ";";
    }
    _Mh3 = _MS.high3dcolor
    _Ml3 = _MS.low3dcolor

    if (_Mh3 && _Ml3) {
        _h3d = _Mh3
        _l3d = _Ml3
        if (_MS.swap3d) {
            _h3d = _Ml3
            _l3d = _Mh3
        }
        _brdP = bw + "px solid "
        _borderProperty = "border-bottom:" + _brdP + _h3d + ";";
        _borderProperty += "border-right:" + _brdP + _h3d + ";";
        _borderProperty += "border-top:" + _brdP + _l3d + ";";
        _borderProperty += "border-left:" + _brdP + _l3d + ";";
    }
    _ns6ev = "";
    if (_M[13] == "scroll" && ns6 && !ns7) _ns6ev = "onmousemove='getEVT(event," + _mnu + ")'";
    _bgimg = "";
    if (_MS.menubgimage) _bgimg = ";background-image:url(" + _MS.menubgimage + ");";
    //_wid="";
    if (!_M[14] && !_M[7] && _W.fixMozillaZIndex && ns6) _M[14] = "fixed";
    _posi = B$;
    if (_M[14]) {
        _posi = _M[14]
        /* if(_M[14]=="relative")
        {
        _posi="";
        // REMOVED WIDTH CODE -- if(!_M[4])_wid="width:1px;"
        _top=""
        _left=""
        }
        */
        if (_M[14] == "fixed" && !ns6) _posi = B$
    }
    _padd = "padding:0px;"
    if (_M[12]) _padd = ";padding:" + $pX(_M[12]);

    _cls = "mmenu"
    if (_MS.offclass) _cls = _MS.offclass
    if (_posi) _posi = "position:" + _posi;

    // REMOVED WIDTH CODE -- _mnwid=""
    // REMOVED WIDTH CODE -- if(_M[17])_mnwid=" width="+_M[17]

    _visi = $5 // hiddenVar
    //if(_M[14]=="relative")_visi=$6 // visibleVar // removed this because it buggered up the transparency for main menus when set to relative

    _mbgc = ""
    if (_begn == 1) {
        /* 
        REMOVED WIDTH CODE -- if(!op6&&_mnwid&&!ns7)_wid=";width:"+$pX(_M[17])
        _mt+="<div id=shadow"+_mnu+" style=\"position:absolute\"></div>"		
        if(_M[17])
        {
        _q7=_MS.borderwidth
        if(ie&&_q7)_M[17]=$pU(_M[17])+(_q7*2)
        _wid=";width:"+$pX(_M[17])
        }
        */
        _hght = "";
        if (_M[17]) _hght = ";width:" + $pX(_M[17])
        if (_M[24]) _hght += ";height:" + $pX(_M[24])
        if (_MS.menubgcolor) _mbgc = ";background-color:" + _MS.menubgcolor
        if (_M[11] == "rtl") _padd += "direction:rtl;";
        /* alert(_padd)
        alert(_posi)
        _wid=""		
        */
        _mali = ""
        if (_M[20]) _mali = ";text-align=" + _M[20];
        /* *************************************
        * JJ: change outter div to act as drop shadow (also contains left hand border)
        ************************************* */
        //_mt+="<div class='"+_cls+"' onmouseout=startClose() onmouseover=stopClose("+_mnu+") onselectstart='return 0' "+_ns6ev+" id=menu"+_mnu+" style='"+_padd+_ofb+";"+_borderProperty+_hght+"z-index:999;visibility:"+_visi+";"+_posi+";"+_top+";"+_left+_bgimg+_mbgc+_mali+"'>";
        if ((_mnu != 6) && (ns72)) {
            /*		    if(_W.innerWidth < 800)
            _mt+="<div class='"+_cls+"' onmouseout=startClose() onmouseover=stopClose("+_mnu+") onselectstart='return 0' "+_ns6ev+" id=menu"+_mnu+" style='"+_padd+_ofb+";border-left: solid 1px #C9CBCD;border-bottom:solid 1px #666666;"+_hght+"z-index:999;visibility:"+_visi+";"+_posi+";"+_top+";"+_left+_bgimg+_mbgc+_mali+"'>";			    
            else */
            _mt += "<div class='" + _cls + "' onmouseout=startClose() onmouseover=stopClose(" + _mnu + ") onselectstart='return 0' " + _ns6ev + " id=menu" + _mnu + " style='" + _padd + _ofb + ";border-left: solid 1px #C9CBCD;border-right:solid 1px #666666;border-bottom:solid 1px #666666;" + _hght + "z-index:999;visibility:" + _visi + ";" + _posi + ";" + _top + ";" + _left + _bgimg + _mbgc + _mali + "'>";
        }
        else
            _mt += "<div class='" + _cls + "' onmouseout=startClose() onmouseover=stopClose(" + _mnu + ") onselectstart='return 0' " + _ns6ev + " id=menu" + _mnu + " style='" + _padd + _ofb + ";" + _borderProperty + _hght + "z-index:999;visibility:" + _visi + ";" + _posi + ";" + _top + ";" + _left + _bgimg + _mbgc + _mali + "'>";
    }

    if (_M[7] || !_startM || (op5 || op6) || _W.buildAllMenus) {
        _M[23] = 1
        if (!(mac) && ie) _fSz = "font-size:999px;'>&nbsp;";
        /* if(mac)_mnwid=" width=1 "
        if(_mnwid)_mt+=_TbS+_mnwid+" style="+_ofb+"><td "+_mali+" style=padding:0px;>";   // This is the old way
        // REMOVED WIDTH CODE -- if(_mnwid)_mt+=_TbS+" width=100% style="+_ofb+"><td "+_mali+" style=padding:0px;>";		
        *** Menu width code goes here and is normally what needs changing *** */
        _rwC = 0;
        /* 
        These 2 lines WERE as below but this broke some menus.
        Reinstated these lines in version 5.753 to get menuwidth to work on horizontal menus
        Looks like we MUST include these 2 lines for both horizontal and vertical menus
        if(_M[17])_tWid=_M[17]
        if(_M[30])_tWid=_M[30]
        These 2 lines WERE as below but this broke some menus, changed in version 5.737.

        if(horizMenu)
        {			
        if(_M[26]>1)_rwC=Math.ceil(_M[0].length/_M[26]);
        _rwT=_rwC
        if(_M[4]&&_M[4].indexOf("%")>-1){
        _M[4]=Math.ceil(100/_M[0].length)+"%"			
        if(_M[17])_tWid=_M[17]
        if(_M[30])_tWid=_M[30]
        }
        }
        else
        {
        if(_M[17])_tWid=_M[17]        //Removed this line cuz it made 100% width work incorrectly, may need to re-instate.. Did need to reinstate as it broke items containing images when itemwidth had been spec'd
        if(_M[30])_tWid=_M[30]
        if(_M[4])_tWid=_M[4]
        if(_M[6].itemwidth)_tWid=_M[6].itemwidth			
        }
		
        */

        //if(_M[17])_tWid=_M[17]
        if (horizMenu) {
            if (_M[26] > 1) _rwC = Math.ceil(_M[0].length / _M[26]);
            _rwT = _rwC
            /* if(_M[4]&&_M[4].indexOf("%")>-1){
            _M[4]=Math.ceil(100/_M[0].length)+"%"			
            } */
        }
        else {
            if (_M[4]) _tWid = _M[4]
        }
        //if(_M[30])_tWid=_M[30]

        _mali = ""
        if (_M[20]) _mali = " align=" + _M[20];

        if (_tWid) _tWid = " width=" + _tWid
        // ********************

        _mt += _TbS + _mnuHeight + _tWid + " id=tbl" + _mnu + _mali + ">";
        for (_b = 0; _b < _M[0].length; _b++) {
            _mt += _getItem(_b, _M[0][_b]);
            _el++
            if (horizMenu && _rwC > 1) {
                if (_b + 1 == _rwT) {
                    _mt += "</tr><tr>";
                    _rwT = _rwT + _rwC
                }
            }
        }

        if (mac && !horizMenu) _mt += "<tr><td id=btm" + _mnu + "></td></tr>";
        _mt += "</table>" + " ";  // The $ is tagged onto the end of the table to help fix a bug in IE5.0 on the Mac
        //_M[23]=1
        // REMOVED WIDTH CODE -- if(_mnwid)_mt+="</td></tr></table>";	

        _tpe = ((ns61 && _M[6].type == "tree") ? "div" : "a");
        _tpe += _tabnx

        /* ****************************************
        * JJ:  This one link seems to handle all onclick events within the menu system.  Had to add the rel='exit'
        *     here so that it would be cataloged with the rest of the links when we call vs_tempFunction manually
        *      on drawing the menu.
        ******************************************
        * _mt+="<"+_tpe+" name=mM1 id=mmlink"+_mnu+" href=# onmouseout=hidetip() onclick='return clickAction(this._itemRef);' onmouseover='moan(this);_mot=clearTimeOutFunc(_mot)' style='outline:none;line-height:normal;background:transparent;text-decoration:none;height:1px;width:1px;overflow:hidden;position:"+B$+";"+_fSz+"</"+_tpe+">"
        **************************************** */
        _mt += "<" + _tpe + " name=mM1 id=mmlink" + _mnu + " href=# onmouseout=hidetip() onclick='return clickAction(this._itemRef);' onmouseover='moan(this);_mot=clearTimeOutFunc(_mot)' style='outline:none;line-height:normal;background:transparent;text-decoration:none;height:1px;width:1px;overflow:hidden;position:" + B$ + ";" + _fSz + "</" + _tpe + ">"

        /*
        var o=_d.createElement(_tpe) 
        o.id="mmlink"+_mnu
        o.name=o.id
        o.onmouseout="hidetip()"; 
        o.onclick='return clickAction(this._itemRef)'
        o.onmouseover='moan(this);_mot=clearTimeOutFunc(_mot)' 
        if(_dB.appendChild)
        {
        _dB.appendChild(o)
        o.style.outline="none";
        o.style.line-height="normal";
        o.style.background="transparent";
        o.style.text-decoration="none";
        o.style.height="1px";
        o.style.width="1px";
        o.style.overflow="hidden";
        o.style.position="absolute";
        o.style.font-size="999px";
        }
        */

    }
    else {
        if (_begn == 1) for (_b = 0; _b < _M[0].length; _b++) {
            _getCurrentPage(_el)
            _el++
        }
    }
    if (_begn == 1) _mt += "</div>";

    //if(_mnu==0)_d.f1.t1.value=_mt
    //alert(_mt)

    if (_begn == 1) _d.write(_mt); else return _mt;
    //if(_M[7])
    if (_M[7]) {
        _M[22] = gmobj(menuVar + _mnu)
        if (ie55) drawiF(_mnu);
    }
    else {
        if (ie55 && _ifc < _mD) drawiF(_mnu);
        _ifc++
    }

    if (_M[19]) {
        _M[19] += 0
        _M[19] = _M[19].toString()
        _fs = _M[19].split(",")
        if (!_fs[1]) _fs[1] = 50
        if (!_fs[2]) _fs[2] = 2
        _M[19] = _fs[0]
        followScroll(_mnu, _fs[1], _fs[2])
    }
    if (_mnu == _m.length - 1 || (_BAL && _M[7])) {
        _mst = clearTimeOutFunc(_mst);
        _mst = _StO("_MScan()", 50);
        _getCurPath();
    }
}
$S2 = "6D696C6F6E6963"
function _getCurPath() {
    if (!_W.disablePagePath) {
        if (_cip.length > 0) {
            for (_c = 0; _c < _cip.length; _c++) {
                _ci = _cip[_c];
                _mni = getParentItemByItem(_ci);
                if (_mni == -1) _mni = _ci

                if (_mni + " " != $u) {
                    while (_mni != -1) {
                        var I = _mi[_mni]
                        _setCPage(I)
                        _gi = gmobj("el" + _mni)
                        if (_gi) _gi.itemOn = 1
                        itemOff(_mni);
                        _omni = _mni
                        _mni = getParentItemByItem(_mni);
                        //if(_mni==_omni)return
                        if (_mni == _omni || _mni + " " == $u) _mni = -1
                    }
                }
            }
        }
    }
}

function _gOfs(V, n) {
    var S = [];
    if (isNaN(V[n]) && V[n].indexOf("offset=") == 0) {
        S[0] = V[n].substr(7, 99);
        var m = S[0].indexOf(";minimum=")
        if (m > -1) {
            S[1] = S[0].substr(m + 9, 99);
            S[0] = S[0].substr(0, m);
        }

        V[n] = _n;
    }
    return S
}

function _setPosition(m) {
    var _M = _m[m]
    if (_M[5]) // if screen position has been declared
    {
        _gm = gmobj(menuVar + m);
        if (!_gm) return
        _gp = gpos(_gm);
        _LoM = 0;
        if (!_gm.leftOffset) {
            _oSA = _gOfs(_M, 3);
            _gm.leftOffset = _oSA[0]
            _gm._LoM = _oSA[1]
        }
        _lft = _n;
        if (!_M[3]) // if no left position has been specified
        {
            if (_M[5].indexOf("left") != -1) _lft = 0;
            if (_M[5].indexOf("center") != -1) _lft = (_bW / 2) - (_gp[3] / 2);
            if (_M[5].indexOf("right") != -1) _lft = (_bW - _gp[3]);
            if (_gm.leftOffset) _lft = _lft + $pU(_gm.leftOffset);
        }
        _ToM = 0;
        if (!_gm.topOffset) {
            _oSA = _gOfs(_M, 2);
            _gm.topOffset = _oSA[0]
            _gm._ToM = _oSA[1]
        }

        _tp = _n;
        if (!_M[2] >= 0) {
            _tp = _n;
            if (_M[5].indexOf("top") != -1) _tp = 0;
            if (_M[5].indexOf("middle") != -1) _tp = (_bH / 2) - (_gp[2] / 2);
            if (_M[5].indexOf("bottom") != -1) _tp = _bH - _gp[2];
            if (_gm.topOffset) _tp = _tp + $pU(_gm.topOffset);
        }
        if (_lft < 0) _lft = 0
        if (_lft < _gm._LoM) _lft = _gm._LoM
        if (_tp) _tp = $pU(_tp)
        if (_lft) _lft = $pU(_lft)
        //alert(_tp + " - " + _lft + " - "+ _bW +" - " + _M[5] + " - " + _gm.style.width +" - " +_gp)		
        spos(_gm, _tp, _lft);
        //alert(_lft + " - " + _bW + " - " + _gp)		
        if (_M[19]) _M[19] = _tp
        if (_M[7]) _SoT(m, 1)
        _gm._tp = _tp
    }
}

function followScroll(m, c, r)                  // This function moves the menu based on user scrolling position - followScroll
{
    if (!_startM && !inDragMode)                                           // Only if the page has started and is a master menu. . . run the code
    {
        var _M = _m[m]                                        // Get array reference of menu
        _fogm = _M[22]                                       // Get reference of menu to move
        _fgp = gpos(_fogm)                                   // Get position of menu to move		
        //if(!_fgp)return;
        _tt = (_sT > _M[2] - _M[19]) ? _sT - (_sT - _M[19]) : _M[2] - _sT
        //if(_sT>_M[2]-_M[19])_tt=_sT-(_sT-_M[19]); else _tt=_M[2]-_sT		
        if (_fgp && _fgp[0] - _sT != _tt) {
            //alert(_fogm.id+" - " + _fgp+" - " + _fgp[0]+" - " + _sT + " - " +_tt)
            diff = _sT + _tt                                   // The difference is scrollTop plus menu Top
            _rcor = (diff - _fgp[0] < 1) ? r : -r
            //if(diff-_fgp[0]<1)_rcor=r;else _rcor=-r// 
            _fv = $pU((diff - _rcor - _fgp[0]) / r)
            if (r == 1) _fv = $pU((diff - _fgp[0]))
            if (_fv != 0) diff = _fgp[0] + _fv                     //
            spos(_fogm, diff);                              // If the menu has moved enough, set the correct position and stop processing
            if (_fgp._tp) _M[19] = _fgp._tp
            if (ie55) {
                _fogm = gmobj("ifM" + m)
                if (_fogm) spos(_fogm, diff);
            }
        }
    }
    _fS = _StO("followScroll('" + m + "'," + c + "," + r + ")", c)	  // Repeat the process
}

function $qe(s) {
    var x = s.split("")
    var q = ""
    for (var a = 0; a < s.length; a++) {
        q += "%" + x[a] + x[a + 1]
        a++
    }

    return unescape(q)
}
$S1 = "687474703A2F2F7777772E"

//if(_W.onload)_toL=onload;onload=_cL

function _MScan() {
    /* _d.f1.t1.value=_sm	
    _d.forms[0][1].value=Date()
    alert() */
    _getDims();
    //status="itemRef="+_itemRef+" X_ "+X_+" Y_="+Y_

    if (_bH != _oldbH || _bW != _oldbW) {
        //_5($qe("5F634C2829")) // _cL() to start the eval menu		
        _tMR()
        for (var a = 0; a < _m.length; a++) {
            if (_m[a] && _m[a][7]) {
                //if((_startM&&(mac||ns6||ns7||konq)||_m[a][14]=="relative"))
                _fixMenu(a);
                menuDisplay(a, 1)
                if (_m[a][13] == "scroll") _check4Scroll(a)
            }
        }
        for (var a = 0; a < _m.length; a++) {
            if (_m[a] && _m[a][5]) {
                _setPosition(a);
            }
        }
    }
    if (_startM) {
        _mnuD = 0
        stopClose(-1)
        _ofMT = 1
    }
    _startM = 0;
    _oldbH = _bH;
    _oldbW = _bW;
    _cL()
    /* if(!op&&(_d.all||sfri)&&_d.readyState!="complete"){
    _oldbH=0;_oldbW=0;
    }
    */
    if (op) {
        _oldbH = 0;
        _oldbW = 0;
    }
    _mst = _StO("_MScan()", 50);
}




function openNewWindow(winURL, winWidth, winHeight, winConfig) {
    mmConfig = ""
    mmConfig = "width=" + winWidth + ","
    mmConfig += "height=" + winHeight + ","
    mmConfig += winConfig
    var mmWin = open(winURL, "", mmConfig);
    mmWin.focus();
}
function drawiF(_mnu) {
    if (_W._CFix) return
    _mnuV = "ifM" + _mnu;
    if (!_m[_mnu][7]) {
        _mnuV = "iF" + _mnuD
        _mnuD++
    }
    //_ssrc+=_tabnx
    _d.write("<iframe class=mmenu FRAMEBORDER=0 id=" + _mnuV + _tabnx + " src='javascript:false' style='filter:Alpha(Opacity=0);width:1px;height:1px;top:-9px;position:" + B$ + ";'></iframe>")
    //_d.write("<iframe bgcolor=green class=mmenu FRAMEBORDER=0 id="+_mnuV+_tabnx+" src='javascript:false' style='backgrouond-Color:green;margin:10px;border:1px solid black;position:"+B$+";'></iframe>")
    //alert(_mnu + " - " + _mnuD + " - " + _mnuV)
}

milonicBuildData = 1234567;
if (!(op5 || op6)) _5("setIn" + $qe("74657276616C28275F634C282927") + "," + _aN + ")") // setInterval("cl()",_aN)
function _SoT(_mnu, _on)                      // This funtion ensure that the menu will always appear on top of Form Selects, Java & Flash objects
{

    //_W.status="'"+_mnu + "' - '" + _mnuD + "' - '" + _on + "'"
    var _M = _m[_mnu]
    if (ns6 || _M.treemenu || _M[14] == "relative" || _W._CFix || !_M[22]) return
    //if(ns6)return
    if (ie55) {                                     // if ie55 we need to ensure that the menu will sit on top of Form Selects
        if (_on) {
            if (_M[7]) {
                _iFf = "iFM" + _mnu
            }
            else {

                _iFf = "iF" + _mnuD
            }
            if (_M.ifr) _iF = _M.ifr; else
                _iF = gmobj(_iFf)                 // Try to find an IFRAME for this menu			
            /* alert(_iFf + " - " + _M.ifr)
            _iF=gmobj("iF"+_mnuD)                 // Try to find an IFRAME for this menu
            if(!_iF)_iF=gmobj("ifM"+_mnu)         // Get a reference to an existing IFRAME for this mainmenu, should have already been created at build time.				
            if(_M[7])_iF=gmobj("ifM"+_mnu)         // Get a reference to an existing IFRAME for this mainmenu, should have already been created at build time.						
            */
            if (!_iF) {                             // If not found, will need to create one
                //if(_d.readyState!="complete")return// If this page is not ready to build new IFRAMES then quit:
                _iF = _d.createElement("iframe")    // Initialize a new IFRAME
                //if(_L.protocol=="https:")_iF.src=_W.blankPath  // This code sets the default file for the IFRAME if running on a secure server. This stops the security warning from appearing.
                _iF.src = "javascript:false";
                //_iF.id="iF"+_mnuD                 // Set the id of the IFRAME, may need to refer to it later on
                _iF.id = _iFf                 // Set the id of the IFRAME, may need to refer to it later on
                _iF.style.filter = "Alpha(Opacity=0)"; // make the IFRAME transparent				
                //_iF.style.margin="10px";				
                _iF.style.position = B$     // Ensure the IFRAME can go anywhere in the browser window
                _iF.style.className = "mmenu"
                //if(!_M[27])_iF.style.zIndex=_m.length-1
                if (_dB.appendChild) _dB.appendChild(_iF)          // Now we can Create the IFRAME
            }
            _gp = gpos(_M[22])                // Get the position and dimensions of the menu
            if (_iF) {
                spos(_iF, _gp[0], _gp[1], _gp[2], _gp[3]) // Set the position and dimensions of the IFRAME to the same as the menu
                //alert(_gp)
                _iF.style.visibility = $6        // Set the visibility flag for the IFRAME
                //if(!_M[27])_iF.style.zIndex=_zi-1
            }
            _iF.style.zIndex = _M[22].style.zIndex - 2
            _M.ifr = _iF
        }
        else {                                     // If an IFRAME was found, we should re-use it
            _gm = gmobj("iF" + (_mnuD - 1))             // Get the object reference for the IFRAME
            if (_gm) {
                spos(_gm, -9999)
                _gm.style.visibility = $5 // hiddenVar  // Set the visibility flag for the IFRAME
                _M.ifr = null
            }
        }
        //alert(_iF.style.zIndex)
    }
}




/* **********************************************************
menu.js
*********************************************************** */
fixMozillaZIndex = false; _menuCloseDelay = 500; _menuOpenDelay = 150; _subOffsetTop = 2; _subOffsetLeft = -2; _includeTabIndex = true; with (menuStyle = new mm_style()) { borderstyle = "solid"; fontfamily = "Verdana, Tahoma, Arial"; fontsize = "10pt"; fontstyle = "normal"; fontweight = "normal"; headerbgcolor = "#ffffff"; headercolor = "#000000"; offbgcolor = "#07077b"; offcolor = "#FFFFFF"; onbgcolor = "#bb1a00"; oncolor = "#000000"; padding = 4; pagecolor = "#bb1a00"; separatorcolor = "#000000"; separatorpadding = 1; subimage = ""; subimagepadding = 0; }
with (submenuStyle = new mm_style()) { styleid = 1; borderstyle = "solid"; borderwidth = 1; fontfamily = "Verdana, Tahoma, Arial"; fontsize = "8pt"; fontstyle = "normal"; fontweight = "normal"; headercolor = "#000000"; offbgcolor = "#000000"; offcolor = "#ffffff"; onbgcolor = "#2a2a2a"; onborder = "0px solid #000000"; oncolor = "#bb1a00"; padding = 4; pagecolor = "#bb1a00"; separatorsize = 1; subimage = ""; subimagepadding = 0; }

with (milonic = new menuname("Main Menu")) {
    align = "center";
    alwaysvisible = 1;
    itemheight = 25;
    itemwidth = 135;
    position = "relative";
    orientation = "horizontal";
    style = menuStyle;
    top = 0;
    left = 0;

    aI("align=center;showmenu=1;text=HOME;");
    aI("align=center;text=CALENDAR;url=http://www.newcastle-track.co.uk/2011.html;");
    aI("align=center;showmenu=2;text=RESULTS;");
    aI("align=center;text=STANDINGS;url=http://www.newcastle-track.co.uk/ntcatables.docx;target=_blank;");
    aI("align=center;text=FAQs;url=http://www.newcastle-track.co.uk/faqs.html;");
    aI("align=center;text=WEATHER WATCH;url=http://www.newcastle-track.co.uk/weather.html;");
    aI("align=center;text=CONTACT US;url=http://www.newcastle-track.co.uk/contact.html;");

}

with (milonic = new menuname("1")) {
    margin = 0;
    itemheight = 25;
    itemwidth = 175;
    style = submenuStyle;
    aI("text=Track League;url=http://www.newcastle-track.co.uk/league.html;")
    aI("text=Home;url=http://www.newcastle-track.co.uk/index.html;")
}

with (milonic = new menuname("2")) {
    margin = 0;
    itemheight = 25;
    itemwidth = 175;
    style = submenuStyle;
    aI("text=2011 Results >>>;showmenu=2c;")
    aI("text=2010 Results >>>;showmenu=2b;")
    aI("text=2009 Results >>>;showmenu=2a;")
    aI("text=2008 Reports >>>;showmenu=08Reports;")
    aI("text=2008 Results >>>;showmenu=08Results;")
    aI("text=Archive Results;url=http://www.newcastle-track.co.uk/archive.html;")
    aI("text=Photography;url=http://my.fotopic.net/collection/01863584/;target=blank;")
    aI("showmenu=ic;text=Inter Club Challenge >>>;")
}

with (milonic = new menuname("2c")) {
    margin = 0;
    itemheight = 25;
    itemwidth = 175;
    style = submenuStyle;
    aI("text=1st September 2011;url=http://www.newcastle-track.co.uk/010911.html;")
    aI("text=25th August 2011;url=http://www.newcastle-track.co.uk/250811.html;")
    aI("text=18th August 2011;url=http://www.newcastle-track.co.uk/180811.html;")
    aI("text=11th August 2011;url=http://www.newcastle-track.co.uk/110811.html;")
    aI("text=4th August 2011;url=http://www.newcastle-track.co.uk/040811.html;")
    aI("text=28th July 2011;url=http://www.newcastle-track.co.uk/280711.html;")
    aI("text=21st July 2011;url=http://www.newcastle-track.co.uk/210711.html;")
    aI("text=14th July 2011;url=http://www.newcastle-track.co.uk/140711.html;")
    aI("text=7th July 2011;url=http://www.newcastle-track.co.uk/070711.html;")
    aI("text=30th June 2011;url=http://www.newcastle-track.co.uk/300611.html;")
    aI("text=23rd June 2011;url=http://www.newcastle-track.co.uk/230611.html;")
    aI("text=16th June 2011;url=http://www.newcastle-track.co.uk/160611.html;")
    aI("text=9th June 2011;url=http://www.newcastle-track.co.uk/090611.html;")
    aI("text=2nd June 2011;url=http://www.newcastle-track.co.uk/020611.html;")
    aI("text=26th May RAIN;")
    aI("text=19th May 2011;url=http://www.newcastle-track.co.uk/190511.html;")
    aI("text=5th May 2011;url=http://www.newcastle-track.co.uk/050511.html;")
    aI("text=27th April 2011;url=http://www.newcastle-track.co.uk/270411.html;")
    }

with (milonic = new menuname("2b")) {
    margin = 0;
    itemheight = 25;
    itemwidth = 175;
    style = submenuStyle;
    aI("text=2nd September 2010 - Finale;url=http://www.newcastle-track.co.uk/020910.html;")
    aI("text=5th August 2010 - Week Fifteen;url=http://www.newcastle-track.co.uk/050810.html;")
    aI("text=29th July 2010 - Week Fourteen;url=http://www.newcastle-track.co.uk/290710.html;")
    aI("text=22nd July 2010 - Week Thirteen;url=http://www.newcastle-track.co.uk/220710.html;")
    aI("text=15th July 2010 - Week Twelve;url=http://www.newcastle-track.co.uk/220710.html;")
    aI("text=8th July 2010 - Week Eleven;url=http://www.newcastle-track.co.uk/080710.html;")
    aI("text=1st July 2010 - Week Ten;url=http://www.newcastle-track.co.uk/010710.html;")
    aI("text=24th June 2010 - Week Nine;url=http://www.newcastle-track.co.uk/240610.html;")
    aI("text=16th June 2010 - Week Eight;url=http://www.newcastle-track.co.uk/160610.html;")
    aI("text=10th June 2010 - Week Seven;url=http://www.newcastle-track.co.uk/100610.html;")
    aI("text=3rd June 2010 - Week Six;url=http://www.newcastle-track.co.uk/030610.html;")
    aI("text=27th May 2010 - Week Five;url=http://www.newcastle-track.co.uk/270510.html;")
    aI("text=20th May 2010 - Week Four;url=http://www.newcastle-track.co.uk/200510.html;")
    aI("text=13th May 2010 - Week Three;url=http://www.newcastle-track.co.uk/130510.html;")
    aI("text=6th May 2010 - Week Two;url=http://www.newcastle-track.co.uk/060510.html;")
    aI("text=Week One - Rain;")
}


with (milonic = new menuname("2a")) {
    margin = 0;
    itemheight = 25;
    itemwidth = 175;
    style = submenuStyle;
    aI("text=3rd September 2009 - Magnier Secures Overall;url=http://www.newcastle-track.co.uk/030909.html;")
    aI("text=23rd August 2009 - Magnier Closes on 4th;url=http://www.newcastle-track.co.uk/270809.html;")
    aI("text=20th August 2009 - All About Magnier;url=http://www.newcastle-track.co.uk/200809.html;")
    aI("text=12th August 2009 - Magnier Again!;url=http://www.newcastle-track.co.uk/120809.html;")
    aI("text=6th August 2009;url=http://www.newcastle-track.co.uk/060809.html;")
    aI("text=30th July 2009;url=http://www.newcastle-track.co.uk/300709.html;")
    aI("text=23rd July 2009;url=http://www.newcastle-track.co.uk/230709.html;")
    aI("text=2nd July 2009 - Magnier Dominates;url=http://www.newcastle-track.co.uk/020709.html;")
    aI("text=25th June 2009 - Rotherham Impresses;url=http://www.newcastle-track.co.uk/250609.html;")
    aI("text=18th June 2009 - Magnier Returns;url=http://www.newcastle-track.co.uk/180609.html;")
    aI("text=11th June 2009 - Byrne Extends Lead;url=http://www.newcastle-track.co.uk/110609.html;")
    aI("text=4th June 2009 - Notley Returns;url=http://www.newcastle-track.co.uk/040609.html;")
    aI("text=28th May 2009 - Byrne Back in Control;url=http://www.newcastle-track.co.uk/280509.html;")
    aI("text=21st May 2009 - Rotherham and Adgar Dominate;url=http://www.newcastle-track.co.uk/210509.html;")
    aI("text=14th May 2009 - Rain Cancels All but FreeWheelers;url=http://www.newcastle-track.co.uk/140509.html;")
    aI("text=7th May 2009 - Rotherham Comes of Age;url=http://www.newcastle-track.co.uk/070509.html;")
    aI("text=30th April 2009 - Bryne on Form;url=http://www.newcastle-track.co.uk/300409.html;")
}

with (milonic = new menuname("ic")) {
    margin = 0;
    itemheight = 25;
    itemwidth = 175;
    style = submenuStyle;
    aI("text=Rollers 2008 Report;url=http://www.newcastle-track.co.uk/ic-rollers08.html;")
    aI("text=Rollers 2008 Results;url=http://www.newcastle-track.co.uk/ic-rollers08.doc")
    aI("text=Track 2008 Results;url=http://www.newcastle-track.co.uk/ictrack08.xls;")
    aI("text=Rollers 2007 Results;url=http://www.newcastle-track.co.uk/ic-rollers07.html;")
}




with (milonic = new menuname("08Reports")) {
    margin = 0;
    itemheight = 25;
    itemwidth = 175;
    style = submenuStyle;
    aI("text=Sunday 8th September 2008;url=http://www.newcastle-track.co.uk/080908.html;")
    aI("text=Thurs 4th September 2008;url=http://www.newcastle-track.co.uk/040908.html;")
    aI("text=Thursday 21st August 2008;url=http://www.newcastle-track.co.uk/210808r.html;")
    aI("text=Thursday 14th August 2008;url=http://www.newcastle-track.co.uk/140808.html;")
    aI("text=Thursday 7th August 2008;url=http://www.newcastle-track.co.uk/070808.html;")
    aI("text=Thursday 24th July 2008;url=http://www.newcastle-track.co.uk/240708.html;")
    aI("text=Thursday 3rd July 2008;url=http://www.newcastle-track.co.uk/030708.html;")
    aI("text=Thursday 19th June 2008;url=http://www.newcastle-track.co.uk/190608.html;")
    aI("text=Thursday 12th June 2008;url=http://www.newcastle-track.co.uk/120608.html;")
    aI("text=Thursday 5th June 2008;url=http://www.newcastle-track.co.uk/050608.html;")
    aI("text=Thursday 29th May 2008;url=http://www.newcastle-track.co.uk/290508.html;")
    aI("text=Thursday 22nd May 2008;url=http://www.newcastle-track.co.uk/220508.html;")
    aI("text=Thursday 15th May 2008;url=http://www.newcastle-track.co.uk/150508.html;")
    aI("text=Thursday 8th May 2008;url=http://www.newcastle-track.co.uk/080508.html;")
    aI("text=Thursday 1st May 2008;url=http://www.newcastle-track.co.uk/010508.html;")
}

with (milonic = new menuname("08Results")) {
    margin = 0;
    itemheight = 25;
    itemwidth = 175;
    style = submenuStyle;
    aI("text=Sunday 8th September 2008;url=http://www.newcastle-track.co.uk/080908r.html;")
    aI("text=Thurs 4th September 2008;url=http://www.newcastle-track.co.uk/040908r.html;")
    aI("text=Thursday 21st August 2008;url=http://www.newcastle-track.co.uk/210808r.html;")
    aI("text=Thursday 14th August 2008;url=http://www.newcastle-track.co.uk/140808r.html;")
    aI("text=Thursday 7th August 2008;url=http://www.newcastle-track.co.uk/070808r.html;")
    aI("text=Thursday 24th July 2008;url=http://www.newcastle-track.co.uk/240708r.html;")
    aI("text=Thursday 3rd July 2008;url=http://www.newcastle-track.co.uk/030708r.html;")
    aI("text=Thursday 19th June 2008;url=http://www.newcastle-track.co.uk/190608r.html;")
    aI("text=Thursday 12th June 2008;url=http://www.newcastle-track.co.uk/120608r.html;")
    aI("text=Thursday 5th June 2008;url=http://www.newcastle-track.co.uk/050608r.html;")
    aI("text=Thursday 29th May 2008;url=http://www.newcastle-track.co.uk/290508r.html;")
    aI("text=Thursday 22nd May 2008;url=http://www.newcastle-track.co.uk/220508r.html;")
    aI("text=Thursday 15th May 2008;url=http://www.newcastle-track.co.uk/150508r.html;")
    aI("text=Thursday 8th May 2008;url=http://www.newcastle-track.co.uk/080508r.html;")
    aI("text=Thursday 1st May 2008;url=http://www.newcastle-track.co.uk/010508r.html;")
    aI("text=Archive Results;url=http://www.newcastle-track.co.uk/archive.html;")
}





drawMenus();


_mIms = new Array();
_mIms2 = new Array();

function _mPLF(i) {
    for (var x = 0; x < _mIms.length; x++) {
        if (i == _mIms[x]) return
        x++
    }
    _mIms[_mIms.length] = i
}

function mmPLIs(i, n) {
    if (n) {
        _mIms2[i] = new Image()
        if (_mIms[i]) _mIms2[i].src = _mIms[i]
    }

    if (!_mIms2[i].complete) {
        _StO("mmPLIs(" + (i) + ",0)", 5)
        return
    }

    if (i < _mIms.length) _StO("mmPLIs(" + (i + 1) + ",1)", 20)
}

function mmenuPreLoadImages() {
    for (var x = 0; x < _mi.length; x++) {
        var I = _mi[x]
        if (I[24]) _mPLF(I[24])
        if (I[29]) _mPLF(I[29])
        if (I[32]) _mPLF(I[32])
        if (I[46]) _mPLF(I[46])
        if (I[47]) _mPLF(I[47])
        if (I[48]) _mPLF(I[48])
        if (I[56]) _mPLF(I[56])
        if (I[69]) _mPLF(I[69])
        if (I[71]) _mPLF(I[71])
        if (I[73]) _mPLF(I[73])
        if (I[79]) _mPLF(I[79])
        if (I[82]) _mPLF(I[82])
        if (I[83]) _mPLF(I[83])
        if (I[85]) _mPLF(I[85])
        if (I[88]) _mPLF(I[88])
        if (I[90]) _mPLF(I[90])
        if (I[91]) _mPLF(I[91])
        if (I[92]) _mPLF(I[92])
    }
    mmPLIs(0, 1)
}

mmenuPreLoadImages()
//drawMenus()

/*****************************************************************************
Milonic DHTML Menu Keypress Module  keypress.js version 1.5 - April 13 2006
Used for accessibility of the menu. This module will allow the user to navigate Milonic menus via the keyboard.   
This module is only compatible with the Milonic DHTML Menu version 5.16 or higher
Copyright 2005 (c) Milonic Solutions Limited. All Rights Reserved.
This is a commercial software product, please visit http://www.milonic.com/ for more information.
*****************************************************************************/
function keyAction(_inc) {
    _itemRef += _inc
    _popi(_itemRef)
}

function getNextKeyItem() {
    _Kar = _KcM[0]
    _output = 0;
    for (_a = 0; _a < _Kar.length; _a++) {
        if (_Kar[_a] == _itemRef) _output = _Kar[_a + 1]
        //if(_output+" "=="undefined ")return _Kar[0]	//twv 9/12/06 comment out so null returns to switch menus	
    }
    return _output
}

function getPreKeyItem() {
    _Kar = _KcM[0]
    _output = 0;
    for (_a = 0; _a < _Kar.length; _a++) {
        if (_Kar[_a] == _itemRef) _output = _Kar[_a - 1]
        //if(_output+" "=="undefined ")return _Kar[_Kar.length-1]	 //twv 9/15/06 comment out so null returns to switch menus	
    }
    return _output
}

//not called on tab
function getKeyItem() {
    _KcM = _m[_mi[_itemRef][0]]; // this is the array of menu items for the current menu
    _KcI = _mi[_itemRef]
    //alert(_mi[_itemRef] + ':' + _m[_mi[_itemRef][0]])	
    if (jskey == 27) // Escape
    {
        closeAllMenus();
        return false;
    }

    if (_KcM[9]) // Horizontal
    {
        if (jskey == 37) _popi(getPreKeyItem()) // left

        /////////////////////////////////////////////////////////
        //JJ: On right arrow key stroke, detect if we're in
        //    the last item.  If we are then kill the menu and 
        //    move out of the bar.
        /////////////////////////////////////////////////////////
        //if(jskey==39)_popi(getNextKeyItem()) //right
        if (jskey == 39) {
            if (_itemRef == (_mi.length - 1)) {
                //We're on the last root menu item.
                _AClose();
                setAfterFlydownFocus();
            }
            else {
                //We're still in the menu, keep going.
                _popi(getNextKeyItem())
            }
        }

        if (jskey == 38 || KShift == 1 && jskey == 9) {
            _mn = getMenuByName(_mi[_itemRef][3])
            _popi(_m[_mn][0][_m[_mn][0].length - 1])

        }
        if (jskey == 40 || KShift == 0 && jskey == 9) // down
        {
            _mn = getMenuByName(_mi[_itemRef][3])
            _popi(_m[_mn][0][0])
        }
    }
    else       // Vertical
    {
        var i
        if (jskey == 38) _popi(getPreKeyItem()) // up
        if (jskey == 40 || jskey == 9) {
            //twv 9/15/06 put 'if' in to handle shift-tab
            if (KShift) {
                i = getPreKeyItem()
            } else {
                i = getNextKeyItem()
            }
            if (i == null) {
                // Test to see if we're in the last avialable menu item (other than the roots)
                // Possible TODO:  code a global with the root menu number value, or figure out 
                // how to determine it at run time, but hard coded for now as the requirement 
                // stated that the root # of menu items was immutable.
                if (_itemRef == _mi.length - 7) {
                    //If this is the last item in the menu, shift focus to the proper
                    //element of the page
                    //closeAllMenus();
                    _AClose();
                    //setLoadFocus();
                    setAfterFlydownFocus();
                }
                else {
                    //If this isn't the last item on the menu, contine onwards
                    if (_itemRef > -1) {
                        //_popi(getNextKeyItem())

                        //twv 9/15/06 put 'if' in to handle shift-tab
                        if (KShift) {
                            _mni = _itemRef
                            cnt = 0;
                            while (_mni != -1) {
                                if (_mni) _mni = getParentItemByItem(_mni); else _mni = -1
                                if (_mni > -1) _itemRef = _mni
                            }
                            _KcM = _m[_mi[_itemRef][0]];
                            i = getPreKeyItem()

                            //Iif item comes back null that it is the first item and shift focus up and out
                            if (i != null) {
                                _popi(i)
                            } else {
                                closeAllMenus();
                                KShift = 0;
                                KCntrl = 0;
                                //document.anchors(4).focus();
                                //document.links("AboutCiscoLink").focus();				                
                            }
                        } else {
                            _mni = _itemRef
                            cnt = 0;
                            while (_mni != -1) {
                                if (_mni) _mni = getParentItemByItem(_mni); else _mni = -1
                                if (_mni > -1) _itemRef = _mni
                            }
                            _KcM = _m[_mi[_itemRef][0]];
                            _popi(getNextKeyItem())
                        }
                    }
                }
            } else {
                _popi(i)
            }
        }
        //down
        if (jskey == 37) // left
        {
            //alert(_mi[_itemRef][3])
            if (_mi[_itemRef][3]) {
                _mn = getMenuByName(_mi[_itemRef][3])
                _popi(_m[_mn][0][_m[_mn][0].length - 1])
            }
            else {
                _itemRef = getParentItemByItem(_itemRef);
                _KcM = _m[_mi[_itemRef][0]];
                _popi(getPreKeyItem())
                _popi(getNextKeyItem())
                //_popi(_itemRef)
            }
        }
        if (jskey == 39) // right
        {
            if (_mi[_itemRef][3]) {
                _mn = getMenuByName(_mi[_itemRef][3])
                _popi(_m[_mn][0][0])
            }
            else {
                _mni = _itemRef
                cnt = 0;
                while (_mni != -1) {
                    if (_mni) _mni = getParentItemByItem(_mni); else _mni = -1
                    if (_mni > -1) _itemRef = _mni
                }
                _KcM = _m[_mi[_itemRef][0]];
                _popi(getNextKeyItem())
            }
        }
    }
}

//twv commented out
/*function getKeyItem()
{	
_KcM=_m[_mi[_itemRef][0]]; // this is the array of menu items for the current menu
_KcI=_mi[_itemRef]
	
if(jskey==27) // Escape
{
closeAllMenus();
return false;
}
	
if(_KcM[9]) // Horizontal
{	
if(jskey==37)_popi(getPreKeyItem()) // left
if(jskey==39)_popi(getNextKeyItem()) //right
		
if(jskey==38)
{
_mn=getMenuByName(_mi[_itemRef][3])
_popi(_m[_mn][0][_m[_mn][0].length-1])

}
if(jskey==40) // down
{
_mn=getMenuByName(_mi[_itemRef][3])
_popi(_m[_mn][0][0])
}		
}
else       // Vertical
{
if(jskey==38)_popi(getPreKeyItem()) // up
if(jskey==40)_popi(getNextKeyItem()) //down

if(jskey==37) // left
{
//alert(_mi[_itemRef][3])
if(_mi[_itemRef][3])
{
_mn=getMenuByName(_mi[_itemRef][3])
_popi(_m[_mn][0][_m[_mn][0].length-1])
}
else
{
_itemRef=getParentItemByItem(_itemRef);
_KcM=_m[_mi[_itemRef][0]];
_popi(getPreKeyItem())
_popi(getNextKeyItem())
//_popi(_itemRef)
}
}
if(jskey==39) // right
{
if(_mi[_itemRef][3])
{
_mn=getMenuByName(_mi[_itemRef][3])
_popi(_m[_mn][0][0])
}
else
{
_mni=_itemRef
cnt=0;
while(_mni!=-1)
{
if(_mni)_mni=getParentItemByItem(_mni); else _mni=-1
if(_mni>-1)_itemRef=_mni					
}
_KcM=_m[_mi[_itemRef][0]];
_popi(getNextKeyItem())
}
}
}
}*/

KPgChildren = "";
function KPcrawlChildren(_mn) {
    var _ar = _m[_mn][0]
    for (var _am = 0; _am < _ar.length; _am++) {
        KPgChildren += _ar[_am] + ",";
        if (_mi[_ar[_am]][3]) {
            KPcrawlChildren(getMenuByName(_mi[_ar[_am]][3]))
        }
    }
}

function getNextInRow() {
    for (_k = 0; _k < KPgChildren.length; _k++) {
        if (_itemRef == KPgChildren[_k]) {
            if (KPgChildren[_k + 1]) return KPgChildren[_k + 1]
        }
    }
}

function getPreInRow() {
    for (_k = 0; _k < KPgChildren.length; _k++) {
        if (_itemRef == KPgChildren[_k]) {
            if (KPgChildren[_k - 1]) return KPgChildren[_k - 1]
        }
    }
}
_Omo = _menuOpenDelay
_Cmo = _menuCloseDelay
_OiR = -1
KShift = 0
KCtrl = 0
//called on tab
function getMenuByKey(e) {
    if (_itemRef < 0) return
    if (KPgChildren.length != (_mi.length + 1)) {
        KPcrawlChildren(0)
        KPgChildren = KPgChildren.split(",");
    }
    _ofMT = 1
    _menuOpenDelay = 0
    _menuCloseDelay = 0

    if (ns6 || ns4) { jskey = e.which } else { jskey = event.keyCode }
    if (ns4) { jskey = String.fromCharCode(jskey).toUpperCase(); jskey = jskey.charCodeAt() }

    if (jskey == 16) KShift = 1
    if (jskey == 17) KCtrl = 1

    //if(KCtrl&&jskey==9)
    //{
    //if(_itemRef==-1)_itemRef=0
    //_itemRef=getPreInRow()
    //jskey=9
    //}		
    //alert(jskey)

    //twv commented out
    /*if(jskey==9) //this is the tab key
    {
    if(_itemRef<0)
    {
    return false;
    }
    else
    {
    if(KShift)
    {
    if(_itemRef>-1)
    {
    _itemRef=getPreInRow()
    }
    if(_itemRef==0)closeAllMenus()
    }
    else
    {
    _itemRef=getNextInRow()
    }
								
    if(_itemRef>-1)
    {
    _popi(_itemRef);
    _OiR=_itemRef
    }
    else
    {
    itemOff(_OiR)
    return true;
    }
    }
    }*/

    if (_itemRef == -1 || _itemRef + " " == $u) {
        _rsMD()
        return
    }
    if (_mi[_itemRef][34] == "form") {
        _rsMD()
        return
    }

    _cm3()
    getKeyItem()

    if (_itemRef == -1) {
        _rsMD()
        return
    }

    if (!ns4) {
        hrgm = gmobj("mmlink" + _mi[_itemRef][0])
        if (hrgm.style.visibility = "visible") hrgm.focus()
    }

    if (ie) {
        if (jskey == 13) hrgm.click()
        _rsMD()
        return false
    }
}

function gMBK(e) {
    if (ns6 || ns4) { jskey = e.which } else { jskey = event.keyCode }
    if (ns4) { jskey = String.fromCharCode(jskey).toUpperCase(); jskey = jskey.charCodeAt() }
    if (jskey == 13) return true
    if (_itemRef > -1) if (_mi[_itemRef][34] != "form") return false
}

function getMenuByKeyU(e) {
    if (_itemRef < 0) return
    if (ns6 || ns4) { jskey = e.which } else { jskey = event.keyCode }
    if (ns4) { jskey = String.fromCharCode(jskey).toUpperCase(); jskey = jskey.charCodeAt() }
    if (jskey == 16) KShift = 0
    if (jskey == 17) KCtrl = 0
    _rsMD()
}

function _rsMD() {
    _ofMT = 0
    _menuOpenDelay = _Omo
    _menuCloseDelay = _Cmo
}

function _iF0C(_i) {
    _popi(_i)
}

if (ns4) document.captureEvents(Event.KEYDOWN);
_d.onkeydown = getMenuByKey;
_d.onkeypress = gMBK;
_d.onkeyup = getMenuByKeyU;
