/* All content copyright ©2004 - 2008 by Richard N. Holstein */


/* Arrays with pulldown menu choices. */
var aboutArray = new Array(
  "Organization/club_description.txt", "Who We Are",
  "membership.html",                   "Membership",
  "Publicity/brochure.doc",            "Club Brochure",
  "Organization/club-bylaws.html",     "Club Bylaws",
  //"Organization/BNMSC_Brochure_20061114.pdf", "Nordic Masters",
  "album.html",                        "Picture Gallery",
  "sponsors.html",                     "Sponsors &amp; Supporters",
  eddressNav("info", "bxcxc", "org", "?subject=Miscellaneous comments", "Webmaster e-mail"), null
)

var conditionsArray = new Array(
  "conditions.html",                   "Trail Conditions",
  "hut.html#hours",                    "Warming Hut Hours"
)

var facilitiesArray = new Array(
  "trails.html",                       "Trails",
  "trailsenh.html",                    "Large Scale Map",
  "images/bxcsctrails_one_page.gif",   "8-1/2 X 11 Map",
  "images/bxcsctrails_gray_scale.gif", "Greyscale Map",
  "hut.html",                          "Warming Hut",
  "trails.html#directions",            "Directions",
  "uc.html",                           "Parking"
)

var newArray = new Array(
  "uc.html",                           "Equipment",
  eddressNav("info", "bxcsc", "org", "?subject=Suggestions for new stuff", "Suggestions!"), null
)

var activitiesArray = new Array(
  "sched.html",                        "Schedule",
  "Meetings/agenda20080121.html",      "Meeting Agenda",
  "Meetings/minutes20080121.html",     "Meeting Minutes"
)

var linksArray = new Array(
  "links.html#associations",           "Associations",
  "links.html#commercial",             "Commercial Sites",
  "links.html#skiareas",               "Ski Areas"
)

//var saleArray = new Array(
//  "uc.html",                           "Club Patches", /* East Coast Embroidery, 375 Waterman Ave, E Providence, RI 02914, 401-434-9224 */
//  "uc.html",                           "Warming Hut Prints"
//)

var teamsArray = new Array(
  //"sched.html?manch",                            "Manch. HS schedule",
  "Teams/Policies_and_Procedures_2007-2008.doc", "Manch. HS P&P",
  "Teams/NHIAA_Policies_Skiing2007-08.pdf",      "NHIAA Policies",
  "Teams/BKL_flyer.png",                         "BKL flyer",
  "Teams/BKL_info.html",                         "Info for BKL"
)

/* The base from which we build our menus. */
var idArray = new Array(
/*  array            id              text  */
  aboutArray,      "about",      "About&nbsp;Us",
  conditionsArray, "conditions", "Conditions",
  facilitiesArray, "facilities", "Facilities",
  activitiesArray, "activities", "Activities",
  teamsArray,      "teams",      "Team&nbsp;Info"/*,
  newArray,        "new",        "New!"*/,
  linksArray,      "links",      "Links"/*,
  saleArray,       "sale",       "4&nbsp;Sale"*/
)


var paleBlue = "#9BC9E8", darkBlue= "#000066";

function showSub(theId) {
//alert(theId.offsetLeft+' '+theId.offsetWidth+' '+theId.offsetTop+' '+theId.offsetHeight+' '+window.screenX+' '+window.screenY);
  hideSub();
  var theTable = document.getElementById(theId.id + "_sub");
  theTable.style.visibility = "visible";
  theTable.style.display = "block";
} // End of function showSub


function hideSub() {
  var theId, theTable;
  for (var i = 0; i < idArray.length; i += 3) {
    theId = document.getElementById(idArray[i+1]);
    theTable = document.getElementById(theId.id + "_sub");
    theTable.style.visibility = "hidden";
    theTable.style.display = "none";
  }
} // End of function hideSub


function setBackgroundOver(tr) {
  setBackgroundOut(tr);
  tr.style.backgroundColor = paleBlue;
} // End of function setBackgroundOver


function setBackgroundOut(tr) {
  var theRows = tr.parentNode.parentNode.getElementsByTagName("tr");
  for (var j = 0; j < theRows.length; j++) {
    theRows[j].style.backgroundColor = darkBlue; // Mozilla workaround
  }
} // End of function setBackgroundOut


function generateNavMenu() {
  var s;
  s =  '<table border="1" cellspacing="0" cellpadding="0" width="100%" height="54">\n';
  s += '<tr align="left" valign="middle" class="nav">\n';
  s += '<td onmouseover="hideSub()">\n';
  s += '<br> <!-- extra cell to balance out the row -->\n';
  s += '</td>\n';
  s += '<td width="65" onmouseover="hideSub()">\n';
  s += '<div class="mainlisting" onmouseover="hideSub()">\n';
  s += '<a href="default.htm" target="_top" class="main"><img src="images/bxcscsnowflakelogosmall.gif" alt="Home" border="0" width="41" height="54"></a>\n';
  s += '</div>\n';
  s += '</td>\n';
  document.write(s);
  for (var i = 0; i < idArray.length; i += 3) {
    s =  '<td width="65" valign="middle">\n';
    s += '<div class="mainlisting" id="' + idArray[i+1] + '" onmouseover="showSub(this);" onmouseout="hideSub();">\n';
    s += idArray[i+2] + '\n';
    s += '<table class="sublisting" id="' + idArray[i+1] + '_sub" cellspacing="0" cellpadding="1" border="0">\n';
    thisArray = idArray[i];
    for (var j = 0; j < thisArray.length; j += 2) {
      s += '<tr class="tablesublisting" onmouseover="setBackgroundOver(this);" onmouseout="setBackgroundOut(this);">\n';
      s += '<td nowrap="nowrap">\n';
      s += (typeof thisArray[j+1] == 'object') ?
        thisArray[j] :
        '<a class="nav" href="' + thisArray[j] + '" target="_top">' + thisArray[j+1] + '</a>';
      s += '</td></tr>\n';
    }
    s += '</table>\n';
    s += '</div>\n';
    s += '</td>\n';
    document.write(s);
  }
  s =  '<td onmouseover="hideSub()">\n';
  s += '<br> <!-- extra cell to balance out the row -->\n';
  s += '</td>\n';
  s += '</tr>\n';
  s += '</table>\n';
  document.write(s);
  document.write('<div onmouseover="hideSub()">\n');
} // End of function generateNavMenu
