// This JavaScript code dynamically populates a footer on each web page where it is called.
// It should be called in the <body> section of a document, immediately before the
// </body> tag, and immediately after the creation of an element with id "footer",e.g.,

/*
<div class="footer" id="footer">&nbsp;</div>
<script type="text/javascript" src="footer.js"></script>
</body>
*/

// It is suggested that each page using this script contain script in the <head>
// section defining the variables authorname and authoraddress, e.g.,

/*
<script type="text/javascript">
// authorname and authoraddress are declared here for use in the footer
var authorname = 'John Doe';
var authoraddress = 'jdoe@w3.org';
</script>
*/

// If the page fails to declare an author name and address, create default values
if (authorname == null) var authorname = 'Webmaster';
if (authoraddress == null) var authoraddress = 'webmaster@' + document.domain;

var footerstring = '';
footerstring += 'This page is located at <a href="' + location.href + '">';
footerstring += location.href + '</a>.<br />It was written and designed by <address><a href="mailto:';
footerstring += authoraddress + '">' + authorname + '</a></address>, and last modified ';

var revised = new Date(document.lastModified);

footerstring += revised.toLocaleString() + '.'

footerstring += ' <a href="http://validator.w3.org/check/referer">Validate this code!</a>';

// This line populates the footer, which must already exist with id "footer".
document.getElementById('footer').innerHTML = footerstring;
