//  Plugin Name: Email Cloaking Device
//	Plugin URI: http://www.DirectPartners.com
//	Description: Javascript Object for obfuscating email addresses
	
//	Author: T. Hahn
//	Version: 1.0
//	Author URI: http://www.DirectPartners.com/

function Obfuscator(txt, ext, domain, prefix, active) {
    this.txt = txt;
    this.ext = ext;
    this.domain = domain;
    this.prefix = prefix;
    this.active = active;
    this.p = "f='ma";
    this.t = String.fromCharCode(97);
    this.E = "/";
    this.A = String.fromCharCode(105, 108, 116);
    this.N = ">";
    this.o = " hre";
    this.s = "<";
    this.LL = "o:";
    this.D = "'";
    this.seperatorOne = String.fromCharCode(64);
    this.seperatorTwo = String.fromCharCode(46);
}

Obfuscator.prototype.stopAll = function() {
    var encode;
    var addr = this.prefix + this.seperatorOne + this.domain + this.seperatorTwo + this.ext;

    // if text param is empty, set text to address
    if (this.txt == "") {
        this.txt = addr;
    }

    // creates active link
    if (this.active) {
        encode = this.start() + addr + this.D + this.N + this.txt + this.end();
    }
    // creates text address
    else {
        encode = addr;
    }

    document.write(encode);
}

Obfuscator.prototype.start = function() {
    return (this.s + this.t + this.o + this.p + this.A + this.LL);
}

Obfuscator.prototype.end = function() {
    return (this.s + this.E + this.t + this.N);
}
