
function Menu ( id, cssClass, cssOverClass ) {
    this.overCSS = cssOverClass;

    this.id = Menu.register( this );

    this.cell = document.getElementById( id );
    this.cell.menuInst = this;
    this.cell.onmouseover = Menu.forwardCellEvent;
    this.cell.onmouseout = Menu.forwardCellEvent;

    this.menu = document.createElement( "SPAN" );
    document.body.appendChild( this.menu );
    this.menu.style.position = "absolute";
    this.menu.style.display = "none";

    var table = document.createElement( "TABLE" );
    this.menu.appendChild( table );
    table.cellSpacing = 0;
    table.cellPadding = 0;
    table.className = cssClass;

    this.tableBody = document.createElement( "TBODY" );
    table.appendChild( this.tableBody );
}

Menu.prototype.hideTimeout = null;
Menu.prototype.shown = false;

Menu.prototype.addItem = function ( text, url,color ) {
    var tr = document.createElement( "TR" );
    this.tableBody.appendChild( tr );
    var cell = document.createElement( "TD" );
    
    tr.appendChild( cell );
	
    cell.menuInst = this;
    cell.url = url;
    cell.innerHTML = "<nobr>" + text+"</nobr>";
/*
    cell.style.borderBottom = "1px solid #545B6D";
*/
    cell.style.padding = "4 4 4 4";
    cell.style.cursor = ns ? "pointer" : "hand";
    cell.backgroundColor = color;
    cell.onmouseover = Menu.forwardItemEvent;
    cell.onmouseout = Menu.forwardItemEvent;
    cell.onclick = Menu.forwardItemEvent;
}

Menu.prototype.showMenu = function () {
    var image = this.getImage();
    image.src = this.getImageURL( "on" );

    var topOffset = leftOffset = 0;

    var curParent = this.cell;
    while ( curParent ) {
        topOffset += curParent.offsetTop;
        leftOffset += curParent.offsetLeft;
        curParent = curParent.offsetParent;
    }

    this.menu.style.top = topOffset + this.cell.offsetHeight+11;
    this.menu.style.left = leftOffset;
    this.menu.style.display = "block";

    if ( !this.shown ) {
        Menu.closeAll();
        this.shown = true;
    }
}

Menu.prototype.getImage = function () {
    if ( this.cell.children ) return this.cell.children[ 0 ].children[ 0 ];
    var child = this.cell.childNodes[ 1 ];
    if ( child.childNodes[0].tagName == "IMG" ) return child.childNodes[ 0 ];
    return child.childNodes[ 1 ];
}

Menu.prototype.getImageURL = function ( status ) {
    var url = this.getImage().src;
//  return url.substr( 0, url.indexOf(this.cell.id) ) + this.cell.id + "-" + status + ".gif";
    return url;
}

Menu.prototype.hideMenu = function () {
    this.getImage().src = this.getImageURL( "off" );
    this.menu.style.display = "none";
    this.shown = false;
}

Menu.prototype.mouseoverCellHandler = function () {
    this.cancelHide();
    this.showMenu();
}

Menu.prototype.startHide = function () {
    this.cancelHide();
    this.hideTimeout = setTimeout( "Menu.insts[" + this.id + "].hideMenu()", 400 );
}

Menu.prototype.mouseoutCellHandler = Menu.prototype.startHide;

Menu.prototype.cancelHide = function () {
    if ( this.hideTimeout ) clearTimeout( this.hideTimeout );
}

Menu.prototype.clickItemHandler = function ( cell ) {
    document.location.href = cell.url;
}

Menu.prototype.mouseoverItemHandler = function ( cell ) {
    this.cancelHide();
    cell.className = this.overCSS;
}

Menu.prototype.mouseoutItemHandler = function ( cell ) {
    cell.className = "";
    this.startHide();
}

Menu.forwardCellEvent = function ( event ) {
    Menu.forwardEvent( event, "Cell" );
}

Menu.forwardItemEvent = function ( event ) {
    Menu.forwardEvent( event, "Item" );
}

Menu.forwardEvent = function ( event, type ) {
    if ( !event ) event = window.event;
    var curElement = event.srcElement || event.target;
    while ( curElement && curElement.tagName != "TD" )
        curElement = curElement.parentElement || curElement.parentNode;
    if ( !curElement ) return;
    curElement.menuInst[ event.type + type + "Handler" ]( curElement );
}

Menu.insts = [];

Menu.register = function ( inst ) {
    var id = Menu.insts.length;
    Menu.insts[ id ] = inst;
    return id;
}

Menu.closeAll = function () {
    for ( var i=0; i < Menu.insts.length; i++ ) {
        var inst = Menu.insts[ i ];
        if ( inst.shown ) inst.hideMenu();
    }
}

Menu.unavailable = document.layers || ( navigator.platform == "MacPPC" && this.name == "Microsoft Internet Explorer" );

var ns = ( navigator.appName == "Netscape" );
if ( ns ) {
    HTMLElement.prototype.__defineGetter__(
        "children",
        function () {
            var tmp = [];
            var j = 0;
            var n;
            for ( var i = 0; i < this.childNodes.length; i++ ) {
                n = this.childNodes[ i ];
                if ( n.nodeType == 1 ) {
                    tmp[ j++ ] = n;
                    if ( n.name ) {
                        if ( !tmp[n.name] )
                            tmp[n.name] = [];
                        tmp[ n.name ][ tmp[n.name].length ] = n;
                    }
                    if ( n.id ) tmp[ n.id ] = n;
                }
            }
            return tmp;
        }
    );
}




function Menu1 ( id, cssClass, cssOverClass ) {
    this.overCSS = cssOverClass;

    this.id = Menu1.register( this );

    this.cell = document.getElementById( id );
    this.cell.menuInst = this;
    this.cell.onmouseover = Menu1.forwardCellEvent;
    this.cell.onmouseout = Menu1.forwardCellEvent;

    this.menu = document.createElement( "SPAN" );
    document.body.appendChild( this.menu );
    this.menu.style.position = "absolute";
    this.menu.style.display = "none";

    var table = document.createElement( "TABLE" );
    this.menu.appendChild( table );
    table.cellSpacing = 0;
    table.cellPadding = 0;
    table.className = cssClass;

    this.tableBody = document.createElement( "TBODY" );
    table.appendChild( this.tableBody );
}

Menu1.prototype.hideTimeout = null;
Menu1.prototype.shown = false;

Menu1.prototype.addItem = function ( text, url ,color) {
    var tr = document.createElement( "TR" );
    this.tableBody.appendChild( tr );
    var cell = document.createElement( "TD" );
    tr.appendChild( cell );

    cell.menuInst = this;
    cell.url = url;
    cell.innerHTML = "" + text;
    cell.style.borderBottom = "1px solid #000000";
    cell.style.padding = "4 4 4 4";
    cell.style.cursor = ns ? "pointer" : "hand";
    cell.style.backgroundColor = color;
    cell.onmouseover = Menu1.forwardItemEvent;
    cell.onmouseout = Menu1.forwardItemEvent;
    cell.onclick = Menu1.forwardItemEvent;
}

Menu1.prototype.showMenu = function () {
    var image = this.getImage();
    image.src = this.getImageURL( "on" );

    var topOffset = leftOffset = 0;

    var curParent = this.cell;
    while ( curParent ) {
        topOffset += curParent.offsetTop;
        leftOffset += curParent.offsetLeft;
        curParent = curParent.offsetParent;
    }

    this.menu.style.top = topOffset + this.cell.offsetHeight - 40;
    this.menu.style.left = leftOffset + 179;
    this.menu.style.display = "block";

    if ( !this.shown ) {
        Menu1.closeAll();
        this.shown = true;
    }
}

Menu1.prototype.getImage = function () {
    if ( this.cell.children ) return this.cell.children[ 0 ].children[ 0 ];
    var child = this.cell.childNodes[ 1 ];
    if ( child.childNodes[0].tagName == "IMG" ) return child.childNodes[ 0 ];
    return child.childNodes[ 1 ];
}

Menu1.prototype.getImageURL = function ( status ) {
    var url = this.getImage().src;
//  return url.substr( 0, url.indexOf(this.cell.id) ) + this.cell.id + "-" + status + ".gif";
    return url;
}

Menu1.prototype.hideMenu = function () {
    this.getImage().src = this.getImageURL( "off" );
    this.menu.style.display = "none";
    this.shown = false;
}

Menu1.prototype.mouseoverCellHandler = function () {
    this.cancelHide();
    this.showMenu();
}

Menu1.prototype.startHide = function () {
    this.cancelHide();
    this.hideTimeout = setTimeout( "Menu1.insts[" + this.id + "].hideMenu()", 400 );
}

Menu1.prototype.mouseoutCellHandler = Menu1.prototype.startHide;

Menu1.prototype.cancelHide = function () {
    if ( this.hideTimeout ) clearTimeout( this.hideTimeout );
}

Menu1.prototype.clickItemHandler = function ( cell ) {
    document.location.href = cell.url;
}

Menu1.prototype.mouseoverItemHandler = function ( cell ) {
    this.cancelHide();
    cell.className = this.overCSS;
}

Menu1.prototype.mouseoutItemHandler = function ( cell ) {
    cell.className = "";
    this.startHide();
}

Menu1.forwardCellEvent = function ( event ) {
    Menu1.forwardEvent( event, "Cell" );
}

Menu1.forwardItemEvent = function ( event ) {
    Menu1.forwardEvent( event, "Item" );
}

Menu1.forwardEvent = function ( event, type ) {
    if ( !event ) event = window.event;
    var curElement = event.srcElement || event.target;
    while ( curElement && curElement.tagName != "TD" )
        curElement = curElement.parentElement || curElement.parentNode;
    if ( !curElement ) return;
    curElement.menuInst[ event.type + type + "Handler" ]( curElement );
}

Menu1.insts = [];

Menu1.register = function ( inst ) {
    var id = Menu1.insts.length;
    Menu1.insts[ id ] = inst;
    return id;
}

Menu1.closeAll = function () {
    for ( var i=0; i < Menu1.insts.length; i++ ) {
        var inst = Menu1.insts[ i ];
        if ( inst.shown ) inst.hideMenu();
    }
}

Menu1.unavailable = document.layers || ( navigator.platform == "MacPPC" && this.name == "Microsoft Internet Explorer" );

var ns = ( navigator.appName == "Netscape" );
if ( ns ) {
    HTMLElement.prototype.__defineGetter__(
        "children",
        function () {
            var tmp = [];
            var j = 0;
            var n;
            for ( var i = 0; i < this.childNodes.length; i++ ) {
                n = this.childNodes[ i ];
                if ( n.nodeType == 1 ) {
                    tmp[ j++ ] = n;
                    if ( n.name ) {
                        if ( !tmp[n.name] )
                            tmp[n.name] = [];
                        tmp[ n.name ][ tmp[n.name].length ] = n;
                    }
                    if ( n.id ) tmp[ n.id ] = n;
                }
            }
            return tmp;
        }
    );
}


function imgAct(imgName) {

    if (br == "n3") {
        document[imgName].src = eval(imgName + "on.src");
    }
}
function imgInact(imgName) {
    if (br == "n3") {
        document[imgName].src = eval(imgName + "off.src");
    }
}

  function swapOn(imgName) {
  document[ imgName ].src = imgName + "-on.gif";
  }
  function swapOff(imgName) {
  document[ imgName ].src = imgName + "-off.gif";
  }





// JavaScript Document


bName = navigator.appName; //detect for Netscape 3+ or IE 4+

bVer = parseInt(navigator.appVersion);

if ((bName == "Netscape" && bVer >= 3) ||

    (bName == "Microsoft Internet Explorer" && bVer >=4)) br = "n3";

else br = "n2";

// Create image button, preload all on and off images.

if (br== "n3") {

// On Mouse Index


}








