<!--// last_updated.js

/* *****************************************************************************

    - Prints out the last time the html page was saved
    - Explorer format:
        Last updated <Month> <Date>, <Year> - <Time (12-hour)> <Am-Pm>
    - Netscape format:
        Last updated <Month> <Date>, <Year> - <Time (12-hour)> <Am-Pm> *if worked
        Last updated <Day>, <Month> <Date>, <Year> <Time (24-hour)>    *backup
    - Usage (place where desired):
        <script src="last_updated.js" language="JavaScript" type="text/javascript">
        </script>
    - Works in Explorer (tested only on 6.0) and Netscape (tested only
      on Netscape 7.0 and Mozilla 1.3.1), but does not work in Opera (6.01).
    - NOTE: Won't work if SSI is enabled. It will always print the time the
      page was served--because that's when it was parsed, and consequently,
      last updated. If SSI is enabled, use the following instead (with the
      correct closing comments):
        <!--#config timefmt="%A %B %e, %Y - %I:%M %p" ->
        Last updated <!--#echo var="LAST_MODIFIED" ->

***************************************************************************** */

  var modified = document.lastModified;
  var month=""; var date=""; var year="";
  var hour=""; var minute=""; var ampm="";

  /* ************************************************************************ */
  /* ** Explorer ************************************************************ */
  /* ************************************************************************ */

  if (navigator.appName == "Microsoft Internet Explorer") {

    /* Month */
    if (modified.charAt(0) == "0") {
      switch (modified.charAt(1)) {
        case "1": month="January"; break;
        case "2": month="February"; break;
        case "3": month="March"; break;
        case "4": month="April"; break;
        case "5": month="May"; break;
        case "6": month="June"; break;
        case "7": month="July"; break;
        case "8": month="August"; break;
        case "9": month="September"; break;
      }
    } else if (modified.charAt(0) == "1") {
      switch (modified.charAt(1)) {
        case "0": month="October"; break;
        case "1": month="November"; break;
        case "2": month="December"; break;
      }
    }

    /* Date */
    date = modified.substring(3,5);
    if (parseInt(date) < 10) {
      date = date.substring(1,2);
    }

    /* Year */
    year = modified.substring(6,10);

    /* Time */
    if (modified.charAt(11) == "0") {
      ampm = "am";
      switch (modified.charAt(12)) {
        case "0": hour="12"; break;
        case "1": hour="1"; break;
        case "2": hour="2"; break;
        case "3": hour="3"; break;
        case "4": hour="4"; break;
        case "5": hour="5"; break;
        case "6": hour="6"; break;
        case "7": hour="7"; break;
        case "8": hour="8"; break;
        case "9": hour="9"; break;
      }
    } else if (modified.charAt(11) == "1") {
      ampm = "pm";
      switch (modified.charAt(12)) {
        case "0": hour="10"; ampm = "am"; break;
        case "1": hour="11"; ampm = "am"; break;
        case "2": hour="12"; break;
        case "3": hour="1"; break;
        case "4": hour="2"; break;
        case "5": hour="3"; break;
        case "6": hour="4"; break;
        case "7": hour="5"; break;
        case "8": hour="6"; break;
        case "9": hour="7"; break;
      }
    } else if (modified.charAt(11) == "2") {
      ampm = "pm";
      switch (modified.charAt(12)) {
        case "0": hour="8"; break;
        case "1": hour="9"; break;
        case "2": hour="10"; break;
        case "3": hour="11"; break;
      }
    }

    minute = modified.substring(14,16);

    /* Print */
    document.write("Last updated "+month+" "+date+", "+year+" - "+hour+":"+minute+" "+ampm);

  /* ************************************************************************ */
  /* ** Netscape ************************************************************ */
  /* ************************************************************************ */

  } else if (navigator.appName == "Netscape") {

    var pos = 0;
    var c = '';
    var max = modified.length;
    var working = true;  // if unable to parse correctly, bail and print ugly string
    var modifiedLower = modified.toLowerCase();

    /* Chomp Day */
    if (working) {
      c = modifiedLower.charAt(pos);
      while (c != ' ') {
        pos++;
        if (pos < max) {
          c = modifiedLower.charAt(pos);
        } else {
          working = false;
          break;
        }
      } // while
    } // if (working)

    /* Parse Date */
    if (working) {
      pos++;
      c = modifiedLower.charAt(pos);
      while (c != ' ') {
        date += c;
        pos++;
        if (pos < max) {
          c = modifiedLower.charAt(pos);
        } else {
          working = false;
          break;
        }
      } // while
    } // if (working)

    if (parseInt(date) < 10) {
      date = date.substring(1,2);
    }

    /* Parse Month */
    if (working) {
      pos++;
      c = modifiedLower.charAt(pos);
      while (c != ' ') {
        month += c;
        pos++;
        if (pos < max) {
          c = modifiedLower.charAt(pos);
        } else {
          working = false;
          break;
        }
      } // while
    } // if (working)

    if (month.substring(0,3) == "jan") {
      month = "January";
    } else if (month.substring(0,3) == "feb") {
      month = "February";
    } else if (month.substring(0,3) == "mar") {
      month = "March";
    } else if (month.substring(0,3) == "apr") {
      month = "April";
    } else if (month.substring(0,3) == "may") {
      month = "May";
    } else if (month.substring(0,3) == "jun") {
      month = "June";
    } else if (month.substring(0,3) == "jul") {
      month = "July";
    } else if (month.substring(0,3) == "aug") {
      month = "August";
    } else if (month.substring(0,3) == "sep") {
      month = "September";
    } else if (month.substring(0,3) == "oct") {
      month = "October";
    } else if (month.substring(0,3) == "nov") {
      month = "November";
    } else if (month.substring(0,3) == "dec") {
      month = "December";
    } else {
      working = false;
    }

    /* Parse Year */
    if (working) {
      pos++;
      c = modifiedLower.charAt(pos);
      while(c != ' ') {
        year += c;
        pos++;
        if (pos < max) {
          c = modifiedLower.charAt(pos);
        } else {
          working = false;
          break;
        }
      } // while
    } // if (working)

    /* Parse Hour */
    if (working) {
      pos++;
      c = modifiedLower.charAt(pos);
      while (c != ':') {
        hour += c;
        pos++;
        if (pos < max) {
          c = modifiedLower.charAt(pos);
        } else {
          working = false;
          break;
        }
      } // while
    } // if (working)

    if (parseInt(hour) < 12) {
      ampm = "am";
    } else if (parseInt(hour) == 12) {
      ampm = "pm";
    } else {
      ampm = "pm";
      hour = "" + (parseInt(hour)-12);
    }

    /* Parse Minute */
    if (working) {
      pos++;
      c = modifiedLower.charAt(pos);
      while (c != ':' && c != ' ') {
        minute += c;
        pos++;
        if (pos < max) {
          c = modifiedLower.charAt(pos);
        } else {
          working = false;
          break;
        }
      } // while
    } // if (working)

    /* Print */
    if (working) {
      document.write("Last updated "+month+" "+date+", "+year+" - "+hour+":"+minute+" "+ampm);
    } else {
      document.write("Last updated "+modified);
    }
  }

-->
