buybtnReady = false;

// imgbuybtn = newImage('/images/buybtn.gif');
// imgbuybtndown = newImage('/images/buybtn_down.gif');

var lastItem;
var menuTimer;
scrollBarsize = 20;
overrideX = 122;

function NShilite(whichItem) {
  var whichMenu, parentItem, parentMenu;

  whichMenu = whichItem.substr(0,whichItem.lastIndexOf('-item'));
  if (whichMenu.indexOf('submenu') > 0) {
    parentItem = whichMenu.substr(0,whichMenu.lastIndexOf('-submenu'));
    parentMenu = parentItem.substr(0,parentItem.lastIndexOf('-item'));
  }

  if (lastItem) { // was an item already hilited?
    if (lastItem != parentItem) { // is the last item not the parent of the current item?
      lastMenu = lastItem.substr(0,lastItem.lastIndexOf('-item'));
      document.layers[lastMenu].document.layers[lastItem].bgColor = itemcolor; //turn off last item

      if (document.layers[lastItem + '-submenu']) { // does the last item have a submenu?
        NStoggleSubmenu(lastItem + '-submenu',0); // turn of the last item's submenu
      } else {
        if (lastMenu.indexOf('submenu') > 0) { // is the last item in a submenu?
          if (lastMenu != whichMenu) { // if the current item is not in the same submenu
            lastParentItem = lastMenu.substr(0,lastMenu.lastIndexOf('-submenu'));
            lastParentMenu = lastParentItem.substr(0,lastParentItem.lastIndexOf('-item'));
            NStoggleSubmenu(lastMenu,0);
            document.layers[lastParentMenu].document.layers[lastParentItem].bgColor = itemcolor; //turn off last parent item
          }
        }
      }
    }
  }

  document.layers[whichMenu].document.layers[whichItem].bgColor = hilitecolor;

  if (document.layers[whichItem + '-submenu']) { // does the current item have a submenu?
    NStoggleSubmenu(whichItem + '-submenu',1); // turn on the current item's submenu
  }

  lastItem = whichItem;
}

function NSnolite(whichItem) {
  whichMenu = whichItem.substr(0,whichItem.lastIndexOf('-item'));
  document.layers[whichMenu].document.layers[whichItem].bgColor = itemcolor;
}

function NStoggleSubmenu(whichMenu,toggle) {
  vis = "hidden";
  if (toggle) {
    vis = "inherit";

    parentItem = whichMenu.substr(0,whichMenu.lastIndexOf('-submenu'));
    parentItemNum = parentItem.charAt(parentItem.lastIndexOf('-item')+5);
    parentMenu = parentItem.substr(0,parentItem.lastIndexOf('-item'));
    menuX = document.layers[parentMenu].left + menuwidth - 2;
    menuY = document.layers[parentMenu].top + (parentItemNum * itemheight);
    if (menuX + document.layers[whichMenu].clip.right > window.innerWidth + window.pageXOffset - scrollBarsize) {
      menuX = menuX - document.layers[whichMenu].clip.right - menuwidth + 8;
    }
    if (menuY + document.layers[whichMenu].clip.bottom > window.innerHeight + window.pageYOffset - scrollBarsize) {
      menuY = menuY - document.layers[whichMenu].clip.bottom + itemheight + 5;
    }
    document.layers[whichMenu].moveTo(menuX,menuY);
  }

  if (document.layers[whichMenu].visibility != vis) {
    document.layers[whichMenu].visibility = vis;
  }
}

function IEhilite(whichItem) {
  var whichMenu, parentItem, parentMenu;

  whichMenu = whichItem.substr(0,whichItem.lastIndexOf('-item'));
  if (whichMenu.indexOf('submenu') > 0) {
    parentItem = whichMenu.substr(0,whichMenu.lastIndexOf('-submenu'));
    parentMenu = parentItem.substr(0,parentItem.lastIndexOf('-item'));
  }

  if(document.getElementById){
    if (lastItem) { // was an item already hilited?
      if (lastItem != parentItem) { // is the last item not the parent of the current item?
        lastMenu = lastItem.substr(0,lastItem.lastIndexOf('-item'));
        document.getElementById(lastItem).style.backgroundColor = itemcolor; //turn off last item

        if (document.getElementById(lastItem + '-submenu')) { // does the last item have a submenu?
          IEtoggleSubmenu(lastItem + '-submenu',0); // turn of the last item's submenu
        } else {
          if (lastMenu.indexOf('submenu') > 0) { // is the last item in a submenu?
            if (lastMenu != whichMenu) { // if the current item is not in the same submenu
              lastParentItem = lastMenu.substr(0,lastMenu.lastIndexOf('-submenu'));
              IEtoggleSubmenu(lastMenu,0);
              document.getElementById(lastParentItem).style.backgroundColor = itemcolor; //turn off last parent item
            }
          }
        }
      }
    }

    if (document.getElementById(whichItem).style.backgroundColor != hilitecolor) {
      document.getElementById(whichItem).style.backgroundColor = hilitecolor;
    }

    if (document.getElementById(whichItem + '-submenu')) { // does the current item have a submenu?
      IEtoggleSubmenu(whichItem + '-submenu',1); // turn on the current item's submenu
    }

  }else{
    if (lastItem) { // was an item already hilited?
      if (lastItem != parentItem) { // is the last item not the parent of the current item?
        lastMenu = lastItem.substr(0,lastItem.lastIndexOf('-item'));
        document.all.tags("DIV")[lastItem].style.backgroundColor = itemcolor; //turn off last item

        if (document.all.tags("DIV")[lastItem + '-submenu']) { // does the last item have a submenu?
          IEtoggleSubmenu(lastItem + '-submenu',0); // turn of the last item's submenu
        } else {
          if (lastMenu.indexOf('submenu') > 0) { // is the last item in a submenu?
            if (lastMenu != whichMenu) { // if the current item is not in the same submenu
              lastParentItem = lastMenu.substr(0,lastMenu.lastIndexOf('-submenu'));
              IEtoggleSubmenu(lastMenu,0);
              document.all.tags("DIV")[lastParentItem].style.backgroundColor = itemcolor; //turn off last parent item
            }
          }
        }
      }
    }

    if (document.all.tags("DIV")[whichItem].style.backgroundColor != hilitecolor) {
      document.all.tags("DIV")[whichItem].style.backgroundColor = hilitecolor;
    }

    if (document.all.tags("DIV")[whichItem + '-submenu']) { // does the current item have a submenu?
      IEtoggleSubmenu(whichItem + '-submenu',1); // turn on the current item's submenu
    }
  }

  lastItem = whichItem;
}


function IEnolite(whichItem) {
  if(document.getElementById)
    document.getElementById(whichItem).style.backgroundColor = itemcolor;
  else
    document.all.tags("DIV")[whichItem].style.backgroundColor = itemcolor;
}

function IEtoggleSubmenu(whichMenu,toggle) {
  vis = "hidden";

  if(document.getElementById){
    if (toggle) {
      vis = "inherit";

      parentItem = whichMenu.substr(0,whichMenu.lastIndexOf('-submenu'));
      parentItemNum = parentItem.charAt(parentItem.lastIndexOf('-item')+5);
      parentMenu = parentItem.substr(0,parentItem.lastIndexOf('-item'));
      parentMenuNum = parentMenu.charAt(4);

      menuX = document.getElementById(parentMenu).offsetLeft + menuwidth - 2;
      menuY = document.getElementById(parentMenu).offsetTop + (parentItemNum * itemheight);

      if (menuX + submenuwidth > document.body.scrollLeft + document.body.clientWidth - scrollBarsize) {
        menuX = menuX - submenuwidth - menuwidth + 8;
      }
      menuheight = menus[parentMenuNum]['items'][parentItemNum]['submenu'].length * itemheight + 5;
      if (menuY + menuheight > document.body.scrollTop + document.body.clientHeight - scrollBarsize) {
        menuY = menuY - menuheight + itemheight + 5;
      }

      document.getElementById(whichMenu).style.left = menuX;
      document.getElementById(whichMenu).style.top = menuY;
    }

    if (document.getElementById(whichMenu).style.visibility != vis) {
      document.getElementById(whichMenu).style.visibility = vis;
    }

  }else{
    if (toggle) {
      vis = "inherit";

      parentItem = whichMenu.substr(0,whichMenu.lastIndexOf('-submenu'));
      parentItemNum = parentItem.charAt(parentItem.lastIndexOf('-item')+5);
      parentMenu = parentItem.substr(0,parentItem.lastIndexOf('-item'));
      parentMenuNum = parentMenu.charAt(4);

      menuX = document.all.tags("DIV")[parentMenu].style.pixelLeft + menuwidth - 2;
      menuY = document.all.tags("DIV")[parentMenu].style.pixelTop + (parentItemNum * itemheight);

      if (menuX + submenuwidth > document.body.scrollLeft + document.body.clientWidth - scrollBarsize) {
        menuX = menuX - submenuwidth - menuwidth + 8;
      }
      menuheight = menus[parentMenuNum]['items'][parentItemNum]['submenu'].length * itemheight + 5;
      if (menuY + menuheight > document.body.scrollTop + document.body.clientHeight - scrollBarsize) {
        menuY = menuY - menuheight + itemheight + 5;
      }

      document.all.tags("DIV")[whichMenu].style.pixelLeft = menuX;
      document.all.tags("DIV")[whichMenu].style.pixelTop = menuY;
    }

    if (document.all.tags("DIV")[whichMenu].style.visibility != vis) {
      document.all.tags("DIV")[whichMenu].style.visibility = vis;
    }
  }
}


function toggleMenu(which,toggle,evt) {
  if (document.layers) {
    if (toggle && menus[which]['popped'] != true) {
      for (var x=0; x<menus.length; x++) {
        if (x != which) {
          toggleMenu(x,0);
        }
      }
      menus[which]['popped'] = true;
      if (document.images['btn' + which]) document.images['btn' + which].src = imgbuybtndown.src;
      if (overrideX > 0) {
        menuX = overrideX;
      } else {
        menuX = evt.pageX - 10;
      }
      menuY = evt.pageY + 1;
      if (menuX + document.layers['menu' + which].clip.right > window.innerWidth + window.pageXOffset - scrollBarsize) {
        menuX = menuX - document.layers['menu' + which].clip.right + 15;
      }
      if (menuY + document.layers['menu' + which].clip.bottom > window.innerHeight + window.pageYOffset - scrollBarsize) {
        menuY = menuY - document.layers['menu' + which].clip.bottom - 1;
      }
      document.layers['menu' + which].moveTo(menuX,menuY);
      document.layers['menu' + which].visibility = "visible";
    } else {
      menus[which]['popped'] = false;
      for (var i=0; i<menus[which]['items'].length; i++) {
        if (menus[which]['items'][i]['submenu'].length > 0) {
          for (var j=0; j<menus[which]['items'][i]['submenu'].length; j++) {
            NSnolite('menu' + which + '-item' + i + '-submenu-item' + j);
          }
          document.layers['menu' + which + '-item' + i + '-submenu'].visibility = "hidden";
        }
        NSnolite('menu' + which + '-item' + i);
      }
      document.layers['menu' + which].visibility = "hidden";
      if (document.images['btn' + which]) document.images['btn' + which].src = imgbuybtn.src;
    }

  } else if(document.getElementById){
    if (toggle && menus[which]['popped'] != true) {
      for (var x=0; x<menus.length; x++) {
        if (x != which) {
          toggleMenu(x,0);
        }
      }
      menus[which]['popped'] = true;
      if (document.images['btn' + which]) document.images['btn' + which].src = imgbuybtndown.src;
      if (overrideX > 0) {
        menuX = overrideX;
      } else {
        menuX = evt.clientX + document.body.scrollLeft - 10;
      }
      menuY = evt.clientY + document.body.scrollTop - 1;
      if (menuX + menuwidth > document.body.scrollLeft + document.body.clientWidth - scrollBarsize) {
        menuX = menuX - menuwidth + 15;
      }
      menuheight = menus[which]['items'].length * itemheight + 5;
      if (menuY + menuheight > document.body.scrollTop + document.body.clientHeight - scrollBarsize) {
        menuY = menuY - menuheight + 1;
      }
      document.getElementById('menu' + which).style.left = menuX;
      document.getElementById('menu' + which).style.top = menuY;
      document.getElementById('menu' + which).style.visibility = "visible";

    } else {
      menus[which]['popped'] = false;
      for (var i=0; i<menus[which]['items'].length; i++) {
        if (menus[which]['items'][i]['submenu'].length > 0) {
          for (var j=0; j<menus[which]['items'][i]['submenu'].length; j++) {
            IEnolite('menu' + which + '-item' + i + '-submenu-item' + j);
          }
          document.getElementById('menu' + which + '-item' + i + '-submenu').style.visibility = "hidden";
      }
          IEnolite('menu' + which + '-item' + i);
      }
      document.getElementById('menu' + which).style.visibility = "hidden";
      if (document.images['btn' + which]) document.images['btn' + which].src = imgbuybtn.src;
    }

  } else {
    if (toggle && menus[which]['popped'] != true) {
      for (var x=0; x<menus.length; x++) {
        if (x != which) {
          toggleMenu(x,0);
        }
      }
      menus[which]['popped'] = true;
      if (document.images['btn' + which]) document.images['btn' + which].src = imgbuybtndown.src;
      if (overrideX > 0) {
        menuX = overrideX;
      } else {
        menuX = evt.clientX + document.body.scrollLeft - 10;
      }
      menuY = evt.clientY + document.body.scrollTop - 1;
      if (menuX + menuwidth > document.body.scrollLeft + document.body.clientWidth - scrollBarsize) {
        menuX = menuX - menuwidth + 15;
      }
      menuheight = menus[which]['items'].length * itemheight + 5;
      if (menuY + menuheight > document.body.scrollTop + document.body.clientHeight - scrollBarsize) {
        menuY = menuY - menuheight + 1;
      }
      document.all.tags("DIV")['menu' + which].style.pixelLeft = menuX;
      document.all.tags("DIV")['menu' + which].style.pixelTop = menuY;
      document.all.tags("DIV")['menu' + which].style.visibility = "visible";
    } else {
      menus[which]['popped'] = false;
      for (var i=0; i<menus[which]['items'].length; i++) {
        if (menus[which]['items'][i]['submenu'].length > 0) {
          for (var j=0; j<menus[which]['items'][i]['submenu'].length; j++) {
            IEnolite('menu' + which + '-item' + i + '-submenu-item' + j);
          }
          document.all.tags("DIV")['menu' + which + '-item' + i + '-submenu'].style.visibility = "hidden";
      }
          IEnolite('menu' + which + '-item' + i);
      }
      document.all.tags("DIV")['menu' + which].style.visibility = "hidden";
      if (document.images['btn' + which]) document.images['btn' + which].src = imgbuybtn.src;
    }
  }
}

function placeMenu(which,toggle,evt,orx) {
  overrideX = orx;
  toggleMenu(which,toggle,evt);
}

function doLink(m,i,d) {
  if (d > -1 ) {
    theURL = menus[m]['items'][i]['submenu'][d]['url'];
  } else {
    theURL = menus[m]['items'][i]['url'];
  }

  // need to make the URL unique to counteract IE5's hyperactive caching mechanism
  // adding a date stamp in milliseconds to achieve this
  ie5date = new Date();
  ie5stamp = ie5date.getTime();
  theURL += "?zz=" + ie5stamp;

  //close the menu for feedback that a selection has been made
  toggleMenu(m,0);

  top.document.location = theURL;
}

function doBlur(that) {
  if (document.all || document.getElementById) that.blur();
}

function setmenuTimer(which) {
  if (menus[which]['popped']) menuTimer = setTimeout("toggleMenu('" + which + "',0)",2000); //this last number controls how long (in milliseconds) the menu will wait onmouseout before disappearing
}

function journal(msg) {
  if (document.journalform) {
    //document.journalform.journalfield.value += msg + "\r";
  }
}

itemheight = 20;

menuleftmargin = 8;
menurightmargin = 7;
arrowwidth = 20;
menulabelwidth = 150;
menuwidth = menuleftmargin + menulabelwidth + arrowwidth;

submenulabelwidth = 120;
submenuwidth = menuleftmargin + submenulabelwidth + menurightmargin;

itemcolor = "#FFFFCC";
hilitecolor = "#FFCC66";

for (var m=0; m<menus.length; m++) {
  if (document.layers) {
    //netscape version
    //main menu
    menuheight = menus[m]['items'].length * itemheight;
    document.writeln('<LAYER LEFT=0 TOP=0 NAME="menu' + m + '" VISIBILITY="hidden" ONMOUSEOVER="clearTimeout(menuTimer);" ONMOUSEOUT="setmenuTimer(\'' + m + '\');">');
    document.writeln('<LAYER LEFT=2 TOP=2 BGCOLOR="#999999" WIDTH=' + (menuwidth + 3) + ' HEIGHT=' + (menuheight + 3) + ' NAME="shadow"></LAYER>');
    document.writeln('<LAYER LEFT=0 TOP=0 BGCOLOR="#000000" WIDTH=' + (menuwidth + 4) + ' HEIGHT=' + (menuheight + 4) + ' NAME="outline"></LAYER>');
    document.writeln('<LAYER LEFT=1 TOP=1 BGCOLOR="#999999" WIDTH=' + (menuwidth + 2) + ' HEIGHT=' + (menuheight + 2) + ' NAME="lowerright"></LAYER>');
    document.writeln('<LAYER LEFT=1 TOP=1 BGCOLOR="#FFFFFF" WIDTH=' + (menuwidth + 1) + ' HEIGHT=' + (menuheight + 1) + ' NAME="upperleft"></LAYER>');

    //items in main menu
    for (var i=0; i<menus[m]['items'].length; i++) {
      label = menus[m]['items'][i]['txt'];
      if (menus[m]['items'][i]['submenu'].length > 0) {
        arrowishness = '<IMG SRC="/images/dhtmlmenuarrowright.gif" WIDTH=20 HEIGHT=18 BORDER=0>'
      } else {
        arrowishness = '<spacer height=1 width=1 type=block>'
      }
      document.writeln('<LAYER NAME="menu' + m + '-item' + i + '" LEFT=2 TOP=' + (itemheight * i + 2) + ' BGCOLOR="' + itemcolor + '" WIDTH=' + menuwidth + ' HEIGHT=' + itemheight + ' ONMOUSEOVER="NShilite(this.name);"  ONFOCUS="doLink(' + m + ',' + i + ',-1)">');
      document.writeln('<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=' + menuwidth + '><TR><TD WIDTH=' + menuleftmargin + '></TD><TD WIDTH=' + menulabelwidth + ' HEIGHT=18 CLASS="menuitem">' + label + '</A></TD><TD WIDTH=20 VALIGN=TOP>' + arrowishness + '</TD></TR></TABLE></LAYER>');
    }
    document.writeln('</LAYER>');

    //submenus for each item
    for (var i=0; i<menus[m]['items'].length; i++) {
      if (menus[m]['items'][i]['submenu'].length > 0) {
        menuheight = menus[m]['items'][i]['submenu'].length * itemheight;
        document.writeln('<LAYER LEFT=118 TOP=' + (itemheight * i) + ' NAME="menu' + m + '-item' + i + '-submenu" VISIBILITY="hidden" ONMOUSEOVER="clearTimeout(menuTimer);" ONMOUSEOUT="setmenuTimer(\'' + m + '\');">');
        document.writeln('<LAYER LEFT=2 TOP=2 BGCOLOR="#999999" WIDTH=' + (submenuwidth + 3) + ' HEIGHT=' + (menuheight + 3) + ' NAME="shadow"></LAYER>');
        document.writeln('<LAYER LEFT=0 TOP=0 BGCOLOR="#000000" WIDTH=' + (submenuwidth + 4) + ' HEIGHT=' + (menuheight + 4) + ' NAME="outline"></LAYER>');
        document.writeln('<LAYER LEFT=1 TOP=1 BGCOLOR="#999999" WIDTH=' + (submenuwidth + 2) + ' HEIGHT=' + (menuheight + 2) + ' NAME="lowerright"></LAYER>');
        document.writeln('<LAYER LEFT=1 TOP=1 BGCOLOR="#FFFFFF" WIDTH=' + (submenuwidth + 1) + ' HEIGHT=' + (menuheight + 1) + ' NAME="upperleft"></LAYER>');

        //items in submenu
        for (var d=0; d<menus[m]['items'][i]['submenu'].length; d++) {
          document.writeln('<LAYER NAME="menu' + m + '-item' + i + '-submenu-item' + d + '" LEFT=2 TOP=' + (itemheight * d + 2) + ' BGCOLOR="' + itemcolor + '" WIDTH=' + submenuwidth + ' HEIGHT=' + itemheight + ' ONMOUSEOVER="NShilite(this.name);" ONMOUSEOUT="NSnolite(this.name);" ONFOCUS="doLink(' + m + ',' + i + ',' + d + ')">');
          document.writeln('<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=' + submenuwidth + '><TR><TD WIDTH=' + menuleftmargin + '></TD><TD WIDTH=' + submenulabelwidth + ' HEIGHT=18 CLASS="menuitem">' + menus[m]['items'][i]['submenu'][d]['txt'] + '</A></TD><TD WIDTH=' + menurightmargin + ' NOWRAP></TD></TR></TABLE></LAYER>');
        }
        document.writeln('</LAYER>');
      }
    }

  } else {
    //explorer version
    //main menu
    menuheight = menus[m]['items'].length * itemheight;
    document.writeln('<DIV ID="menu' + m + '" STYLE="position:absolute; left:52; top:118; width:' + (menuwidth + 5) + '; height:' + (menuheight + 5) + '; visibility:hidden;" ONMOUSEOVER="clearTimeout(menuTimer);" ONMOUSEOUT="setmenuTimer(\'' + m + '\');">');
    document.writeln('<DIV STYLE="position:absolute; left:2; top:2; width:' + (menuwidth + 3) + '; height:' + (menuheight + 3) + '; background-color:#999999;" NAME="shadow"></DIV>');
    document.writeln('<DIV STYLE="position:absolute; left:0; top:0; width:' + (menuwidth + 4) + '; height:' + (menuheight + 4) + '; background-color:#000000;" NAME="outline"></DIV>');
    document.writeln('<DIV STYLE="position:absolute; left:1; top:1; width:' + (menuwidth + 2) + '; height:' + (menuheight + 2) + '; background-color:#999999;" NAME="lowerright"></DIV>');
    document.writeln('<DIV STYLE="position:absolute; left:1; top:1; width:' + (menuwidth + 1) + '; height:' + (menuheight + 1) + '; background-color:#FFFFFF;" NAME="upperleft"></DIV>');

    //items in main menu
    for (var i=0; i<menus[m]['items'].length; i++) {
      label = menus[m]['items'][i]['txt'];
      if (menus[m]['items'][i]['submenu'].length > 0) {
        arrowishness = '<IMG SRC="/images/dhtmlmenuarrowright.gif" WIDTH=20 HEIGHT=18 BORDER=0>'
      } else {
        arrowishness = '<spacer height=1 width=1 type=block>'
      }
      document.writeln('<DIV ID="menu' + m + '-item' + i + '" STYLE="position:absolute; left:2; top:' + (itemheight * i + 2) + '; width:' + menuwidth + '; height:' + itemheight + '; background-color:' + itemcolor + ';" ONMOUSEOVER="IEhilite(this.id);" ONCLICK="doLink(' + m + ',' + i + ',-1)">');
      document.writeln('<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=' + menuwidth + '><TR><TD WIDTH=' + menuleftmargin + '></TD><TD WIDTH=' + menulabelwidth + ' HEIGHT=19 CLASS="menuitem">' + label + '</A></TD><TD WIDTH=20 VALIGN=TOP>' + arrowishness + '</TD></TR></TABLE></DIV>');
    }
    document.writeln('</DIV>');

    //submenus for each item
    for (var i=0; i<menus[m]['items'].length; i++) {
      if (menus[m]['items'][i]['submenu'].length > 0) {
        menuheight = menus[m]['items'][i]['submenu'].length * itemheight;
        document.writeln('<DIV ID="menu' + m + '-item' + i + '-submenu" STYLE="position:absolute; left:118; top:' + (itemheight * i) + '; width:' + (submenuwidth + 5) + '; height:' + (menuheight + 5) + '; visibility:hidden;" ONMOUSEOVER="clearTimeout(menuTimer);" ONMOUSEOUT="setmenuTimer(\'' + m + '\');">');
        document.writeln('<DIV STYLE="position:absolute; left:2; top:2; width:' + (submenuwidth + 3) + '; height:' + (menuheight + 3) + '; background-color:#999999;" NAME="shadow"></DIV>');
        document.writeln('<DIV STYLE="position:absolute; left:0; top:0; width:' + (submenuwidth + 4) + '; height:' + (menuheight + 4) + '; background-color:#000000;" NAME="outline"></DIV>');
        document.writeln('<DIV STYLE="position:absolute; left:1; top:1; width:' + (submenuwidth + 2) + '; height:' + (menuheight + 2) + '; background-color:#999999;" NAME="lowerright"></DIV>');
        document.writeln('<DIV STYLE="position:absolute; left:1; top:1; width:' + (submenuwidth + 1) + '; height:' + (menuheight + 1) + '; background-color:#FFFFFF;" NAME="upperleft"></DIV>');

        //items in submenu
        for (var d=0; d<menus[m]['items'][i]['submenu'].length; d++) {
          document.writeln('<DIV ID="menu' + m + '-item' + i + '-submenu-item' + d + '" STYLE="position:absolute; left:2; top:' + (itemheight * d + 2) + '; width:' + submenuwidth + '; height:' + itemheight + '; background-color:' + itemcolor + ';" ONMOUSEOVER="IEhilite(this.id);" ONMOUSEOUT="IEnolite(this.id);" ONCLICK="doLink(' + m + ',' + i + ',' + d + ')">');
          document.writeln('<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=' + submenuwidth + '><TR><TD WIDTH=' + menuleftmargin + '></TD><TD WIDTH=' + submenulabelwidth + ' HEIGHT=19 CLASS="menuitem">' + menus[m]['items'][i]['submenu'][d]['txt'] + '</A></TD><TD WIDTH=' + menurightmargin + ' NOWRAP></TD></TR></TABLE></DIV>');
        }
      document.writeln('</DIV>');
      }
    }
  }
}

buybtnReady = true;
