<!-- // Hide the script

/*
 * bellchg.js
 *
 * Checks the date and prints a banner message for days when the bell schedule changes
 * Maria Limarzi, 2009
 *
 * Date::getYear() fix
 */

// Constants
var MAX_ELEM   = 100; // The maximum number of events that the array can hold
var now = new Date();

/* 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. 
 *
 * 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]    = '10/14/2011';
Events[0][1]    = '10/15/2011';
Events[0][2]    = '<div id="div-banner">10/14 Suspended/Postponed Varsity Soccer resumes<br>Boys 5:00 p.m. ahead 2-1 in the 1st half<br>Girls approx 6:30 p.m. start</div>';  
*/
Events[0][0]    = '10/15/2011';
Events[0][1]    = '10/17/2011';
Events[0][2]    = '<div id="div-banner">10/17-20 Homecoming Spirit Week<br>Tuesday is Animal Day!</div>';  

/*
Events[0][0]    = '12/16/2010';
Events[0][1]    = '12/17/2010';
Events[0][2]    = '<div id="div-banner"><a href="/info/emergency/" target="_blank">Click here for MCPS Weather Announcements</a></div>';  
*/
/*
Events[0][0]    = '8/30/2011';
Events[0][1]    = '9/2/2011';
Events[0][2]    = '<div id="div-banner">Fri is Color War (Sr-Green, Jr-Black, So-White, Fr-Yellow)<br>' +
                  'Fri, Sept 2 is Pep Rally <a href="information/bells/assembly.shtm">special bell schedule</a></div>';
*/
/*
Events[0][0]    = '8/24/2011';
Events[0][1]    = '8/29/2011';
Events[0][2]    = '<div id="div-banner">8/29 - First Day of School <a href="information/bells/opening_week.shtm">Special Bell Schedule</a>.</div>';

//Pep Rally
Events[1][0]    = '8/30/2011';
Events[1][1]    = '9/2/2011';
Events[1][2]    = '<div id="div-banner">Fri, Sept 2 is Pep Rally <a href="information/bells/assembly.shtm">special bell schedule</a></div>';
*/
//grading
Events[2][0]    = '9/26/2011';
Events[2][1]    = '9/28/2011';
Events[2][2]    = '<div id="div-banner">Wed, Sep 28 is early release <a href="information/bells/early.shtm">special bell schedule</a></div>';

Events[3][0]    = '10/10/2011';
Events[3][1]    = '10/12/2011';
Events[3][2]    = '<div id="div-banner">Wed, Oct 12 is PSAT <a href="information/bells/psat.shtm">special bell schedule</a></div>';

//Hispanic
Events[4][0]    = '12/14/2011';
Events[4][1]    = '12/16/2011';
Events[4][2]    = '<div id="div-banner">Fri, Dec 16 is assembly <a href="information/bells/assembly.shtm">special bell schedule</a></div>';

Events[5][0]    = '10/18/2011';
Events[5][1]    = '10/20/2011';
Events[5][2]    = '<div id="div-banner">Thurs, Oct 20 is Homecoming Video<br><a href="information/bells/homecoming_video.shtm">special bell schedule</a></div>';

Events[6][0]    = '10/26/2011';
Events[6][1]    = '10/28/2011';
Events[6][2]    = '<div id="div-banner">Fri, Oct 28 is \"Bad Day To Be A Pumpkin\" <a href="information/bells/pumpkin.shtm">special bell schedule</a></div>';

Events[7][0]    = '11/3/2011';
Events[7][1]    = '11/6/2011';
Events[7][2]    = '<div id="div-banner">Sun, Nov 6 - Walter Johnson, our namesake, born 1887.<br>Happy Birthday!<br>' +
                  'Sun, Nov 6 Daylight Saving Time Ends. Turn Clocks Back 1 Hour!</div>';
/*
Events[7][0]    = '11/7/2010';
Events[7][1]    = '11/7/2010';
Events[7][2]    = '<div id="div-banner">Sun, Nov 7 Daylight Saving Time Ends. Turn Clocks Back 1 Hour!</div>';
*/
Events[9][0]    = '11/7/2011';
Events[9][1]    = '11/10/2011';
Events[9][2]    = '<div id="div-banner">Thur, Nov 10 is report card <a href="information/bells/report.shtm">special bell schedule</a></div>';

Events[10][0]    = '11/15/2011';
Events[10][1]    = '11/17/2011';
Events[10][2]    = '<div id="div-banner">Thur, Nov 17 is Senior Citizen Luncheon <a href="information/bells/srcit.shtm">special bell schedule</a></div>';

Events[11][0]    = '11/18/2011';
Events[11][1]    = '11/23/2011';
Events[11][2]    = '<div id="div-banner">Wed, Nov 23 is early release <a href="information/bells/early.shtm">special bell schedule</a><br>' +
                  'Nov 24-25 school closed. Happy Thanksgiving</div>';

//Pep Rally
Events[12][0]    = '11/27/2011';
Events[12][1]    = '12/2/2011';
Events[12][2]    = '<div id="div-banner">Winter Sports Spirit Week-Friday is Color Wars<br>' +
                   'Sr-Green, Jr-Blue, So-Yellow, Fr-Orange<br>' +
                   'Fri, Dec 2 is Pep Rally <a href="information/bells/assembly.shtm">special bell schedule</a></div>';

Events[13][0]    = '12/24/2011';
Events[13][1]    = '1/2/2012';
Events[13][2]    = '<div id="div-banner"><span style="color: yellow">Enjoy the Winter Break and Happy New Year, WJ! See you on January 3rd!</span></div>';

Events[14][0]    = '1/3/2012';
Events[14][1]    = '1/20/2012';
Events[14][2]    = '<div id="div-banner">Jan 13-20 are final exam <a href="information/exam_winter_guidelines.shtm">special bell schedules</a></div>';

Events[15][0]    = '1/20/2012';
Events[15][1]    = '1/24/2012';
Events[15][2]    = '<div id="div-banner">Tue, Jan 24 is first day of 2nd semester <a href="information/bells/2ndsemester.shtm">special bell schedules</a><br>' +
                   '<a href="information/home_rooms.pdf">home room assignments</a></div>';

Events[16][0]    = '1/30/2012';
Events[16][1]    = '2/1/2012';
Events[16][2]    = '<div id="div-banner">Wed, Feb 1 is report card <a href="information/bells/report.shtm">special bell schedule</a></div>';

//Black history
Events[17][0]    = '2/22/2012';
Events[17][1]    = '2/24/2012';
Events[17][2]    = '<div id="div-banner">Fri, Feb 24 is assembly <a href="information/bells/assembly.shtm">special bell schedule</a></div>';

//grading
Events[18][0]    = '2/29/2012';
Events[18][1]    = '3/2/2012';
Events[18][2]    = '<div id="div-banner">Fri, Mar 2 is early release <a href="information/bells/early.shtm">special bell schedule</a></div>';

Events[19][0]    = '3/9/2012';
Events[19][1]    = '3/11/2012';
Events[19][2]    = '<div id="div-banner">Sun, Mar 11 Daylight Saving Time Begins.<br>Turn Clocks Ahead 1 Hour!</div>';

//Pep Rally
Events[20][0]    = '3/14/2012';
Events[20][1]    = '3/16/2012';
Events[20][2]    = '<div id="div-banner">Fri, Mar 16 is Pep Rally <a href="information/bells/assembly.shtm">special bell schedule</a></div>';

//Asian
Events[21][0]    = '3/21/2012';
Events[21][1]    = '3/23/2012';
Events[21][2]    = '<div id="div-banner">Fri, Mar 23 is assembly <a href="information/bells/assembly.shtm">special bell schedule</a></div>';

Events[22][0]    = '4/10/2012';
Events[22][1]    = '4/12/2012';
Events[22][2]    = '<div id="div-banner">Thu, Apr 12 is report card <a href="information/bells/report.shtm">special bell schedule</a></div>';

Events[23][0]    = '4/22/2012';
Events[23][1]    = '4/24/2012';
Events[23][2]    = '<div id="div-banner">Tue, Apr 24 is SMOB video <a href="information/bells/assembly.shtm">special bell schedule</a></div>';

//Every 15 Minutes
Events[24][0]    = '4/12/2011';
Events[24][1]    = '4/13/2011';
Events[24][2]    = '<div id="div-banner">Wed, Apr 13 is assembly <a href="information/bells/assembly.shtm">special bell schedule</a></div>';

Events[25][0]    = '4/24/2011';
Events[25][1]    = '5/13/2011';
Events[25][2]    = '<div id="div-banner">May 2-27 are AP, HSA &amp; Senior Exams<br><a href="depts/hsa_schedule.shtm">Special Bell Schedules/Delayed Openings</a></div>';

Events[26][0]    = '5/14/2011';
Events[26][1]    = '5/19/2011';
Events[26][2]    = '<div id="div-banner">May 16-27 are HSA &amp; Senior Exams<br><a href="depts/hsa_schedule.shtm">Special Bell Schedules/Delayed Openings</a></div>';

Events[27][0]    = '5/20/2011';
Events[27][1]    = '5/26/2011';
Events[27][2]    = '<div id="div-banner">May 23-26 are Senior Exams</div>';

Events[28][0]    = '5/26/2011';
Events[28][1]    = '5/27/2011';
Events[28][2]    = '<div id="div-banner">Fri, May 27 is SGA Elections video <a href="information/bells/assembly.shtm">special bell schedule</a></div>';

Events[29][0]    = '6/4/2011';
Events[29][1]    = '6/16/2011';
Events[29][2]    = '<div id="div-banner">Jun 10-16 are final exam <a href="depts/hsa_schedule.shtm">special bell schedules</a></div>';

Events[98][0]    = '5/25/2012';
Events[98][1]    = '5/31/2012';
Events[98][2]    = '<div id="div-banner"><a href="orgs/classes/senior/graduation.shtm">Commencement 2012 is May 31st at 7:00 p.m.</a><br>Classes canceled for undergraduates</div>';

Events[99][0]    = '5/27/2011';
Events[99][1]    = '5/31/2011';
Events[99][2]    = '<div id="div-banner"><a href="http://www.dar.org/watchgraduation">Click Here to Watch Graduation LIVE today at 2:30 p.m.</a></div>';

i = 0;

// The locations of the slashes in the date
var AFSlash, ALSlash, BFSlash, BLSlash, display;

// Starting date / ending date strings -- used for comparison
var sdate = "", edate = ""; writestring = "";
var cdate;

    /* 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++)
{
display = 1 /* set the flag to display */
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 (edate == cdate) /* it is the end date */
{
   if(now.getHours() > 14) display = 0 /* after 2 p.m. we don't want to display */
}
if (display == 1)
{
       writestring = '<span class="style9">' + Events[i][2] + '</span>'
       document.write(writestring);
} 
 }
// debugging
//  document.write(sdate + " " + cdate + " " + edate + "<br>");

}
}

// End hiding the Script-->

