﻿// reverse string
String.prototype.reverse = function () {
    splitext = this.split("");
    revertext = splitext.reverse();
    reversed = revertext.join("");
    return reversed;
}

var spockBlam = {};
spockBlam.Email = {};

// unobfuscate an email address
spockBlam.Email.decMail = function (sAddr)
{
    var s;
    var n;
    var retVal = "";

    // parse hex encoded string
    for (i = 0; i < sAddr.length; ) {

        // the nibbles have been reversed in encMail
        s = sAddr.charAt(i + 1) + sAddr.charAt(i);
        n = parseInt(s, 16);

        // subtract magic number added in encMail
        n -= 0x6f;

        retVal += String.fromCharCode(n);
        i += 2;
    }
    return retVal;
}

// opens up the email client to send the email
spockBlam.Email.mailSend = function (sAddr) {
    location.href = this.decMail(sAddr);
}
