// Steven Ericsson Zenith
// http://www.memeio.com

// Immediacy Notification
// Write to the page a notification regarding
// The last time the file was modified.
// This code simply generates a string

function immediacy () {
// in seconds
var here        = new Date(document.lastModified) //This will be a PDT timestamp
var there       = new Date()                                // the local time
var age         = (there - here) /1000
var days        = Math.floor(age / 86400)
var dayminutes =  Math.floor( (age / 86400 - days) * 86400 / 60)
var hours       = Math.floor(dayminutes / 60)
var minutes = dayminutes < 60 ? Math.floor((dayminutes / 60) * 60) : Math.floor(dayminutes)

if (days > 0) {
        if (days > 1) {
        document.writeln('Updated ', days , ' days ago.')
         } else {
        document.writeln('This page updated yesterday.')
         }
  } else if ( hours > 0 && days != -1 ) {
        // days = -1 indicates the client/server clock is out of sync
        if (hours == 1)
        document.writeln('Updated an hour ago.')
        else
        document.writeln('Updated ', hours , ' hours ago.')
  } else if ( minutes <= 5 || days == -1  ) {
     document.writeln('This page updated moments ago!')
  } else {
     document.writeln('Updated just ', minutes , ' minutes ago.')
  }
}
 
function ximmediacy () {
 // in seconds
 var here        = new Date(document.lastModified) //This will be a PDT timestamp
 var there       = new Date()                      // the local time
 var age         = (there - here) /1000
 var days        = Math.floor(age / 86400)
 var dayminutes  =  Math.floor( (age / 86400 - days) * 86400 / 60)
 var hours       = Math.floor(dayminutes / 60)
 var minutes = dayminutes < 60 ? Math.floor((dayminutes / 60) * 60) : Math.floor(dayminutes)
 
 if (days > 0) {
     if (days > 1) {
         immediacy = 'Updated ' + days + ' days ago.'
     } else {
         immediacy = 'This page updated yesterday.'
     }
} else if ( hours > 0 && days != -1 ) {
 // days = -1 indicates the client/server clock is out of sync
     if (hours == 1)
         immediacy = 'Updated an hour ago.'
     else
         immediacy = 'Updated ' + hours + ' hours ago.'
} else if ( minutes <= 5 || days == -1  ) {
    immediacy = 'This page updated moments ago!'
} else {
    immediacy = 'Updated just ' + minutes + ' minutes ago.'
}
    return immediacy
}
