<!-- This Script Created by Jan Pijnacker: mailto:Jan_P@dds.nl -->
<!-- For this and 100s of other Free Javascripts, check out: -->
<!-- Free-Javascripts.com @ http://www.free-javascripts.com/ -->


// ************************************************************
//  First, some variables you can change as you like it
// ************************************************************

// Number of menus
menuMax=1
menus=new Array(menuMax)

// Declare the menus with the number of rows and columns
menus[1]=new Menu(1, 4)

// ************************************************************
// Second, specify the menu items
// ************************************************************

// Define the menu items as follows:
// ("text to display", "url or mailto", "frame name", "backgroundcolor", "text-color")
// See the jstextmenu.txt for more info on this variables

with (menus[1]) {
  items[1]=new Item("Home", "index.htm", "top", "#003399", "white")
  items[2]=new Item("Scouting history", "historyscout.htm", "", "#003399", "white")
  items[3]=new Item("Merit badges", "meritbadge.htm", "", "#003399", "white")
  items[4]=new Item("Photos", "photographs.htm", "", "#003399", "white")  
}

// ************************************************************
// The functions to get things going
// ************************************************************

// Define a menu object
function Menu(rowsMax, columnsMax) {
  this.rowsMax=rowsMax
  this.columnsMax=columnsMax
  this.items=new Array(rowsMax * columnsMax)
}

// Define a menu item
function Item(text, url, frame, backgroundColor, color) {
  this.text=text
  this.url=url
  this.frame=frame
  this.backgroundColor = backgroundColor
  this.color = color
}

// Returns a integer number between 1 and max that differs from the old one
function getNewRandomInteger(oldnumber, max) {
  var n = Math.floor(Math.random() * (max - 1) + 1)
  if (n >= oldnumber)
    n++
  return n
}

// Returns a integer number between 1 and max
function getRandomInteger(max) {
  var n = Math.floor(Math.random() * max + 1)
  return n
}

// Jump to the specified url in the specified frame
function GotoUrl(url, frame) {
  if (frame !=  "") {
    var s = eval("window." + frame)
    if (s !=  null)
      s.document.location.href = url
    else
      window.open(url, frame, "")
  }
  else
    window.location.href = url
}

function ItemClick(thisItem) {
  var obj = eval(menus[thisItem.menuNo].items[thisItem.cellNo])
  GotoUrl(obj.url, obj.frame)
}

function ItemMouseOver(thisItem) {
  var cellObj = eval(menus[thisItem.menuNo].items[thisItem.cellNo])
  var styleObj = eval('thisItem' + '.style')

  window.status = cellObj.url

  styleObj.color = cellObj.backgroundColor
  styleObj.backgroundColor = cellObj.color
}

function ItemMouseOut(thisItem) {
  var cellObj = eval(menus[thisItem.menuNo].items[thisItem.cellNo])
  var styleObj = eval('thisItem' + '.style')

  window.status = ""

  styleObj.color = cellObj.color
  styleObj.backgroundColor = cellObj.backgroundColor
}

// Show the menus
for (var menuNo = 1; menuNo <= menuMax; menuNo++) {
  with (document) {
    write("<table border='0' cellspacing='0' cellpadding='10'>")
    menuStyle = 'stMenuCell' + menuNo
    with (menus[menuNo]) {
      for (var rows=1; rows <= rowsMax; rows++) {
        write("<tr align='center'>") 
        for (var cols=1; cols <= columnsMax; cols++) {
          var cellNo=rows * cols
          var item=items[cellNo]
          if (document.all) {
            write("<td class=", menuStyle, " menuNo=", menuNo, " cellNo=", cellNo, " ")
            write("onMouseOver='ItemMouseOver(this)' onMouseOut='ItemMouseOut(this)' ")
            write("onClick='ItemClick(this)'>")
            write(item.text, "</td>")
          }
          else {
            write("<td class=", menuStyle, ">")
            write("<a class=", menuStyle, " href='", item.url, "'>", item.text, "</a></td>")
          }
        }
        write("</tr>")
      }
    }
    write("</table>")
    write("<br><br><br>")
  }
}
