arrSubCat = new Array ();
arrLink = new Array ();
var boxheight = 22; // box height in pixels
function menujax (category, num) { // catCount: top row; num: "menuX" bottom row id
  arrLink.length = 0;
  if (!num) num = 8;
  for (var h = 1; h <= catCount; h ++) {
    document.getElementById('menu' + h).style.color = 'white';
  } // end for
  document.getElementById('menu' + num).style.color = 'yellow';
  switch (category) {
  case "Membership":
    arrSubCat = ["Newsletter", "Next Meeting", "Business After Hours", "Join Us", "Why you Should"];
    arrLink = ["newsletter.pdf' target='newWin", "meeting.pdf' target='newWin", "bah.pdf' target='newWin", "application.pdf' target='newWin", "whyjoin.php"];
    category = '';
    break;
  case "Dining and Night Life":
    arrSubCat = ["Restaurants", "Theaters", "Music", "Gaming", "Recreation"];
    break;
  case "Places to Stay":
    arrSubCat = ["Country Inns/B&Bs", "Hotels/Motels", "Campgrounds &amp; Cottages"];
    break;
  case "Services":
    arrSubCat = ["Move Here", "Education", "General Business Services"];
    break;
  case "Shopping":
    arrSubCat = ["Shops and Centers", "Antiquing", "Farmers Markets", "Art Galleries"];
    break;
  case "Sports":
    arrSubCat = ["Golfing", "Fishing", "Hunting", "Trails", "Biking", "Equestrian", "Athletics"];
    break;
  case "Things to Do":
    arrSubCat= ["Arts and Entertainment", "Museums and History", "Agritourism", "Family Fun", "Get Married"];
    break;
  default:
    arrSubCat = ["Latest Update", "County Map", "Links", "Mailing List", "Travel Guide"];
    arrLink = ["email/index.htm' target='newWin", "map.php", "link.php", "notify.php", "guide.php"];
  } // end switch
  if (!arrLink[0]) {
    var thisLink = '';
    for (i = 0; i < arrSubCat.length; i ++) {
      thisLink = arrSubCat[i].replace (/\s/g, "%20");
      thisLink = thisLink.replace (/\'/g, "%27");
      thisLink = thisLink.replace (/&/g, "%26");
      arrLink[i] = thisLink;
    } // end for
  } // end if
  displaySub (category);
} // end function

function displaySub (category) {
  if (category) {
    var poop = '';
    if (category == "Places to Stay") {
      arrSubCat.push ("Find a Room Quick", "Deals and Specials");
      arrLink.push ("request_acc.php", "overnight.php");
    } else if (category == "Things to Do") {
      poop = arrLink.pop();
      if (poop) arrLink.push ("weddings/index.php");
    } // end if
    var cat1 = category.replace (/\s/g, "%20");
    var cat2 = cat1.replace (/\'/g, "%27");
    var cat3 = cat2.replace (/&/g, "%26");
  } // end if
  var tcw = Math.floor (100 / arrSubCat.length);
  var tbl = document.getElementById('subMenu');
  if (tbl.hasChildNodes()) {
    kid = tbl.childNodes;
    for (x=0; x < kid.length; x++) {
      tbl.removeChild (kid[x]);
    } // end for
  } // end if
  var tblBody = document.createElement('tbody');
  var tblRow = document.createElement('tr');
  for (i = 0; i < arrSubCat.length; i ++) {
    var thisLink = category ? "showmem.php?category=" + cat3 + "&amp;subcat=" + arrLink[i] : arrLink[i];
    /****** special for 'Places to Stay' *******/
    if (thisLink.indexOf ("overnight.php") != -1) thisLink = "overnight.php";
    if (thisLink.indexOf ("request_acc.php") != -1) thisLink = "request_acc.php";
    /****** special for weddings subsite *******/
    if (thisLink.indexOf ("weddings/index.php") != -1) thisLink = "weddings/index.php";
    /**********************************************/
    var tblCell = document.createElement('td');
    tblCell.setAttribute ('onmouseover', 'this.style.backgroundColor="#f8f8ff"');
    tblCell.setAttribute ('onmouseout', 'this.style.backgroundColor=""');
    tblCell.innerHTML = "<a class='menu nine' href='" + thisLink + "'>" + arrSubCat[i] + "</a>";
    tblCell.style.width = tcw + '%';
    tblCell.style.height = boxheight + 'px';
    tblCell.style.textAlign = 'center';
    tblRow.appendChild (tblCell);
  } // end for
  tblBody.appendChild (tblRow);
  tbl.appendChild (tblBody);
} // end function