// This all assumes spam address harvesters don't actually run the JS on
// the pages they are looking at!
var mail1 = [109,97,105,108,116,111,58];

var mail2 = [64,97,114,99,117,115,46,103,108,111,98,97,108,110,101,
	     116,46,99,111,46,117,107];

function deobfuscate(a)
{
  var t = new Array(a.length);
  for (i = 0; i < a.length; i++) {
    t[i] = String.fromCharCode(a[i]);
  }
  var s = t.join(""); 
  return s;
}

function mailtotag(name)
{
  return '<a href="' + deobfuscate(mail1) + name + deobfuscate(mail2) + '">';
}

function mailaddr(name)
{
  return name + deobfuscate(mail2);
}

function writeFooterAux(typestring, typeimage)
{
  var s = mailtotag('web');
  document.writeln('<img src="/cgi-bin/Count.cgi?df=arcus.dat&sh=F">');
  document.writeln('<div class="footer"><hr\/><table class="footer">');
  document.writeln('<tr><td class="footermail">');
  document.writeln('<a href="/~arcus/comments.html?'+escape(location.href)+'">Leave a comment</a>');
  //document.writeln('<a href="/~arcus/comments.html">Leave a comment</a>');
  //document.writeln(s + 'Comments<\/a>');
  document.writeln('<\/td>');
  if (document.lastModified) {
    document.writeln('<td class="footerdate">');
    var date = new Date(document.lastModified);
    document.writeln('Last modified: ' + date.toLocaleString());
    document.writeln('<\/td>');
  }
  document.writeln('<td class="footerlogo">');
  document.writeln('<a href="http://validator.w3.org/check?uri=referer"><img border="0"');
  document.writeln('src="http://www.w3.org/Icons/' + typeimage + '"');
  document.writeln('alt="' + typestring + '" height="31" width="88"\/><\/a>');
  document.writeln('<\/td>');
  document.writeln('<\/tr><\/table><\/div>');
}

function writeFooter() {
 writeFooterAux('Valid HTML 4.01', 'valid-html401');
}

function writeXMLFooter() {
 writeFooterAux('Valid XHTML 1.0', 'valid-xhtml10');
}

function diag(s)
{
  if (window) {
    alert(s);
  } else {
    print(s);
  }
}

function assert(x,s)
{
  if (!x) {
    diag(s);
    throw(s); // Old style
    //throw(new Error(s)); // New style
  }
}
