
   function menuItem(text, link){
      this.text = text;
      this.link = link;
   }
   function menuTrigger(name, text){
      this.name = name;
      this.text = text;
   }
   function menu(){
      var itemArray = new Array();
      var args = menu.arguments;
      this.name = args[0];
      this.classCSS = args[1];
      this.trigger = args[2];
      for(i=3; i<args.length; i++){
         itemArray[i-3] = args[i];
      }
      this.menuItems = itemArray;
      this.write = writeMenu;
      this.position = positionMenu;
   }
   function positionMenu(top,left,width){
      this.top = top;
      this.left = left;
      this.width = width;
   }
  function writeMenu(){
      var menuText = '<div id="';
      menuText += this.trigger.name;
      menuText += '" class="jsTrigger" style="top: ';
      menuText += this.top;
      menuText += '; left: ';
      menuText += this.left;
      menuText += ';"';
      menuText += 'onMouseOut="hideMenu(mnuSelected)"';
      menuText += 'onMouseOver="showMenu(\'';
      menuText += this.name;
      menuText += '\')">'
      onMouseOut='"hideMenu(mnuSelected)">';
      menuText += '<table border="0" width="' + this.width + '">';
      menuText += '<tr><td align="left"><a class="' + this.classCSS + '" href="">' + this.trigger.text + '</a></td></tr></table></div>';
      menuText += '<div id="';
      menuText += this.name;
      menuText += '" class="jsMenu" style="top: ';
      menuText += (this.top+5);
      menuText += ';left: ';
      menuText += (this.left+120);
      menuText += ';" ';
      menuText += 'onMouseOver="showMenu(mnuSelected)" ';
      menuText += 'onMouseOut="hideMenu(mnuSelected)">';
      menuText += '<table border="0" cellpadding="5" width="' + this.width + '">';
      for(i=0; i<this.menuItems.length; i++){
         menuText += '<tr>';
         menuText += '<td onmousemove="this.style.color=\'red\'">';
         menuText += '<a class="menu" href="' + this.menuItems[i].link + '">';
         menuText += this.menuItems[i].text + '</a></td>';
         menuText += '</tr>';
      }
      menuText += '</table></div>';
      document.write(menuText);
      document.close();
   }  
   var mnuSelected = '';
   function showMenu(menu){
      hideMenu(mnuSelected);
      document.getElementById(menu).style.visibility = 'visible';
      mnuSelected = menu;
   }
   function hideMenu(menu){
      if(mnuSelected!='')
         document.getElementById(menu).style.visibility = 'hidden';
   }
   

