var EmailAddress = {

  CHAR_CODE_HEX_COLON: '3a',
  CHAR_CODE_HEX_AT: '40',

  printMailtoLink: function(name, domain, linkAttributes)
  {
    var extraAttrs = '';
    if (linkAttributes != null) {
      for (attr in linkAttributes) {
        extraAttrs += attr + '="' + linkAttributes[attr] + '" ';
      }
    }
    document.write(
      '<a ' + extraAttrs + 'href="' + 'mailto' +
      this._char(this.CHAR_CODE_HEX_COLON) + 
      this._formatEmailAddress(name, domain) + '">' +
      this._formatEmailAddress(name, domain) + '</a>');
  },
    
  _formatEmailAddress: function(name, domain)
  {
    return name + this._char(this.CHAR_CODE_HEX_AT) + domain;
  },

  _char: function(hexCode)
  {
    return unescape('%' + hexCode);
  }
}

