// eMail Obfuscator Script 2.1 by Tim Williams - freeware
function decode(email)
{
  coded = email;
  // if you change this cipher you must also change it in silent_decode() below and in the setup.php::obfuscate() function
  // below is scramble of all characters to translate (a-zA-Z0-9@._)
  cipher = "st6QJ3W4kLK.mcAxgSqO2ywFXCTYfZp9d@r_Puh5NnbeIvDzRBjE0Ho8la1MiGU7V";
  shift = coded.length;
  link = "";
  text = "";
  parameter_found = false;
  for (i = 0; i < coded.length; i++) {
    if (cipher.indexOf(coded.charAt(i)) == -1) {
      ltr = coded.charAt(i);
      link += ltr;
      if (!parameter_found) {
        if (ltr == '&' || ltr == '?') parameter_found = true;
        else text += ltr;
      }
    } else {
      ltr = (cipher.indexOf(coded.charAt(i)) + shift + cipher.length) % cipher.length;
      link += cipher.charAt(ltr);
      if (!parameter_found) text += cipher.charAt(ltr);
    }
  }
  document.write("<a href='mailto:" + link + "'>" + text + "</a>")
}

function silent_decode(email)
{
  coded = email;
  cipher = "st6QJ3W4kLK.mcAxgSqO2ywFXCTYfZp9d@r_Puh5NnbeIvDzRBjE0Ho8la1MiGU7V";
  shift = coded.length;
  link = "";
  text = "";
  parameter_found = false;
  for (i = 0; i < coded.length; i++) {
    if (cipher.indexOf(coded.charAt(i)) == -1) {
      ltr = coded.charAt(i);
      link += ltr;
      if (!parameter_found) {
        if (ltr == '?') parameter_found = true;
        else text += ltr;
      }
    } else {
      ltr = (cipher.indexOf(coded.charAt(i)) + shift + cipher.length) % cipher.length;
      link += cipher.charAt(ltr);
      if (!parameter_found) text += cipher.charAt(ltr);
    }
  }
  return link;
}
