<!-- // Hide the script

/*
 * eventcheck.js
 *
 * Checks the date and prints important events corresponding with those dates
 * Michael Lieberman, 2001
 *
 * Date::getYear() fix
 */

// Constants
var MAX_ELEM   = 500; // The maximum number of events that the array can hold
var START_TIME = 0;   // The time to begin displaying events (24hr)
var END_TIME   = 24;  // The time to stop displaying events  (24hr)

var now = new Date();
if(now.getHours() >= START_TIME && now.getHours() < END_TIME)
{

/* Events is the two dimensional array holding the dates and events.
 * For any given i (under MAX_ELEM):
 *   Events[i][0] is the starting date string
 *   Events[i][1] is the ending date string
 *   Events[i][2] is the event string
 */
var Events = new Array(MAX_ELEM);

// "@" will be the string to flag the end of the filled portion of Events
for(i=0; i<MAX_ELEM; i++)
{
   Events[i] = new Array(3);
   Events[i][0] = "@";
   Events[i][1] = "@";
   Events[i][2] = "@";
}

/* Manually fill in the dates / events.  I wanted to read from a text file
 *   but Javascript would not allow me...
 *
 * To add a new event, add three lines.  Examples:
 *   Events[0][0] = '10/31/2001';
 *   Events[0][1] = '10/31/2001';
 *   Events[0][2] = 'Halloween';
 *
 *   Events[1][0] = '1/1/2002';
 *   Events[1][1] = '1/8/2002';
 *   Events[1][2] = 'Celebration for a week';
 *
 * Time the event will be displayed:  Starting on Events[n][0],
 *                                    Ending at the end of the day Events[n][1]
 *
 * The event name can also have HTML tags.
 * The order in which events are entered does not matter.  The events will be
 *   displayed on the page (if the date is in the valid range) in whatever
 *   order they are in in the array.
 */


Events[1][0]    = '8/30/2011';
Events[1][1]    = '9/4/2011';
Events[1][2]    = '9/5 - School Closed for Labor Day';

Events[3][0]    = '8/30/2011';
Events[3][1]    = '9/11/2011';
Events[3][2]    = '9/12 - <a href="orgs/ptsa/guidance/frmtgsept.html">Freshman Parent Meeting</a><br>7:30 p.m. WJ Cafeteria';

Events[4][0]    = '9/23/2011';
Events[4][1]    = '9/29/2011';
Events[4][2]    = '9/29 - School Closed for Rosh Hashanah';
/*
Events[6][0]    = '9/8/2010';
Events[6][1]    = '9/14/2010';
Events[6][2]    = '9/14 - School Closed for Primary Election';

Events[5][0]   = '9/22/2009';
Events[5][1]   = '9/28/2009';
Events[5][2]   = '9/28 - School Closed for Yom Kippur';
*/
Events[6][0]    = '9/26/2011';
Events[6][1]    = '10/4/2011';
Events[6][2]    = '10/4 - WJ Cluster<br>Rising 9th Grade Parent/Student Orientation<br>7:00 p.m. - WJ Auditorium - ' +
                  '<a href="information/letters/rising9th_orientation.pdf">Ms. Baker\'s Letter</a> | <a href="information/rising_9th_meeting.shtm">Agenda</a>';

Events[10][0]    = '10/5/2011';
Events[10][1]    = '10/11/2011';
Events[10][2]    = '10/11 - APEX 8th Grade Parent/Student Info Night, 7:00 p.m. - WJ Cafeteria';

Events[11][0]    = '10/1/2011';
Events[11][1]    = '10/11/2011';
Events[11][2]    = '10/12 - PSAT Test at WJ - <a href="information/psat/psat_letter.pdf">Ms. Baker\'s Letter</a><br>' +
                   '<a href="information/psat/room_assignments.pdf">Room Assignments</a> | <a href="information/psat/">WJ PSAT Information</a>';
/*
Events[12][0]    = '10/4/2011';
Events[12][1]    = '10/22/2011';
Events[12][2]    = '<a href="orgs/sga/homecoming.shtm">Homecoming 2011 Events - 10/17 - 10/22</a>' + 
                   '<br><a href="orgs/sga/homecoming.shtm">Dance Tickets ARE SOLD OUT!<!--Sales Now In Progress--><!-- begin 10/10--></a>';
*/
Events[12][0]    = '10/4/2011';
Events[12][1]    = '10/22/2011';
Events[12][2]    = '<a href="orgs/sga/homecoming.shtm">Homecoming 2011 Events - 10/17 - 10/22</a>'; 
//                   '<br>Thursday is Dress as Hall Theme Day!';

Events[13][0]    = '10/15/2011';
Events[13][1]    = '10/21/2011';
Events[13][2]    = '10/21 - School Closed for MD Teacher Conf'; 

Events[14][0]    = '10/25/2011';
Events[14][1]    = '10/30/2011';
Events[14][2]    = '10/31 School Closed - Report Card Prep';
/*
Events[15][0]    = '10/29/2008';
Events[15][1]    = '11/4/2008';
Events[15][2]    = '11/4 School Closed for General Election';
*/
Events[18][0]    = '11/24/2011';
Events[18][1]    = '11/25/2011';
Events[18][2]    = '11/24-25 School Closed-Happy Thanksgiving';

Events[19][0]    = '11/25/2011';
Events[19][1]    = '11/25/2011';
Events[19][2]    = '11/25 School Closed-Thanksgiving Break';

Events[23][0]    = '12/28/2011';
Events[23][1]    = '1/4/2012';
Events[23][2]    = '1/4 - Course Registration Info Meeting, 7:00 p.m. - Auditorium<br>' +
                   '<a href="information/letters/registration.pdf">Read Ms. Baker\'s Letter</a><br>' +
                   '<a href="studserve/coursebook/">Click Here for the Online Coursebook</a>';


Events[24][0]    = '1/10/2012';
Events[24][1]    = '1/16/2012';
Events[24][2]    = '1/16 - School Closed-ML King Day';

Events[25][0]    = '1/17/2012';
Events[25][1]    = '1/23/2012';
Events[25][2]    = '1/23 School Closed - Report Card Prep';

Events[28][0]    = '1/20/2012';
Events[28][1]    = '2/2/2012';
Events[28][2]    = '2/2 - Back-to-School Night<br>7:00 p.m. in Child\'s 1st Period Class<br>' +
                  '<font size="-1"><a href="information/btsn2.shtm">Click here for more information, including a school map</a></font>'; 

Events[30][0]    = '2/14/2012';
Events[30][1]    = '2/20/2012';
Events[30][2]    = '2/20 - School Closed-Presidents Day';

Events[32][0]    = '3/24/2012';
Events[32][1]    = '3/30/2012';
Events[32][2]    = '3/30 School Closed - Report Card Prep';

Events[33][0]    = '3/27/2012';
Events[33][1]    = '4/9/2012';
Events[33][2]    = '4/2-4/9 - Spring Break - Classes Resume 4/10';

Events[34][0]    = '5/19/2012';
Events[34][1]    = '5/25/2012';
Events[34][2]    = '5/25 - Last Day of School for Seniors'; 
                   
Events[35][0]    = '5/22/2012';
Events[35][1]    = '5/28/2012';
Events[35][2]    = '5/28 - School Closed-Memorial Day';

Events[40][0]    = '6/15/2012';
Events[40][1]    = '6/21/2012';
Events[40][2]    = '6/21 - Report Cards Mailed';

i = 0;

// The locations of the slashes in the date
var AFSlash, ALSlash, BFSlash, BLSlash;

// Starting date / ending date strings -- used for comparison
var sdate = "", edate = ""; writestring = "";
var cdate, wrote1 = 0;

    /* The Netscape and IE versions of Date::getYear() return different values.
     *   Netscape returns the number of years since 1900, while IE returns
     *   the four number year.
     *
     * NOTE: I have not tested this code on other browsers, so I am assuming
     *   that every other browser in existence returns the four number year. ;)
     */
    if(navigator.appName.toLowerCase().indexOf("netscape") != -1)
       cdate = parseInt(now.getYear()+1900) + "-";
//    else if(navigator.appName.toLowerCase().indexOf("internet explorer") != -1)
//       cdate = parseInt(now.getYear()) + "-";
    else
       cdate = parseInt(now.getYear()) + "-";

    if((now.getMonth()+1) < 10)
      cdate += "0";
    cdate += (parseInt(now.getMonth()+1) + "-");

    if(now.getDate() < 10)
      cdate += "0";
    cdate += parseInt(now.getDate());

for(i=0; i<MAX_ELEM; i++)
{
  AFSlash = Events[i][0].indexOf("/");
  ALSlash = Events[i][0].lastIndexOf("/");
  BFSlash = Events[i][1].indexOf("/");
  BLSlash = Events[i][1].lastIndexOf("/");

  sdate = Events[i][0].substring(ALSlash+1,Events[i][0].length) + "-";

  if(parseInt(Events[i][0].substring(0,AFSlash)) < 10)
    sdate += "0";
  sdate += (Events[i][0].substring(0,AFSlash) + "-");

  if(parseInt(Events[i][0].substring(AFSlash+1,ALSlash)) < 10)
    sdate += "0";
  sdate += Events[i][0].substring(AFSlash+1,ALSlash);

  edate = Events[i][1].substring(BLSlash+1,Events[i][1].length) + "-";

  if(parseInt(Events[i][1].substring(0,BFSlash)) < 10)
    edate += "0";
  edate += (Events[i][1].substring(0,BFSlash) + "-");

  if(parseInt(Events[i][1].substring(BFSlash+1,BLSlash)) < 10)
    edate += "0";
  edate += Events[i][1].substring(BFSlash+1,BLSlash);

  if(sdate <= cdate && edate >= cdate)
  {
       if (wrote1 == 1) writestring = '<hr>';
       else writestring = '';
       writestring = writestring + '<span class="style8">' + Events[i][2] + '</span>'
       document.write(writestring);
       wrote1 = 1       /*indicate that we displayed a line so we can display <hr> between and <hr> at the end */
  }

// debugging
//  document.write(sdate + " " + cdate + " " + edate + "<br>");

}

//if (wrote1 == 1) document.write('<hr>');  /* display the <hr> if we displayed something */

} // Time-check

// End hiding the Script-->

