<!--
/*
Java Script Calendar is a small script for web pages which displays current
Day of the week, Month, Date and Year along with Holidays notification.  Just
like this working demo below. It will work with Netscape 2++, Microsoft 3++
and Opera 3++ web browsers.

                                    Tuesday, November 24, 1998    

Holidays from all over the world are displayed by Calendar (if you know other
ones, let me know, I will add them).  It even calculates Easter Sunday date!
To see how it works change the date on your computer to January, 1, for
example and re-load the page.

Installation is very simple. Just copy the script below, everything between
SCRIPT and SCRIPT tags (including tags themselves) and paste in the place you
want it to appear on your page.  You can customize the way it looks by
changing document.write function arguments just after month names definitions.
Java Script Calendar is free without any limitations.
Copyright © Eugene Vassiltsov. But please, let me know if you will use it.

Modified by Andrea Whitlock (whitlock@mobius-soft.com), December 2001, to
fix the Thanksgiving calculation. Added other dates. Look for "AGW" lines.

Modified by Andrea Whitlock (whitlock@mobius-soft.com), June 2003, to 
fix the Fathers' Day and Mothers' Day calculations. Look for "AGW" lines.

Modified by Andrea Whitlock (whitlock@mobius-soft.com), October 2008.
Changed the daylight saving time calculations. The Energy Policy Act of 2005 changes the
start and end dates of daylight saving time, beginning in 2007. Clocks were set ahead
one hour on the second Sunday of March (March 11, 2007) instead of on the first Sunday
of April (April 1, 2007). Clocks were set back one hour on the first Sunday in November
(November 4, 2007), rather than on the last Sunday of October (October 28, 2007).
*/

 var thanksgiving = new Date(); // AGW
 var fathersday = new Date(); // AGW
 var mothersday = new Date(); // AGW
 var washington = new Date(); // AGW
 var calendar = new Date();
//calendar.setDate(22);
//calendar.setMonth(10);
//calendar.setYear(2001);
 var day = calendar.getDay();
 var month = calendar.getMonth();
 var date = calendar.getDate();
 var year = calendar.getYear();
 if (year < 1000)
 year+=1900
 var cent = parseInt(year/100);
 var g = year % 19;
 var k = parseInt((cent - 17)/25);
 var i = (cent - parseInt(cent/4) - parseInt((cent - k)/3) + 19*g + 15) % 30;
 i = i - parseInt(i/28)*(1 - parseInt(i/28)*parseInt(29/(i+1))*parseInt((21-g)/11));
 var j = (year + parseInt(year/4) + i + 2 - cent + parseInt(cent/4)) % 7;
 var l = i - j;
 var emonth = 3 + parseInt((l + 40)/44);
 var edate = l + 28 - 31*parseInt((emonth/4));
 emonth--;
 var dayname = new Array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
 var monthname = 
 new Array ("January","February","March","April","May","June","July","August","September","October","November","December" );
 var sunday;
 var monday;
 var thursday;
 var nthweek;
 var tempd;
 var firstDayOfMonth;
 var offset;
 var tdate;
 document.write("Today is " + dayname[day] + ", ");
 document.write(monthname[month] + " ");
 if (date< 10) document.write("0" + date + ", ");
         else document.write(date + ", ");
 document.write(year);
 // Easter
 if ((month == emonth) && (date == edate)) document.write(" - Easter Sunday");
 // January
 if ((month == 0) && (date == 1)) document.write(" - New Year's Day");
 if ((month == 0) && (day == 1) && (date > 14) && (date< 22)) document.write(" - Martin Luther King Jr. Day");
 // February
 if ((month == 1) && (date == 2)) document.write(" - Groundhog Day");
 if ((month == 1) && (date== 12)) document.write(" - Lincoln's Birthday");
 if((month == 1) && (date == 14)) document.write(" - St. Valentine's Day");
 if ((month == 1) && (date == 22)) document.write(" - Washington's Birthday");
 if (month == 1) { // AGW begin
  // 3rd Monday in February (Washington's Birthday Observed = Presidents' Day)
  monday = 1;
  nthweek = 3;
  tempd = new Date(year, month, 1);
  firstDayOfMonth = tempd.getDay();
  offset = monday - firstDayOfMonth;
  if(offset < 0) 
   offset += 7;
  tdate = (nthweek - 1) * 7 + 1 + offset;
  washington.setDate(tdate);
  washington.setMonth(month);
  washington.setYear(year);
  if (date == washington.getDate())
   document.write(" - Presidents' Day");
 } // AGW end
 if ((month == 1) && (date == 29)) document.write(" - Leap Day");
 // March
 if ((month == 2) && (date == 17)) document.write(" - St. Patrick's Day");
 // April
 if ((month == 3) && (date == 1)) document.write(" - April Fools' Day");
 if ((month == 3) && (date == 15) && (day != 0)) document.write(" - Income Tax Day (USA)");
 if ((month == 3) && (date == 16) && (day == 1)) document.write(" - Income Tax Day (USA)");
 if ((month == 3) && (date == 22)) document.write(" - Earth Day");
// DST rules have changed! if ((month == 3) && (day == 0) && (date > 0) && (date< 8)) document.write(" - Daylight Saving Time Begins");
if ((month == 2) && (day == 0) && (date > 7) && (date< 15)) document.write(" - Daylight Saving Time Begins");
 // May
 if ((month == 4) && (date == 1)) document.write(" - May Day");
 // if ((month == 4) && (day == 0) && (date > 7) && (date< 16)) document.write(" - Mothers' Day");
 if ((month == 4) && (day == 0) && (date > 7)) { // AGW Begin
  // Mothers' Day = 2nd Sunday in May
  sunday = 0;
  nthweek = 2;
  tempd = new Date(year, month, 1);
  firstDayOfMonth = tempd.getDay();
  offset = sunday - firstDayOfMonth;
  if(offset < 0) 
   offset += 7;
  tdate = (nthweek - 1) * 7 + 1 + offset;
  mothersday.setDate(tdate);
  mothersday.setMonth(month);
  mothersday.setYear(year);
  if (date == mothersday.getDate())
   document.write(" - Mothers' Day");
 } // AGW end
 if ((month == 4) && (day == 1) && (date > 24)) document.write(" - Memorial Day");
 // June
 if ((month == 5) && (date == 6)) document.write(" - D-Day (USA)");
 if ((month == 5) && (date == 14)) document.write(" - Flag Day (USA)");
 if ((month == 5) && (date == 21)) document.write(" - Summer Solstice");
 // if ((month == 5) && (day == 0) && (date > 15) && (date< 24)) document.write(" - Fathers' Day");
 if ((month == 5) && (day == 0) && (date >= 15)) { // AGW Begin
  // Fathers' Day = 3rd Sunday in June
  sunday = 0;
  nthweek = 3;
  tempd = new Date(year, month, 1);
  firstDayOfMonth = tempd.getDay();
  offset = sunday - firstDayOfMonth;
  if(offset < 0) 
   offset += 7;
  tdate = (nthweek - 1) * 7 + 1 + offset;
  fathersday.setDate(tdate);
  fathersday.setMonth(month);
  fathersday.setYear(year);
  if (date == fathersday.getDate())
   document.write(" - Fathers' Day");
 } // AGW end
 // July
 if ((month == 6) && (date == 4)) document.write(" - Independence Day (USA)");
 // August
 // September
 if ((month == 8) && (day== 1)&& (date > 0) && (date< 8)) document.write(" - Labor Day (USA)");
 // October
 if ((month == 9) && (day == 1) && (date > 7) && (date < 16)) document.write(" - Columbus Day");
// DST rules have changed! if ((month == 9) && (day == 0) && (date > 24) && (date <= 31)) document.write(" - Daylight Saving Time Ends");
if ((month == 10) && (day == 0) && (date > 0) && (date < 8)) document.write(" - Daylight Saving Time Ends");
 if ((month == 9) && (date == 24)) document.write(" - United Nations Day");
 if ((month == 9) && (date == 31)) document.write(" - Halloween");
 // November
 if ((month == 10) && (date == 1)) document.write(" - All Saints Day");
 if ((month == 10) && (date == 2)) document.write(" - All Souls Day");
 if ((month == 10) && (date == 11)) document.write(" - Veterans' Day");
 if ((month == 10) && (date >= 22)) { // AGW begin
  // Thanksgiving and Black Friday
  thursday = 4;
  nthweek = 4;
  tempd = new Date(year, month, 1);
  firstDayOfMonth = tempd.getDay();
  offset = thursday - firstDayOfMonth;
  if(offset < 0) 
   offset += 7;
  tdate = (nthweek - 1) * 7 + 1 + offset;
  thanksgiving.setDate(tdate);
  thanksgiving.setMonth(month);
  thanksgiving.setYear(year);
  // Thanksgiving = 4th Thursday in November
  if (day == 4) {
   if (date == thanksgiving.getDate())
    document.write(" - Thanksgiving (USA)");
  // Black Friday = Day after Thanksgiving
  } else {
   var blackfriday = new Date(year, month, tdate + 1); // AGW
   if (date == blackfriday.getDate())
    document.write(" - Black Friday");
  }
 } // AGW end
 // December
 if ((month == 11) && (date == 21)) document.write(" - Winter Solstice");
 if ((month == 11) && (date == 24)) document.write(" - Christmas Eve");
 if ((month == 11) && (date == 25)) document.write(" - Christmas");
 if ((month == 11) && (date == 31)) document.write(" - New Year's Eve");
 document.write(".");
//-->
