
function decrypt(encode)
{
    // original work by Tim Williams, modified by Jerry Du
    
    cipher = "aZbYcXdWeVfUgThSiRjQkPlOmNnMoLpKqJrIsHtGuFvEwDxCyBzA1234567890";

    shift = encode.length;
    decode = "";
    
    for (i=0; i<encode.length; i++)
    {
        if (cipher.indexOf(encode.charAt(i))==-1)
        {
            ltr = encode.charAt(i);
            decode += (ltr);
        }
        else
        {
            ltr = (cipher.indexOf(encode.charAt(i)) - shift + cipher.length) % cipher.length;
            decode += (cipher.charAt(ltr));
        }
    }
    
    return decode;
}

function mail_to(id, dot)
{
    user = decrypt(id);
    domain = decrypt('QCTNFGFGP.RFH');
    
    document.write("<A HREF=\"mailto");
    document.write(":" + user + "@");
    
    if (dot == 1)
        document.write(domain + "\">" + user + "@" + domain + "<\/a>.");
    else
        document.write(domain + "\">" + user + "@" + domain + "<\/a>");
}

function mail_to_txt(id, txt, dot)
{
    user = decrypt(id);
    domain = decrypt('QCTNFGFGP.RFH');
    
    document.write("<A HREF=\"mailto");
    document.write(":" + user + "@");
    
    if (dot == 1)
      document.write(domain + "\">" + txt + "<\/a>.");
    else
      document.write(domain + "\">" + txt + "<\/a>");
}

function mail_decrypt(id)
{
    user = decrypt(id);
    domain = decrypt('QCTNFGFGP.RFH');
    
    document.write(user + "@" + domain);
}
