// #############################################################################

String.prototype.rot13 = function () {

// Perform rot13 encoding on an ASCII character string. Characters outside the
//   ASCII range (65-90 & 97-122) are left unchanged.

   var result = "";
   for (var count=0; count < this.length; count++) {
      var code = this.charCodeAt(count);
      if ((code  >= 65 && code <= 90) || (code >= 97 && code <= 122)) {
         code += 13;
         if ((code > 90 && code < 104 ) || code > 122) code -= 26;
      }
      result += String.fromCharCode(code)
   }
   return result;
}
// #############################################################################

function contactLink() {
   // This just provides a means of generating email links in a page without
   // them appearing as obvious email addresses in the HTML source. This should
   // help to reduce the risk of addresses being harvested for junk mail.
   this.symbol = String.fromCharCode(64);
}

contactLink.prototype.c = function(addr) {
   this.place = addr.rot13();
}

contactLink.prototype.b = function(addr) {
   this.person = addr.rot13();
}

contactLink.prototype.link = function(subject) {
   url = this.person+this.symbol+this.place;
   var link = '<a href=mailto:'+url;
   if (subject) {
      link += '?Subject='+subject.replace(/ /g,'%20');
   }
   link += '>'+url+'</a>';
   return link;
}

