<!-- // 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[0][0]    = '8/22/2009';
Events[0][1]    = '8/30/2009';
Events[0][2]    = 'First Day of School 8/31<br><a href="information/bells/opening_week.shtm">Special Bell Schedules 8/31-9/1</a><br>' +
//Events[0][2]    = 'Welcome Back Wildcats!<br><a href="information/bells/opening_week.shtm">Special Bell Schedules 8/31-9/1</a><br>' +
                  '<font size="-1">Students should report to their assigned homerooms 8/31-9/1. Homeroom posters are ' +
                  'displayed throughout the building or you may <a href="information/home_rooms.pdf">click here for the ' +
                  'list of homeroom assignments</a>. All students will receive their class schedules in homeroom on the first day. ' +
                  '<br><a href="information/dropoff.shtm">Click here for important Information About Student Drop-off/Pick-up</a></font>';

Events[1][0]    = '8/31/2009';
Events[1][1]    = '9/1/2009';
Events[1][2]    = '<a href="information/bells/opening_week.shtm">Special Bell Schedule 9/1</a><br>' +
                  '<font size="-1">Students should again report to their assigned homerooms. Homeroom posters are ' +
                  'displayed throughout the building or you may <a href="information/home_rooms.pdf">click here for the ' +
                  'list of homeroom assignments</a>.<br><a href="information/dropoff.shtm">Click here for important Information About Student Drop-off/Pick-up</a></font>';

Events[2][0]    = '9/2/2009';
Events[2][1]    = '9/7/2009';
Events[2][2]    = '9/7 - School Closed for Labor Day';

Events[3][0]    = '8/31/2009';
Events[3][1]    = '9/10/2009';
Events[3][2]    = '9/10 - Back-to-School Night, 7:00 p.m.<br>Start in Child\'s 1st Period Class<br>' +
                  '<font size="-1"><a href="information/btsn.shtm">Click here for more information</a></font>'; 

Events[4][0]    = '9/1/2009';
Events[4][1]    = '9/14/2009';
Events[4][2]    = '9/14 - <a href="orgs/ptsa/guidance/frmtgsept.html">Freshman Parent Meeting</a><br>7:30 p.m. WJ Cafeteria';

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/24/2008';
Events[6][1]    = '9/29/2008';
Events[6][2]    = '9/30 - School Closed for Rosh Hashanah';
*/

Events[7][0]    = '9/15/2009';
Events[7][1]    = '10/2/2009';
Events[7][2]    = '<a href="orgs/sga/homecoming.shtm">Homecoming 2009 Events - 9/21 - 10/2</a>'; 
//                  '<a href="orgs/sga/homecoming.shtm">Tickets on Sale through 9/30-A few left for Freshmen &amp; Sophomores';

Events[8][0]    = '9/30/2009';
Events[8][1]    = '10/6/2009';
Events[8][2]    = '10/6 - WJ Cluster<br>Rising 9th Grade Parent/Student Orientation<br>7:00 p.m. - WJ Auditorium - ' +
                  '<a href="information/letters/rising9th_orientation.pdf">Dr. Garran\'s Letter</a> | <a href="information/rising_9th_meeting.shtm">Agenda</a>';

Events[10][0]    = '10/8/2009';
Events[10][1]    = '10/14/2009';
Events[10][2]    = '10/14 - APEX 8th Grade Parent/Student Info Night, 7:00 p.m. - WJ Cafeteria';

Events[11][0]    = '10/1/2009';
Events[11][1]    = '10/13/2009';
Events[11][2]    = '10/14 - PSAT Test at WJ - <a href="information/psat/psat_letter.pdf">Dr. Garran\'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/10/2009';
Events[12][1]    = '10/16/2009';
Events[12][2]    = '10/16 - School Closed for MD Teacher Conf'; 

Events[14][0]    = '10/27/2009';
Events[14][1]    = '11/2/2009';
Events[14][2]    = '11/2 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/26/2009';
Events[18][1]    = '11/26/2009';
Events[18][2]    = '11/26-27 School Closed-Happy Thanksgiving';

Events[19][0]    = '11/27/2009';
Events[19][1]    = '11/27/2009';
Events[19][2]    = '11/27 School Closed-Thanksgiving Break';

Events[21][0]    = '12/18/2009';
Events[21][1]    = '12/31/2009';
Events[21][2]    = '12/24-1/2 School Closed-Enjoy Your Winter Break';

Events[22][0]    = '1/1/2010';
Events[22][1]    = '1/3/2010';
Events[22][2]    = 'Happy New Year! Classes Resume 1/4/10';

Events[24][0]    = '1/12/2010';
Events[24][1]    = '1/18/2010';
Events[24][2]    = '1/18 - School Closed-ML King Day';

Events[25][0]    = '1/19/2010';
Events[25][1]    = '1/25/2010';
Events[25][2]    = '1/25 School Closed - Report Card Prep';

Events[26][0]    = '1/20/2010';
Events[26][1]    = '1/26/2010';
Events[26][2]    = '1/26 - 1st Day of 2nd Semester<br>' +
                   '<a href="information/bells/2ndsemester.shtm">Special Bell Schedule</a><br>' +
                   '<a href="information/home_rooms.pdf">2nd Semester Home Room Assignments</a>';

Events[28][0]    = '1/29/2010';
Events[28][1]    = '2/4/2010';
Events[28][2]    = '2/4 - Back-to-School Night<br>7:00 p.m. in Child\'s 1st Period Class<br>' +
                   '<a href="information/letters/btsn2.pdf">Read Dr. Garran\'s Letter</a><br>';

//Events[29][0]    = '2/6/2008';
//Events[29][1]    = '2/12/2008';
//Events[29][2]    = '2/12 - School Closed for Primary Election';

Events[30][0]    = '2/9/2010';
Events[30][1]    = '2/15/2010';
Events[30][2]    = '2/15 - School Closed-Presidents Day';

Events[33][0]    = '3/23/2010';
Events[33][1]    = '4/6/2010';
Events[33][2]    = '3/29-4/6 - Spring Break - Classes Resume 4/7';
/*
Events[32][0]    = '3/31/2010';
Events[32][1]    = '4/6/2010';
Events[32][2]    = '4/6 School Closed - Report Card Prep';
*/

Events[34][0]    = '5/22/2010';
Events[34][1]    = '5/28/2010';
Events[34][2]    = '5/28 - Last Day of School for Seniors'; 
                   
Events[35][0]    = '5/25/2010';
Events[35][1]    = '5/31/2010';
Events[35][2]    = '5/31 - School Closed-Memorial Day';

Events[37][0]    = '6/7/2007';
Events[37][1]    = '6/8/2007';
Events[37][2]    = 'Congratulations Class of 2010!';

Events[40][0]    = '6/17/2010';
Events[40][1]    = '6/23/2010';
Events[40][2]    = '6/23 - 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-->
