  month = new Array()
    month[0]="January"; month[1]="February"; month[2]="March"; month[3]="April";
    month[4]="May"; month[5]="June"; month[6]="July"; month[7]="August"
    month[8]="September"; month[9]="October"; month[10]="November"; month[11]="December"

  day = new Array()
    day[0]="Sunday"; day[1]="Monday"; day[2]="Tuesday"; day[3]="Wednesday";
    day[4]="Thursday"; day[5]="Friday"; day[6]="Saturday"

  eventList = new Array (

    2011, 9, 24, "Chapter Picnic, 3 p.m., Gaithersburg City Hall Park",
    2011, 10, 18, "Member Meeting, 8 p.m., Program: <i>The Great Locomotive Chase</i>, the 1956 Disney film starring Fess Parker based on the 1862 Civil War incident in which Union soldiers steal a Confederate locomotive",
    2011, 11, 9, "Board Meeting, 8 p.m., Silver Spring B&O Station",
    2011, 11, 15, "Member Meeting, 8 p.m., Program: <i>Railroading Across the U.S.A.</i>, Bill Kalkman will present an interesting potpourri of his recent travels, including some local CSX and Norfolk Southern action, VIA Rail and Canadian National scenes, Union Pacific's Sherman Hill in Wyoming, Wisconsin Southern's E-unit powered passenger train, BNSF in the Columbia River Gorge, and Montana Rail Link.",
    2011, 12, 20, "Member Meeting, 7:30 p.m., <i>Holiday Social plus Pub Quiz</i>, After the social hour, a light-hearted quiz will test teams' knowledge of railroading, local history and other trivia.",
    2012, 1, 17, "Member Meeting, 8 p.m., Program: <i>History of Pennsy Electrification </i>, the commercially produced DVD describes the electrification of PPR’s main line between New York and Washington.  The program will include historical footage from the 1930s and scenes of Amtrak operations in the 1980s",
    2012, 2, 7, "Board Meeting, 8 p.m., Silver Spring B&O Station",
    2012, 2, 21, "Member Meeting, 8 p.m., Program: <i>Maine Two Foot Gauge Railroads</i>, a commercially produced DVD, presented by Bob Dixon-Gumm. The footage was recorded by Maine railfan Gus Pratt just before and as the railways were being dismantled.  If time permits, excerpts from <i>Ride the Sandy River Railroad</i> will be shown.",
    2012, 3, 20, "Member Meeting, 8 p.m., <i>special location</i>, Council Office Building auditorium, 100 Maryland Ave.<br>Program: <i>MARC Commuter Rail</i>, Dale Diacont will present a slide program covering MARC commuter service from 1984 to 2011.  Dale is a CSX engineer who hired on with the Seaboard Coast Line Railroad in 1971.",
    2012, 3, 31, "Chapter Banquet, 5 p.m., Amphora Restaurant, 1151 Elden Street, Herndon",
    2012, 4, 17, "Member Meeting, 8 p.m., Montgomery County Executive Office Building",
    2012, 5, 8, "Board Meeting, 8 p.m., Silver Spring B&O Station",
    2012, 5, 15, "Member Meeting, 8 p.m., Montgomery County Executive Office Building",
    2012, 6, 19, "Member Meeting, 8 p.m., Montgomery County Executive Office Building",
    2012, 7, 17, "Member Meeting, 8 p.m., Montgomery County Executive Office Building",
    2012, 8, 14, "Board Meeting, 8 p.m., Silver Spring B&O Station",
    2012, 8, 21, "Member Meeting, 8 p.m., Montgomery County Executive Office Building",
    2012, 9, 18, "Member Meeting, 8 p.m., Montgomery County Executive Office Building",
    2012, 10, 16, "Member Meeting, 8 p.m., Montgomery County Executive Office Building",
    2012, 11, 13, "Board Meeting, 8 p.m., Silver Spring B&O Station",
    2012, 11, 20, "Member Meeting, 8 p.m., Montgomery County Executive Office Building",
    2012, 12, 18, "Member Meeting, 8 p.m., Montgomery County Executive Office Building"
  ) 

  function showNextEvent(inDate) {   // Find & display next events in array
    day1 = new Date(1999,1,1)
    day2 = new Date(1999,1,8)
    weekValue = day2.valueOf() - day1.valueOf()
    numRows = eventList.length
    numWritten = 0 
    eventDate = new Date()
    for (i=0; i < numRows; i=i+4) {
      eventDate.setFullYear(eventList[i])
      eventDate.setMonth((eventList[i+1]-1))   
      eventDate.setDate(eventList[i+2])
      if (inDate <= eventDate && numWritten < 4) {
        if (inDate.valueOf() + weekValue > eventDate.valueOf()) {
          if (inDate.getDate() == eventDate.getDate()) {
            document.write("<strong>Today</strong>, ", eventList[i+3], "<br><br>")   //It's today!
          } 
          else {
            document.write("<strong>", day[eventDate.getDay()], " (", eventList[i+1], "/", eventList[i+2], ")", "</strong>, ", eventList[i+3], "<br><br>")  //Show day of week
          } 
        }
        else {
            document.write("<strong>", month[eventDate.getMonth()],
              " ", eventDate.getDate(), "</strong>, ", eventList[i+3], "<br><br>")  //Show full date
        }
        numWritten = numWritten + 1
      }
    }  //END FOR
    return 0
  }  //END FUNCTION

    tempDay = new Date()
    showNextEvent(tempDay)
