

  var linkbasename = 'http://www.safetybanners.org';
  //MM.form.elements[]
  function MenuManager (LVA,destination){
    /*************
    *   Here are the starting variables
    **************/
    this.BA = new Array();
    this.last = false;
    this.WC = null;
    this.currentobj = false;
    this.active = true;
    this.elarray = new Array();;
    /*************
    *   constructor
    **************/

      this.PL = function(elf,destination){
      var parentcontainer;
      var boxopen = '<table cellpadding="0" cellspacing="0" class="menu_parent" ><tr>';
      var boxclose = '</tr></table>';
      var assembly = '';
      //set the prename to find out if there are special rules for the menu
      var prename = '';
        if(parentcontainer = document.getElementById(destination)){
           for(MC=0;MC<elf.length;MC++){
           //prename =
           if(elf[MC][4] != ""){
           //preload images
           var P_Images = this.BA.length;
             this.BA[P_Images] = new Image();
             this.BA[P_Images].src = elf[MC][4];
           }
        //alert( elf[MC][7][0][0]);
            this.elarray[MC] = new Array();
           var heading = '';
           var body = '<div  id="menu_sub_'+MC+'" name="menu_sub_'+MC+'" class="'+elf[MC][7]+'" onmouseout="MM.Menu_React(this,event,'+MC+')" onmouseover="MM.Menu_React(this,event,'+MC+')" style="width:'+elf[MC][8]+'px;max-width:'+elf[MC][8]+'px;overflow:hidden;">';
           //alert(elf[MC][3]);
           var islink = (elf[MC][1] != "")? ' onclick="window.location = \''+linkbasename+elf[MC][1]+'\';" ':'' ;
           assembly += '<td class="'+elf[MC][2]+'" '+islink+'  style="'+elf[MC][3]+'border:0px solid #0000FF;" >';
           if(elf[MC][0] != ""){
               heading = '<span style="font-weight:bold;" onmouseout="MM.Menu_React(this.parentNode,event,'+MC+')" onmouseover="MM.Menu_React(this.parentNode,event,'+MC+')">'+elf[MC][0]+'</span>';
           }
           this.elarray[MC][0] = heading;
           this.elarray[MC][1] = (elf[MC][9].length > 0 && elf[MC][9][0][0] != "")? true:false ;;
           var action = (elf[MC][0] != "")? 'onmouseout="MM.Menu_React(this,event,'+MC+')" onmouseover="MM.Menu_React(this,event,'+MC+')"':'' ;
           heading = '<div class="'+elf[MC][6]+'" style="'+elf[MC][3]+'border:0px solid #0000FF;" '+action+' id="menu_opt_'+MC+'" name="menu_opt_'+MC+'"  >'+heading+'</div>';
           var W = 0;
           this.elarray[MC][5] = 0;
           //alert("pre"+this.elarray[MC][5] + "--" + elf[MC][0]);
           if(elf[MC][9].length > 0){
             for(W=0; W < elf[MC][9].length;W++){
               if(elf[MC][9][W][0] != "" && elf[MC][9][W][1] != ""){
               //var bottom_space = (W == (elf[MC][8].length - 1))? 'padding-bottom:15px;':'' ; this.parentNode.style.backgroundColor = \'#00FFFF\'; this.parentNode.style.backgroundColor = \'#FFFF66\';
                  body += '<div style="border-bottom:1px solid #CCCCCC;cursor:pointer;width:'+elf[MC][8]+'px;max-width:'+elf[MC][8]+'px;overflow:hidden;" onmouseover="MM.active = false;this.style.backgroundColor = \'#00FFFF\';"  onclick="window.location=\''+linkbasename+elf[MC][9][W][0]+'\';" onmouseout="MM.active = true;this.style.backgroundColor = \'#FFFF66\';"  ><a  onmouseover="MM.active = false;"  onmouseout="MM.active = true;" style="height:100%;width:100%;text-decoration:none;font-family:tahoma;font-size:10px;color: #282828;overflow: visible;" class="linkstyle_" href="'+linkbasename+elf[MC][9][W][0]+'">&nbsp;&nbsp;&nbsp;'+elf[MC][9][W][1]+'</a></div>';
                  this.elarray[MC][5]++;
               }
             }
             //make menu options taller based on two rows
             //this.elarray[MC][5] = (elf[MC][0] == 'View&nbsp;Banners&nbsp;by&nbsp;Category')? Math.round(this.elarray[MC][5] * 1.8):this.elarray[MC][5];
           }
           //alert("post"+this.elarray[MC][5] +"--"+this.elarray[MC][0] );
           //swap image
           this.elarray[MC][2] = elf[MC][4];
           //swapback image
           this.elarray[MC][3] = elf[MC][5];
           //just the head
           this.elarray[MC][4] = body+'</div>';
            if(elf[MC][7] != "")
                assembly += (heading + body + '</div></td>');
            if(elf[MC][7] == "")
                assembly += (heading + '</td>');
              }
              parentcontainer.innerHTML = (boxopen + assembly + boxclose);
           }
           //fill in the turqoise bar text
           var TQBar;
           if(TQBar = document.getElementById("report"))
            TQBar.innerHTML = Tag_Text;
        }
    /*************
    *   clear the menu
    **************/
        this.reporter = function(er){
          var reportShow;
          if(reportShow = document.getElementById("report"))
            reportShow.innerHTML = (reportShow.innerHTML + '<br />'+ er);
        }

    /*************
    *   get menu response
    **************/
        this.Menu_React = function(T,E,I){
            var curobj = E.toElement || E.target;
            var head1 = document.getElementById(('menu_opt_'+I));
            var menu1 = document.getElementById(("menu_sub_") + I);
            //this.reporter("targetname" + curobj.id + '--' + head1.id + '--' + E.type);
            if(E.type == "mouseover" && (head1) && (curobj.id == head1.id || curobj.id == menu1.id)){
              // this.reporter("IN" + curobj.id + '--' + head1.id + '--' + E.type+'-active = ' + this.active);
               this.SwapMenu(head1,I);
            }
            if(E.type == "mouseout" && (head1)){
               this.last = false;
               //this.reporter("OUT" + curobj.id + '--' + head1.id + '--' + E.type+'-active = ' + this.active);
               this.RollAction(I);
            }
        //alert("sadf");

        }
    /*************
    *   clear the menu
    **************/
    this.ClearMenu = function(I){
       for(op=0;op<this.elarray.length;op++){
             if(op != I)
                this.SwapBack(false,op);
           }
           this.last = I;
    }
    /*************
    *   start the menu image swap sequence and timer
    **************/
    this.SwapMenu = function(T,I){
      if(this.active){
         if(this.last != I){
         //if the last menu option is still loaded, kill it first
         this.ClearMenu(I);


         if(T){
           T.style.backgroundImage = 'url('+this.elarray[I][2]+')';
           //T.style.height = "25px";
           T.innerHTML = '&nbsp;';
           //T.parentNode.style.verticalAlign = "bottom";
           var menubody;
             if((menubody = document.getElementById(("menu_sub_") + I)) && this.elarray[I][1]){
                menubody.style.height = (this.elarray[I][5] * 17) + "px";
                menubody.style.width = "250px";
                menubody.style.zIndex = "5";
                menubody.style.display = "block";
                //alert("ok");
              }
            }

            window.clearTimeout(this.WC);
         }
         else{
            window.clearTimeout(this.WC);
            }
       }
    }
    /*************
    *   evaluate the action taken and where it goes
    **************/
    this.RollAction = function (I){
      if(this.active){
        this.RollClock(I,100);
      }
  }
    /*************
    *   call the keep menu open operation for passing ownership or timing out the presently selected menu heading
    **************/
   this.RollClock = function(I,Time){
     if(this.active){
   //if it is a swap in there will be an image
     var curobj = document.getElementById(('menu_opt_'+I));
     // alert(curobj);
        if(this.WC)
            window.clearTimeout(this.WC);
            if(this.last != I)
        this.WC = window.setTimeout("MM.SwapBack(false,"+I+")",Time);
     }
  }
    /*************
    *   close the menu if it is not hoverd over, or it's heading is not in focus
    **************/
  this.SwapBack = function (T,I,E){
    if(this.active){
      //if T is an oject modify it's content
      if(T){
         T.style.backgroundImage = 'url('+this.elarray[I][3]+')';
         T.innerHTML = this.elarray[I][0];
           //T.parentNode.style.verticalAlign = "bottom";
           var menubody;
           if(menubody = document.getElementById(("menu_sub_") + I))
            menubody.style.height = "0px";
            menubody.style.display = "none";
       }
       else{
        var TM;
        var BM;
        if(TM = document.getElementById(('menu_opt_'+I))){
           TM.style.backgroundImage = 'url('+this.elarray[I][3]+')';
           TM.innerHTML = this.elarray[I][0];
           //TM.parentNode.style.verticalAlign = "bottom";
           if(BM = document.getElementById(("menu_sub_" + I))){
             BM.style.height = "0px";
             BM.style.display = "none";
           }
        }
       }
     }
  }


   if(LVA)
        this.PL(LVA,destination);
  }
