/*

    Routines written by John Gardner - 2004
    See www.braemoor.co.uk/software
    Modified by Dallas Vogler - 2006
    DST routine added 30-Dec-2007

*/

function writeDateModified (time) {

  var tZone = "";

  var days = new Array;
  days[0] = "Sunday";
  days[1] = "Monday";
  days[2] = "Tuesday";
  days[3] = "Wednesday";
  days[4] = "Thursday";
  days[5] = "Friday";
  days[6] = "Saturday";

  var months = new Array;
  months[0] = "January";
  months[1] = "February";
  months[2] = "March";
  months[3] = "April";
  months[4] = "May";
  months[5] = "June";
  months[6] = "July";
  months[7] = "August";
  months[8] = "September";
  months[9] = "October";
  months[10] = "November";
  months[11] = "December";

  var modDate = new Date(Date.parse(document.lastModified));

  if (modDate != 0) {
    var day = days[modDate.getDay()];
    var ndate = modDate.getDate();
    var month = months[modDate.getMonth()];
    var monthNum = modDate.getMonth();
    var year = modDate.getYear();

    if (year < 1000) year = year + 1900;

    if (time) {
      var hour = modDate.getHours().toString();
      if (hour.length == 1) hour = "0" + hour;
      var minute = modDate.getMinutes().toString();
      if (minute.length == 1) minute = "0" + minute;
      var second = modDate.getSeconds().toString();
      if (second.length == 1) second = "0" + second;
    }

// Equations by Wei-Hwa Huang
// The date in March that DST begins
    var dstBegin = 14 - (Math.floor (1 + year * 5 / 4) % 7);
// The date in November that DST ends
    var dstEnd = 7 - (Math.floor (1 + year * 5 / 4) % 7);
    
// Is it January, February, or December?
    if (monthNum < 2 || monthNum == 11) {
    tZone = "EST";
    } else {
// Is it before the second Sunday in March?
    if (monthNum == 2 && ndate < dstBegin) {
    tZone = "EST";
    } else {
// Is it on or after the first Sunday in November?
    if (monthNum == 10 && ndate >= dstEnd) {
    tZone = "EST";
    } else {
    tZone = "DST";
          }
       }
    }
    
    document.write("<p style=\"text-align: center; font-size: 8pt\">");
    document.write("This page was last updated on<br />");
    document.write(day + ", " + month + " " + ndate + ", " + year + " at ");
    if (time) {
      document.write(hour + ":" + minute + ":" + second + " " + tZone + "</p>");
    }
  }
}