function friendlyDate (suppliedDate)
{
  if (arguments.length == 0)
    var sourceDate = date (document.lastModified);
  else
    var sourceDate = suppliedDate;
  var dateDayNumber = (Date.UTC (sourceDate.getFullYear (),
                                 sourceDate.getMonth (),
                                 sourceDate.getDate (),
                                 0, 0, 0)) / 86400000;
  var todayDayNumber = (Date.UTC (today.getFullYear (),
                                  today.getMonth (),
                                  today.getDate (),
                                  0, 0, 0)) / 86400000;
  var daysAgo = todayDayNumber - dateDayNumber;
  var words;
  if (daysAgo >= 730)
    words = Math.round (daysAgo / 365.25) + " years ago";
  else if (daysAgo >= 60)
    words = Math.round (daysAgo / 30.4167) + " months ago";
  else if (daysAgo >= 14)
    words = Math.round (daysAgo / 7) + " weeks ago";
  else if (daysAgo > 1)
    words = daysAgo + " days ago";
  else if (daysAgo == 1)
    words = "yesterday";
  else if ((sourceDate.getHours () == 0) && (sourceDate.getMinutes () == 0) && (sourceDate.getSeconds () == 0))
    words = "today";
  else
    words = "today at " + sourceDate.getHours ().twoDigits () + ":" + sourceDate.getMinutes ().twoDigits ()
  return words.tagged ("<span style=cursor:default title='Automatically generated friendly date format\nCourtesy of SmartWare Consulting'>");
}

function copyrightYear ()
{
  var copyrightDate = date (document.lastModified);
  if (document.lastModified == "")
    copyrightDate = new Date ();  // xx this is a Chrome bug - retest after updating Chrome
  return copyrightDate.getFullYear ().tagged ("<span style=cursor:default title='Automatically generated copyright year\nCourtesy of SmartWare Consulting'>");
}

