  function menureset(ix) {
    parent.re = buttons[ix]; //define the "page" being loaded
    parent.entry = 1;        //set up as if initial entry, which prevents defn() resetting the above
    location = "zmenu.asp";  //now reload the menu
  }
  function menuset(ix) {     // version for external links
    parent.re = buttons[ix]; //define the "page" being loaded
    location = "zmenu.asp";  //now reload the menu
  }
  css = ["","","text-indent:14;","text-indent:20;font-weight:normal;"];

  function writebutton(ix, lev) {
    if (ix == targ ) {
      document.write("<TR><TD style="+css[lev]+">"+buttons[ix+1]+"</TR>");
      }
    else {
      document.write('<TR> <TD class=n'+lev+'> <A href='+buttons[ix+2]+' target=contentframe');
      if (buttons[ix].charAt(0) == "#" ) document.write(' onClick="menuset('+ix+')" ');
      if (buttons[ix+2].indexOf("#") > 0 ) document.write(' onClick="menureset('+ix+')" ');
      document.write('> ' +buttons[ix+1]+' </A> </TD> </TR>'); 
      }
    } // end function

// Search menu table for a match
// with the target, parent.re
// -----------------------------

  target = parent.re; // required page, button or keyword
  requeststring="";
  if (parent.nN=="") parent.nN = "7";
  if (parent.sD!="") requeststring += "?d=" + parent.sD + "&n=" + parent.nN;
  targ=0; // index of target match
  lev1=0; // index of level 1 container of match
  lev2=0; // index of level 2 container of match

  j=buttons.length-2;
  for (i=1 ; i<j ; i=i+4) {
    if (buttons[i-1] == 1) lev1=i;
    if (buttons[i-1] == 2) lev2=i;
    if (buttons[i] == target || buttons[i+1].toLowerCase() == target || buttons[i+2] == target ) {
      targ=i; // target found, load contents if initial entry
	if (parent.entry>0) parent.contentframe.location=buttons[targ+2] + requeststring;
      break;
      }
    }

// Match has been found - display buttons
// (else flags are zero and only
// top level menu will display)
// -----------------------------

  for (i=1 ; i<j ; i=i+4) {
    if (buttons[i-1] == 1) {
      writebutton (i,1);	/* always write level 1 buttons ...
	if this contains the target, set flag to show lev 2 buttons */
      show2 = (i == lev1) && targ>0;
      show3 = false;
      }
    if (buttons[i-1] == 2) {
      if (show2) writebutton(i,2); /* write level 2 buttons if flagged
	if this contains the target, set flag to show lev 3 buttons */
      show3 = (i == lev2) && show2;
      }
    if (buttons[i-1] == 3) if (show3) writebutton(i,3);
    }
  document.write("</table>");