/**
  AddressDecoder is Copyright 2009, Wesley Noles, Fort Worth Japanese Society.
  
  AddressDecoder is free software. It may be used, modified, or redistributed,
  provided this copyright notice is included without modification.
  
  AddressDecoder is made available without warranty of any kind.  
  No support is provided.
*/

/**
 * Decode a given string with a key.
 * Note: This algorithm provides no security of any kind.
 * It simply helps obfuscate email addresses (or any other string)
 * used in .html files.
 * @param {String} encodedStr  The encoded string
 * @param {String} key  The encoding key
 * @returns {String}  The decoded string.
 */
function decode (encodedStr, key)
{
  var str = new String();
  var i = 0;
  while (encodedStr.length > 0)
  {
    var hexPart = encodedStr.slice (0, 2);
    encodedStr = encodedStr.slice (2, encodedStr.length);
    str += String.fromCharCode (
        parseInt (hexPart, 16) ^ key.charCodeAt (i % key.length));
    ++i;
  }
  return (str);
}

