// Calendar JavaScript
// Last Updated 22 Feb 07

/*
Copyright © Eugene Vassiltsov. 
*/
function today() {
calendar = new Date();
day = calendar.getDay();
month = calendar.getMonth();
date = calendar.getDate();
year = calendar.getYear();
if (year < 1000)
	year+=1900
cent = parseInt(year/100);
g = year % 19;
k = parseInt((cent - 17)/25);
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));
j = (year + parseInt(year/4) + i + 2 - cent + parseInt(cent/4)) % 7;
l = i - j;
emonth = 3 + parseInt((l + 40)/44);
edate = l + 28 - 31*parseInt((emonth/4));
emonth--;
var dayname = new Array ("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
var monthname =
new Array ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" );
document.write(dayname[day] + " ");
if (date< 10) document.write("0" + date + " ");
else document.write(date + " ");
document.write(monthname[month] + " ");
document.write(year + ' <span style="color:#FF0000">');
// 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) && (date == 4)) document.write("Operation Provide Promise ends (1996)");
if ((month == 0) && (date == 5)) document.write("President Nixon announces Space Shuttle (1972)");
if ((month == 0) && (date == 11)) document.write("Amelia Earhart flies 1st female Pacific solo (1935)");
if ((month == 0) && (date == 27)) document.write("Wolfgang Amadeus Mozart born (1756)");
if ((month == 0) && (date == 25)) document.write("USAF adopts slate-blue uniform (1949)");
if ((month == 0) && (date == 28)) document.write("<em>Challenger</em> explosion (1986)");
if ((month == 0) && (day == 1) && (date > 14) && (date< 22)) document.write("Martin Luther King's Birthday");
// February
if ((month == 1) && (date == 2)) document.write("Groundhog Day");
if ((month == 1) && (date == 6)) document.write("First Titan I ICBM Launch (1959)");
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 == 15)) document.write("Galileo Galilei born (1564)");
if ((month == 1) && (date == 22)) document.write("Washington's Birthday");
if ((month == 1) && (date == 29)) document.write("Leap Day");
// March
if ((month == 2) && (date == 17)) document.write("St. Patrick's Day");
if ((month == 2) && (date == 17)) document.write("Jame Holley 1st Female AFROTC Commissionee (1971)");
if ((month == 2) && (date == 24)) document.write("Operation Allied Force begins (1999)");
if ((month == 2) && (day == 0) && (date > 7) && (date < 15)) document.write("Daylight Savings Time Begins");
// April
if ((month == 3) && (date == 1)) document.write("April Fools' Day");
if ((month == 3) && (date == 10)) document.write("B-1 Lancer attains supersonic speed (1975)");
if ((month == 3) && (date == 15) && (day != 0)) document.write("Income Tax Day");
if ((month == 3) && (date == 16) && (day == 1)) document.write("Income Tax Day");
if ((month == 3) && (date == 22)) document.write("Earth Day");
// May
if ((month == 4) && (date == 1)) document.write("May Day");
if ((month == 4) && (date == 4)) document.write("Tim Cleaver's Birthday");
if ((month == 4) && (date == 5)) document.write("AFROTC includes women in program (1970)");
if ((month == 4) && (date == 7)) document.write("Henry H. Arnold given permenant rank of USAF General (1949)");
if ((month == 4) && (date == 20)) document.write("Capt James Jabara becomes 1st Jet Ace (1951)");
if ((month == 4) && (day == 0) && (date > 7) && (date< 16)) document.write("Mother's Day");
if ((month == 4) && (day == 1) && (date > 24)) document.write("Memorial Day");
// June
if ((month == 5) && (date == 6)) document.write("D-Day");
if ((month == 5) && (date == 12)) document.write("Women's Armed Service Integration Act (1948)");
if ((month == 5) && (date == 14)) document.write("Flag Day");
if ((month == 5) && (date == 21)) document.write("Summer Solstice");
if ((month == 5) && (date == 26)) document.write("Berlin Airlift begins (1948)");
if ((month == 5) && (date == 29)) document.write("USAF ends racial segregation (1949)");
if ((month == 5) && (day == 0) && (date > 15) && (date< 24)) document.write("Father's Day");
// July
if ((month == 6) && (date == 4)) document.write("Independence Day (USA)");
if ((month == 6) && (date == 17)) document.write("First flight of B-2 (1989)");
if ((month == 6) && (date == 26)) document.write("Congress passes National Security Act of 1947");
// August
if ((month == 7) && (date == 6)) document.write("<em>Enola Gay</em> drops 1st atomic bomb (1945)");
if ((month == 7) && (date == 9)) document.write("<em>Bockscar</em> drops 2nd atomic bomb (1945)");
// September
if ((month == 8) && (day== 1)&& (date > 0) && (date< 8)) document.write("Labor Day");
if ((month == 8) && (day== 18)) document.write("United States Air Force Birthday (1947)");
if ((month == 8) && (day== 28)) document.write("Two Douglas Cruisers complete 'round-the-world' flight (1924)");
// October
if ((month == 9) && (day == 1) && (date > 7) && (date< 16)) document.write("Columbus Day");
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 == 6)) document.write("Capt Eddie Rickenbacker awarded Medal of Honor (1930)");
if ((month == 10) && (date == 8)) document.write("First Jet dogfight: F-80 downs MiG-15 (1950)");
if ((month == 10) && (day == 0) && (date > 0) && (date < 8)) document.write("Daylight Savings Time Ends");
if ((month == 10) && (date == 11)) document.write("Veteran's Day (USA)");
if ((month == 10) && (date ==20)) document.write("Revolution Day (Mexico)");
if ((month == 10) && (day == 4) && (date > 23) && (date< 30)) document.write("Thanksgiving (USA)");
if ((month == 10) && (date == 30) && (day == 4)) document.write("Thanksgiving (USA)");
// December
if ((month == 11) && (date == 1)) document.write("Civil Air Patrol created (1941)");
if ((month == 11) && (date == 7)) document.write("Japanese attack Pearl Harbor (1941)");
if ((month == 11) && (date == 17)) document.write("Orville Wright first powered flight (1903)");
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 == 25)) document.write("William 'Billy' Mitchell's birtday (1879)");
if ((month == 11) && (date == 31)) document.write("New Year's Eve");
document.write("</span>");

}

// Last Modified Date
// format date as dd-mmm-yy
// example: 12-Jan-99
//
function date_ddmmmyy(date)
{
  var d = date.getDate();
  var m = date.getMonth() + 1;
  var y = date.getYear();

  // handle different year values 
  // returned by IE and NS in 
  // the year 2000.
  if(y >= 2000)
  {
    y -= 2000;
  }
  if(y >= 100)
  {
    y -= 100;
  }

  // could use splitString() here 
  // but the following method is 
  // more compatible
  var mmm = 
    ( 1==m)?'Jan':( 2==m)?'Feb':(3==m)?'Mar':
    ( 4==m)?'Apr':( 5==m)?'May':(6==m)?'Jun':
    ( 7==m)?'Jul':( 8==m)?'Aug':(9==m)?'Sep':
    (10==m)?'Oct':(11==m)?'Nov':'Dec';

  return "" +
    (d<10?"0"+d:d) + "-" +
    mmm + "-" +
    (y<10?"0"+y:y);
}
