// JavaScript Document

/**
 * Simple encryption to hide email addresses from crawlers in webpages.
 * This code is Free Software provided under an MIT License.
 * Written by Diego Doval: bnaeQ0bvPXOnZQYgaZqp1ZQO
 * http://www.dynamicobjects.com/d2r/
 */


var key = "BAD4@.56CEGFHIJKLVWdfTUhijXYZbacemngMNOPQRSopqrstuvz018923klwxy7";
var base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@.0123456789";
function generateMailLink(encoded, linkText, clstr)
{
  document.write("<a "+clstr+" hr"+"ef=\"ma"+"ilto"+":"+decode(encoded)+"\">"
+linkText+"</"+"a>");
}

function decode(str)
{
  return codec(key, base, str);
}

function codec(from, to, str)
{
  var codedResult = "";
  for (i = 0; i < str.length; i++) {
    current = str.charAt(i);
    idx = from.indexOf(current);
    nextVal = (idx == -1) ? current : to.charAt(idx);
    codedResult += nextVal;
  }
  return codedResult;
}


