// DateModified.js
//
// Change history
//
// Who	When	Why
// ===	=======	=============================================
// jmp  13sep07 created
// jmp  23may07 remove m+1 and m-1
//
// format script to embed "This page was last updated on day, date month year" 
// example: This page was last modified Wednesday, 27 June 2007
//
function date_ddmmmyy(date)
{
  var da = date.getDay();
  var d = date.getDate();
  var m = date.getMonth();
  var y = date.getYear();

  // handle different year values
  // returned by IE and NS in
  // the year 2000.

  if( y <= 2000)
  {
    y += 1900;
  }

  // could use splitString() here
  // but the following method is
  // more compatible

  var myDays= ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];

  var myDay = myDays[da];

  var myMonths = ["January","February","March","April","May","June","July","August","September","October","November","December"];

  var mmm = myMonths[m];

  return "" +
    myDay + ", " +
    d + " " +
    mmm + " " +
    (y<10?"0"+y:y);
}


//
// get last modified date of the
// current document.
//
function date_lastmodified()
{
  var lmd = document.lastModified;
  var s   = "Unknown";
  var d1;

  // check if we have a valid date
  // before proceeding
  if(0 != (d1=Date.parse(lmd)))
  {
    s = "" + date_ddmmmyy(new Date(d1));
  }

  return s;
}

//
// finally display the last modified date
// as DAY, D Month YYYY
//
document.write(
  "This page was last updated on " +
  date_lastmodified() );

// 

