/*
 * sendmail.js
 * Invokes the browser's associated e-mail program using an obfuscated e-mail
 * address.
 * 
 * Usage:
 *   <a href="javascript:void(0)"
 *      onclick="return sendmail('\u0075\u0073\u0065\u0072')">send e-mail</a>
 *
 * Parameters:
 *  user (required)   - String representing the username of the recipient. A
 *                      string of Unicode characters is recommended.
 *  domain (optional) - String representing the domain name of the recipient.
 *                      Default value is the domain name of the window.
 *
 * Returns:
 *   false, to override default hyperlink behavior.
 *
 * Author:
 *   David Lindquist (http://www.gazingus.org)
 */
function sendmail(user, domain) {
  
  // protocol
  var p = "\u006d\u0061\u0069\u006c\u0074\u006f\u003a\u0073\u0074\u0061\u0079";
  
  // usename
  var u = user;
  
  // domain name (host name sans machine name)
  //var d = domain ||
  //        location.host.substring(
  //          location.host.lastIndexOf(
  //            ".",
  //            location.host.lastIndexOf(".") - 1
  //          ) + 1
  //        );
  var d = "\u0074\u0068\u0065\u0074\u0072\u0061\u0069\u006c\u006c\u002e\u0063\u006f\u006d\u002e\u0061\u0075"

  void(top.location = p + u + "\u0040" + d);
  return false;
}