<!-- // Hide the script

/*
 * special.js
 *
 * Checks the date and prints important messages corresponding with those dates
 * Michael Lieberman, 2001
 *
 * Date::getYear() fix
 */

// Constants
var MAX_ELEM   = 100; // 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/17/2009';
Events[0][1]    = '8/26/2009';
Events[0][2]    = '8/26 - <a href="orgs/classes/fresh/picnic.pdf">WJ New Student Family Cookout</a><br>6:00 p.m. Front Parking Lot!' +
                  '<br>8/27 - 9th Grade Orientation, 7:25 a.m.<br><a href="information/bells/orientation.shtm">Bell ' +
                  'Schedule</a> | <a href="information/buses/">Bus Schedules</a><br>';

Events[1][0]    = '8/27/2009';
Events[1][1]    = '8/26/2009';
Events[1][2]    = '8/27 - 9th Grade Orientation, 7:25 a.m.<br><a href="information/bells/orientation.shtm">Bell ' +
                  'Schedule</a> | <a href="information/buses/">Bus Schedules</a><br>';
*/
Events[0][0]    = '11/15/2009';
Events[0][1]    = '11/16/2009';
Events[0][2]    = '<a href="information/9th_private_schools_meeting.shtm">11/16 - Mtg for 9th grade private school families interested in attending WJ</a>';

Events[1][0]    = '11/17/2009';
Events[1][1]    = '11/25/2009';
Events[1][2]    = '<a href="#principal">Help WJ Win the YMCA Turkey Chase Scholarship on Thanksgiving Day!</a>';
/*
Events[2][0]    = '9/15/2009';
Events[2][1]    = '9/25/2009';
Events[2][2]    = '9/26 - Kensington 8k/2m/1k race to benefit WJ<br>' + 
                  '<a href="http://www.kensington8k.org/">Register online today!</a>'; 
*/
Events[2][0]    = '11/3/2009';
Events[2][1]    = '11/16/2009';
Events[2][2]    = '<a href="http://wjstage.com/tickets" target="_blank">Buy your <i>King Lear</i> tickets here!</a>';
//                  '<font size="-1">Tickets will also be sold at lunch<br>the week of 11/17 in the auditorium box office.</font>'; 

Events[3][0]    = '11/17/2009';
Events[3][1]    = '12/5/2009';
Events[3][2]    = '12/5 - WJ Ed Foundation Gala to benefit WJ<br>' + 
                  '<a href="http://wjedfoundation.org/">Buy your tickets today!</a>'; 

//Events[1][0]    = '3/22/2009';
//Events[1][1]    = '4/1/2009';
//Events[1][2]    = '<a href="depts/ap/aps.shtm">AP Preadministration Sessions</i> April 1st!</a>'; 

//Events[2][0]    = '4/28/2009';
//Events[2][1]    = '5/15/2009';
//Events[2][2]    = '5/11-5/15 <a href="depts/ap/aps.shtm">AP Exams!</a>';

//Events[1][0]    = '6/7/2008';
//Events[1][1]    = '6/30/2008';
//Events[1][2]    = 'Congratulations Class of 2008!<br><a href="alumni/2008/">View the Commencement Slide Show</a>';

//Events[2][0]    = '5/18/2008';
//Events[2][1]    = '6/15/2008';
//Events[2][2]    = 'WJ Ranked #75 in <i>Newsweek</i>\'s<br><a href="http://www.newsweek.com/id/39380">"America\'s Top 100 Public High Schools"</a>';

//Events[3][0]    = '4/27/2008';
//Events[3][1]    = '5/3/2008';
//Events[3][2]    = '<a href="http://wjstage.com">Buy Tickets for WJ\'s <i>Beauty &amp; the Beast</i></a>';

//Events[4][0]    = '4/19/2008';
//Events[4][1]    = '4/25/2008';
//Events[4][2]    = 'Seniors: A limited number of prom tickets are still available. See Ms. Baird in Portable 3 before ' +
//                  'school, during lunch, or after school. Tickets will be first-come, first-served until they are all sold';

//Events[6][0]    = '8/26/2008';
//Events[6][1]    = '10/1/2008';
//Events[6][2]    = 'Edline at WJ - <a href="information/edline">Click here for info</a><br>' +
                  'Parents, <a href="information/edline/activate.shtm">click here to activate your account</a><br>' +
                  'Students, <a href="information/edline/stu_activate.shtm">click here to activate your account</a>';

//Events[11][0]    = '3/9/2009';
//Events[11][1]    = '3/11/2009';
//Events[11][2]    = '<a href="orgs/booster/mulch_sale.pdf">Booster Club Mulch Sale Order Deadline 3/11</a>';

/*Events[12][0]    = '11/2/2007';
Events[12][1]    = '11/30/2007';
Events[12][2]    = 'November <a href="schoolstore/hours.shtm">School Store Sale</a>!';
*/
Events[14][0]    = '10/30/2009';
Events[14][1]    = '11/14/2009';
Events[14][2]    = '<a href="orgs/classes/senior/graduation.shtm">Commencement 2010 is June 1st at 7:00 p.m.</a><br>';
//                   'classes canceled for undergraduates';

//Events[15][0]    = '5/13/2008';
//Events[15][1]    = '5/15/2008';
//Events[15][2]    = 'Fine Arts Festival - 5/14-15. Evening Reception 6-9 on 5/14';

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++)
{
if (Events[i][0] != "@")
{
  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="style9">' + 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-->
