var lastvisited = new Date(); 

// Convert GMT number to local time string
function localtime(tim)
{
  xtime = new Date(tim);
  if (xtime.getTime() == 0) return "Never";
  return xtime.toLocaleString();
}

// Write out the date and time of the last modification to the source file
function showlastmod()
{
  document.write("Last Updated: ", localtime(document.lastModified));
  
  // Check whether this page has changed since the viewer last visited it.
  getlastvisit(getpagename());
  lastmod = new Date(document.lastModified);
  if (lastmod > lastvisited.getTime()) {
    document.write('&nbsp;<img SRC="../images/new.png" height=19 width=37>');
  }
  document.write("<BR>");
}


// Extract the page filename from the document.location
function getpagename()
{
  pagename = "" + document.location;
  return pagename.substring(pagename.lastIndexOf("/")+1, pagename.length);
}


// Find the cookie belonging to the current page to find
// when this page was last visited. It also resets the last visited date
// in the cookie to the present time

function getlastvisit(pagename)
{
  today = new Date();
  temp = getCookie(pagename);
  if (temp == null) {
    lastvisited.setTime(0);
  } else {
    lastvisited.setTime(temp*1000);
  }
  setCookie(pagename, today.getTime()/1000); 
} 


// Extract the cookie specified by name and return its value.
function getCookie(byname)
{
  byname = byname + "=";
  nlen = byname.length;
  fromN = document.cookie.indexOf(byname) + 0;
  if ((fromN) != -1) {
    fromN += nlen; 
    toN = document.cookie.indexOf(";", fromN) + 0;
    if (toN == -1) {
      toN = document.cookie.length;
    } 
    return unescape(document.cookie.substring(fromN,toN));
  } 
  return null;
}


// Write new data to the viewer's cookie
function setCookie(name, value, time)
{
  exp = new Date();
  if ((name == null) || (value == null)) return false; 
  if (time == null) time=365*86400000; 
  exp.setTime(exp.getTime()+time);
  document.cookie = escape(name) + "=" + escape(value) + "; " + "expires=" + exp.toGMTString();
  return true;
} 







