if (typeof($) == 'undefined') document.write('<script type="text/javascript" src="http://www.hcren.net/js/tools.php"></scr' + 'ipt>');

jmPass = function (Key) {
	this.key = Key == null ? '5765993049608287' : Key;
}

jmPass.prototype.Encryption = function () {
	if (this.Text == null) return null;
	var i = 0, j, k, l, z = '', text = this.strrev(escape(this.Text));
	for (; i < text.length; i++) {
		j = text.substr(i, 1); j = j.charCodeAt(0);
		j = j.toString(16); z += j.length < 2 ? '0' + j : j;
	}
	for (i = 0, text = z; i < 2; i++) {
		for (j = k = 0, z = ''; j < text.length; j++) {
			if (k > this.key.length - 1) k = 0;
			l = parseInt('0x' + text.substr(j, 1)) ^ parseInt('0x' + this.key.substr(k, 1));
			z += l.toString(16); k++;
		}
		if (i < 1) text = this.strrev(z);
	}
	return text;
}

jmPass.prototype.Decipher = function () {
	if (this.Text == null) return null;
	var i = 0, j, k, l, z, text = this.Text;
	for (; i < 2; i++) {
		for (j = k = 0, z = ''; j < text.length; j++) {
			if (k > this.key.length - 1) k = 0;
			l = parseInt('0x' + text.substr(j, 1)) ^ parseInt('0x' + this.key.substr(k, 1));
			z += l.toString(16); k++;
		}
		text = this.strrev(text);
	}
	for (i = 0, l = ''; i < text.length / 2; i++) {
		j = parseInt('0x' + z.substr(i * 2, 2));
		l += String.fromCharCode(j);
	}
	return unescape(this.strrev(l));
}

jmPass.prototype.strrev = function (x) {
	for (var i = x.length - 1, y = ''; i > -1; i--) y += x.substr(i, 1);
	return y;
}
