<!-- // 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   = 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 unfilled items
for(i=0; i<MAX_ELEM; i++)
{
   Events[i] = new Array(5);
   Events[i][0] = "@";
   Events[i][1] = "@";
   Events[i][2] = "@";
   Events[i][3] = "@";
   Events[i][4] = "@";
}

/* 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 five lines.  Examples:
 *   Events[0][0] = '10/31/2001';
 *   Events[0][1] = '10/31/2001';
 *   Events[0][2] = 'headline';
 *   Events[0][3] = 'link';
 *   Events[0][4] = 'blurb';
 *
 * 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]    = '9/28/2011';
Events[0][1]    = '10/10/2011';
Events[0][2]    = '10/10 - Parents Welcome for Open House';
Events[0][3]    = 'information/openhouse.shtm';
Events[0][4]    = '';
*/

Events[7][0]    = '12/28/2011';
Events[7][1]    = '1/2/2012';
Events[7][2]    = 'Information on January\'s Semester Exams';
Events[7][3]    = 'information/exam_winter_guidelines.shtm';
Events[7][4]    = '';

Events[9][0]    = '1/30/2012';
Events[9][1]    = '2/10/2012';
Events[9][2]    = '1/30-2/10 - Order Roses for your Valentine from <i>The Pitch</i>';
Events[9][3]    = 'http://www.wjpitch.com/top-stories/2012/01/28/rose-sale-order-form/';
Events[9][4]    = 'Roses are $2 each or $5 for three and will be delivered during 3rd or 4th periods. Complete the online form to order and mail in your payment today!';

Events[1][0]    = '1/7/2008';
Events[1][1]    = '1/24/2008';
Events[1][2]    = 'Join us for two important parent events on 1/24 &amp; 1/31';
Events[1][3]    = '';
Events[1][4]    = 'The annual information meeting for registration for the 2008-2009 school year will be held on ' +
                  'the 24th. <a href="information/letters/registration.pdf">Read Dr. Garran\'s letter</a> for more ' + 
                  'information. Second Semester Back-to-School Night will be on the 31st. ' +
                  '<a href="information/letters/btsn2.pdf">Read Dr. Garran\'s letter</a> for more information.';

Events[2][0]    = '11/7/2011';
Events[2][1]    = '12/16/2011';
Events[2][2]    = 'Click here for info about WJ\'s Annual Canned Food Drive and contribute!';
Events[2][3]    = 'information/canned_food_drive.shtm';
Events[2][4]    = '';

Events[3][0]    = '3/15/2010';
Events[3][1]    = '3/17/2010';
Events[3][2]    = 'AP Test <i>LATE</i> Registration March 17-18!';
Events[3][3]    = 'depts/ap/aps.shtm';
Events[3][4]    = 'Late registration for AP Exams will take place ONLY DURING LUNCH March 17-18. Click the above link for more information.';

Events[4][0]    = '8/25/2010';
Events[4][1]    = '8/31/2010';
Events[4][2]    = 'Important Information About Student Drop-Off/Pick-Up';
Events[4][3]    = 'information/dropoff.shtm';
Events[4][4]    = 'Our students\' safety is of utmost importance. Please click the above link and follow the instructions regarding student drop-off/pick-up!';

Events[5][0]    = '3/1/2011';
Events[5][1]    = '4/15/2011';
Events[5][2]    = 'Submit a Nomination for the 2011 "Hall of Fame" Awards!';
Events[5][3]    = 'orgs/ptsa/hof_award/';
Events[5][4]    = 'The PTSA is again requesting nominations for WJ\'s annual "Hall of Fame" Awards for deserving  ' + 
                  'members of the faculty and staff. Click the link above for more information and to submit ' +
                  'your nomination. The deadline is April 15th so do it today!';
Events[6][0]    = '9/7/2011';
Events[6][1]    = '9/16/2011';
Events[6][2]    = 'Join Me In Participating in the Kensington 8K/2M/1K Race on September 24th.';
Events[6][3]    = 'information/8k_application.pdf';
Events[6][4]    = 'Proceeds from this annual event benefit Kensington Parkwood Elementary, North Bethesda Middle School and Walter Johnson High School. Click the above link for ' +
                  'the registration form or visit <a href=\"http://www.kensington8k.org\">www.kensington8k.org</a> for more information and online registration. Register prior to Sept 21 for ' +
                  'the early registration discount.';

Events[70][0]    = '1/1/2011';
Events[70][1]    = '6/15/2011';
Events[70][2]    = 'FREE for all WJ Students: SAT/ACT Test Prep OnLine Course';
Events[70][3]    = '/curriculum/hsi/testprep.shtm';
Events[70][4]    = 'There are two FREE test prep courses available to all MCPS high school students. Click the above link for more information and to access the courses.';

Events[8][0]    = '7/29/2011';
Events[8][1]    = '9/2/2011';
Events[8][2]    = 'Buy an ad in the 2011-2012 PTSA <i>Lineup</i> Student Directory';
Events[8][3]    = 'orgs/ptsa/lineup_ad.pdf';
Events[8][4]    = 'Support the WJ PTSA by placing your business ad in this year\'s <i>Lineup</i> Student Directory. Click the above link for the ad order form that includes ' +
                  'pricing and additional information. This year\'s deadline is September 8 for ad copy and payment.';

Events[20][0]    = '5/18/2010';
Events[20][1]    = '6/18/2010';
Events[20][2]    = 'About Student Address Changes';
Events[20][3]    = 'studserve/registrar';
Events[20][4]    = 'Address changes for WJ students must be provided to WJ Registrar Clara Matos in person. A current lease, property tax bill or the closing documents from a home purchase ' +
                   'must be presented as proof of residency in the WJ school district. Click the above link for information about the Registrar\'s Office';

Events[21][0]    = '12/30/2010';
Events[21][1]    = '2/18/2011';
Events[21][2]    = 'Registration for the 2011-2012 School Year Now in Progress';
Events[21][3]    = 'studserve/coursebook';
Events[21][4]    = 'Counselors distributed course cards and instructions beginning January 4th. Click the link above to access the Online Course Bulletin and review the registration calendar';

Events[22][0]    = '9/16/2008';
Events[22][1]    = '9/29/2008';
Events[22][2]    = 'Congratulations to WJ\'s National Merit Scholarship Semifinalists';
Events[22][3]    = 'information/student_awards/nm.shtm';
Events[22][4]    = '';

Events[23][0]    = '9/29/2010';
Events[23][1]    = '10/15/2010';
Events[23][2]    = '<i>The Pitch</i> Online';
Events[23][3]    = 'http://wjpitch.com/';
Events[23][4]    = 'In addition to the printed newspaper, staff sponsor Hilary Gates and her students maintain an online version of <i>The Pitch</i>. Click the above link ' +
                   'to read <i>The Pitch</i> Online';

Events[24][0]    = '3/14/2010';
Events[24][1]    = '3/26/2010';
Events[24][2]    = 'Important Security Information';
Events[24][3]    = 'information/security_info.shtm';
Events[24][4]    = '';

Events[25][0]   = '4/5/2010';
Events[25][1]   = '5/1/2010';
Events[25][2]   = 'Purchase WJ S*T*A*G*E <i>The Wiz</i> tickets online today!'; 
Events[25][3]   = 'https://wjstage.ticketleap.com/member/list_events.aspx?event_company_id=28C0DA6A-965F-468D-A1A8-FD8E76D5BB4&';
Events[25][4]   = 'Performance dates are 4/23-24 and 4/30-5/1. Click the above link for ticket information and to purchase tickets online';

Events[26][0]   = '5/18/2010';
Events[26][1]   = '5/25/2010';
Events[26][2]   = 'Seniors: Submit Your "Senior Scatter" Info to <i>The Pitch</i>'; 
Events[26][3]   = 'orgs/classes/senior/scatter.shtm';
Events[26][4]   = '';

Events[28][0]   = '7/15/2011';
Events[28][1]   = '8/31/2011';
Events[28][2]   = 'Extracurricular Activity (ECA) Fee Payable Online!'; 
Events[28][3]   = 'information/eca_fee.shtm';
Events[28][4]   = 'Families of students who will be participating in activities requiring the payment of the ECA fee may pay online using a credit card rather than mailing a check.' +
                  'Click the above link for more information about the ECA fee and to access the online payment screen.';

Events[29][0]    = '7/15/2011';
Events[29][1]    = '8/11/2011';
Events[29][2]    = '<font color="ff0000">Attention Seniors:</font> Click the + for Senior Portrait Information';
Events[29][3]    = '';
Events[29][4]    = 'Senior Portraits are being taken August 4, 5, 10 &amp; 11 in the WJ Dance Studio. Portraits are by appointment and all seniors should have received letters about them. ' +
                   'If you did not receive a letter, have questions or need to reschedule your appointment you need to call Blanton at 301-840-8044.';
/*
Events[30][0]    = '8/12/2011';
Events[30][1]    = '8/28/2011';
Events[30][2]    = '<font color="ff0000">Attention Seniors:</font> Click the + for Senior Portrait Information';
Events[30][3]    = '';
Events[30][4]    = 'Senior Portraits were taken at WJ August 4, 5, 10 &amp; 11. If you did not receive a letter about your portrait or missed your appointment ' +
                   'you need to call Blanton at 301-840-8044 to schedule a sitting during the October make-up days.';
*/
Events[30][0]    = '10/10/2011';
Events[30][1]    = '10/13/2011';
Events[30][2]    = '<font color="ff0000">Attention Seniors:</font> Information About Your LAST CHANCE for Senior Portraits';
Events[30][3]    = 'orgs/windup/announcements.shtm';
Events[30][4]    = '';

Events[31][0]    = '12/15/2011';
Events[31][1]    = '1/6/2012';
Events[31][2]    = '<font color="ff0000">Attention Seniors:</font> Click here for WJ Parking Permit Information';
Events[31][3]    = 'studserve/security/parking.shtm';
Events[31][4]    = '';

Events[32][0]    = '5/18/2011';
Events[32][1]    = '6/1/2011';
Events[32][2]    = 'Congratulations to Recipients at WJ\'s Annual Awards Night!';
Events[32][3]    = 'information/student_awards/Academic_Awards_2011.pdf';
Events[32][4]    = '';

Events[33][0]    = '1/11/2012';
Events[33][1]    = '1/20/2012';
Events[33][2]    = '<font color="ff0000">Attention Seniors:</font> All WJ 2nd Semester Parking Permits Must Be Paid For by January 20th';
Events[33][3]    = 'studserve/security/parking.shtm';
Events[33][4]    = 'Check the list in the Security office and don\'t miss the payment/pick-up deadline!';

Events[34][0]    = '9/8/2011';
Events[34][1]    = '9/13/2011';
Events[34][2]    = '<font color="ff0000">Attention Juniors:</font> A few parking spaces are available for 1st semester. Applications will be accepted on 9/13 ONLY. Click here for more information';
Events[34][3]    = 'studserve/security/parking.shtm';
Events[34][4]    = '';

Events[35][0]    = '10/10/2011';
Events[35][1]    = '11/23/2011';
Events[35][2]    = '<font color="ff0000">Attention Seniors &amp; Parents:</font> Buy your Senior Yearbook Ad by November 23rd!';
Events[35][3]    = 'orgs/windup/buyingad.shtm';
Events[35][4]    = '';

Events[36][0]    = '12/9/2011';
Events[36][1]    = '1/31/2012';
Events[36][2]    = 'Please Join The WJ Listserv To Keep Up With Important School News';
Events[36][3]    = 'guestbook/listserv.shtm';
Events[36][4]    = 'The WJ listserv, sponsored by our PTSA, is an important means of communication for the WJ community. I ask that all families with students at WJ strongly consider ' +
                   'having at least one household member receive these important email messages. Click the headline above for instructions on joining the listserv.';
Events[37][0]    = '12/18/2011';
Events[37][1]    = '1/28/2012';
Events[37][2]    = 'Join us for the Adult Carnival Gala &amp; Silent Auction on January 28th at 7:30 p.m.';
Events[37][3]    = 'http://wjedfoundation.org/';
Events[37][4]    = 'This fun evening for the WJ Community will take place at the B-CC Rescue Squad. Click the above link for more information, to purchase tickets, to contribute or to volunteer.';

Events[38][0]    = '1/8/2012';
Events[38][1]    = '4/30/2012';
Events[38][2]    = 'Check Out The Winter Offerings From The MCPS Parent Academy';
Events[38][3]    = '/departments/parentacademy/';
Events[38][4]    = '';

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 = "";
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());

//document.write('<hr>'); //write the divider

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);

/* prepare the data to display

 * If it's within the date range...
 * If blurb is blank don't display a + sign
 * If link is non-blank, code it.
 * Display the headline
 * Display any non-blank blurb 
 */

  if(sdate <= cdate && edate >= cdate)
   { var headline = "<h3>";
if (Events[i][4] != "")
  headline = headline + '<img src="/gr/collapse-small.gif" border="0" onclick="javascript:tdisplay(900' + i + ')" id="900' 
  + i + 'plus" class="plusminus"><img src="/gr/expand-small.gif" border="0" onclick="javascript:tdisplay(900' + i + 
  ')" id="900' + i + 'minus" style="display:none" class="plusminus">';

 if (Events[i][3] != "")
  headline = headline + '<a href="' + Events[i][3] + '" target="_blank">';  

 headline = headline + Events[i][2];

 if (Events[i][3] != "")
 headline = headline + '</a>';

 headline = headline + '</h3>';

 document.write('<span class="specstyle">' + headline + '</span>');

 if (Events[i][4] != "")
      document.write('<p id="900' + i + '" style="display:none">' + Events[i][4] + '</p>');

// Display the data
//       document.write('<span class="specstyle">' +
//       Events[i][2] + '</span><br><br>');
// debugging
//  document.write(sdate + " " + cdate + " " + edate + "<br>");

} 
} 
}
} // date-check
//document.write('<hr>'); //write the divider

//document.write('<p></p>'); //blank line at the end


// End hiding the Script-->

