var offset = 7;

function encode(str)
{
  var encoded = "";
  for (var i = 0; i < str.length; i++)
  {
    var c = str.charCodeAt(i) + offset;
    encoded += c ;
    if (i < str.length - 1) encoded += ",";
  }
  document.write(encoded); 
}

function decode(email)
{
    var str = "";
    email = email.split(",");

    for (var i = 0; i < email.length; i++)
    {
        var p = email[i] - offset;
        str += String.fromCharCode(p)
    }
    document.write('<a href="mailto:' + str + '">' + str + '</a>');
}

function decodeWithCustomDisplay(email, display)
{
    var str = "";
    email = email.split(",");

    for (var i = 0; i < email.length; i++)
    {
        var p = email[i] - offset;
        str += String.fromCharCode(p)
    }
    document.write('<a href="mailto:' + str + '">' + display + '</a>');
}

if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
