/* EMAIL ENCRYPTION SCRIPT */

// This script is (c) copyright 2008 by Dan Appleman under the
// GNU General Public License (http://www.gnu.org/licenses/gpl.html)
// This script is modified from an original script by Jim Tucek
// For more information, visit www.danappleman.com 
// Leave the above comments alone!
// see encryption_instructions.txt for explanation of usage

var decryption_cache = new Array();

function decrypt_string(crypted_string,n,decryption_key,just_email_address) {
	var cache_index = "'"+crypted_string+","+just_email_address+"'";

	if(decryption_cache[cache_index])					// If this string has already been decrypted, just
		return decryption_cache[cache_index];				// return the cached version.

	if(addresses[crypted_string])						// Is crypted_string an index into the addresses array
		var crypted_string = addresses[crypted_string];			// or an actual string of numbers?

	if(!crypted_string.length)						// Make sure the string is actually a string
		return "Error, not a valid index.";

	if(n == 0 || decryption_key == 0) {					// If the decryption key and n are not passed to the
		var numbers = crypted_string.split(' ');			// function, assume they are stored as the first two
		n = numbers[0];	decryption_key = numbers[1];			// numbers in crypted string.
		numbers[0] = ""; numbers[1] = "";				// Remove them from the crypted string and continue
		crypted_string = numbers.join(" ").substr(2);
	}

	var decrypted_string = '';
	var crypted_characters = crypted_string.split(' ');

	for(var i in crypted_characters) {
		var current_character = crypted_characters[i];
		var decrypted_character = exponentialModulo(current_character,n,decryption_key);
		if(just_email_address && i < 7)				// Skip 'mailto:' part
			continue;
		if(just_email_address && decrypted_character == 63)	// Stop at '?subject=....'
			break;
		decrypted_string += String.fromCharCode(decrypted_character);
	}
		decryption_cache[cache_index] = decrypted_string;			// Cache this string for any future calls

	return decrypted_string;
}

function decrypt_and_email(crypted_string,n,decryption_key) {
	if(!n || !decryption_key) { n = 0; decryption_key = 0; }
	if(!crypted_string) crypted_string = 0;

	var decrypted_string = decrypt_string(crypted_string,n,decryption_key,false);
	parent.location = decrypted_string;
}

function decrypt_and_echo(crypted_string,n,decryption_key) {
	if(!n || !decryption_key) { n = 0; decryption_key = 0; }
	if(!crypted_string) crypted_string = 0;

	var decrypted_string = decrypt_string(crypted_string,n,decryption_key,true);
	document.write(decrypted_string);
	return true;
}

// Finds base^exponent % y for large values of (base^exponent)
function exponentialModulo(base,exponent,y) {
	if (y % 2 == 0) {
		answer = 1;
		for(var i = 1; i <= y/2; i++) {
			temp = (base*base) % exponent;
			answer = (temp*answer) % exponent;
		}
	} else {
		answer = base;
		for(var i = 1; i <= y/2; i++) {
			temp = (base*base) % exponent;
			answer = (temp*answer) % exponent;
		}
	}
	return answer;
}

// Remove the comments below to improve spam resistance! 
// email addresses: 

 if(!addresses) var addresses = new Array();
addresses.push("37837 37831 24915 37740 15648 25228 3809 8118 58 16914 37740 25228 14545 16914 2105 15648 32609 3809 14545 28516 36163 30975 28516 8118 30975 32609 122 5746 16914 14247 12148 2304 14545 28516 3809 16581 35256 32609 18796 14247 15648 14173 34190 14098 20151 14173 8118 24915 14098 28658 32609 3809 14545 28516 36163 14098 28658 32609 16914 3809 14173 14247 24915 14545 32609 3809 16914 14098 30967 14545 12148 16914 15648 3809 14545");
addresses.push("37837 37831 24915 37740 15648 25228 3809 8118 58 14545 3888 18571 8118 14173 3809 2105 15648 32609 3809 14545 28516 36163 30975 28516 8118 30975 32609 122 5746 16914 14247 12148 2304 14545 28516 3809 16581 35256 32609 18796 14247 15648 14173 34190 14098 20151 14173 8118 24915 14098 28658 32609 3809 14545 28516 36163 14098 28658 32609 16914 3809 14173 14247 24915 14545 32609 3809 16914 14098 30967 14545 12148 16914 15648 3809 14545");
addresses.push("37837 37831 24915 37740 15648 25228 3809 8118 58 37740 14247 28516 37730 16914 37740 25228 14545 16914 2105 15648 32609 3809 14545 28516 36163 30975 28516 8118 30975 32609 122 5746 16914 14247 12148 2304 14545 28516 3809 16581 35256 32609 18796 14247 15648 14173 34190 14098 20151 14173 8118 24915 14098 28658 32609 3809 14545 28516 36163 14098 28658 32609 16914 3809 14173 14247 24915 14545 32609 3809 16914 14098 30967 14545 12148 16914 15648 3809 14545");
addresses.push("37837 37831 24915 37740 15648 25228 3809 8118 58 2304 8118 36163 32609 2105 15648 32609 3809 14545 28516 36163 30975 28516 8118 30975 32609 122 5746 16914 14247 12148 2304 14545 28516 3809 16581 35256 32609 18796 14247 15648 14173 34190 14098 20151 14173 8118 24915 14098 28658 32609 3809 14545 28516 36163 14098 28658 32609 16914 3809 14173 14247 24915 14545 32609 3809 16914 14098 30967 14545 12148 16914 15648 3809 14545");
addresses.push("37837 37831 24915 37740 15648 25228 3809 8118 58 37740 100 14545 25228 16914 37740 25228 14545 16914 2105 8118 32609 14545 3809 14545 24915 18571 30975 28516 8118 24915 30975 37740 14247 5746 16914 14247 12148 2304 14545 28516 3809 16581 35256 32609 18796 14247 15648 14173 34190 14098 20151 14173 8118 24915 14098 28658 32609 3809 14545 28516 36163 14098 28658 32609 16914 3809 14173 14247 24915 14545 32609 3809 16914 14098 30967 14545 12148 16914 15648 3809 14545");
addresses.push("37837 37831 24915 37740 15648 25228 3809 8118 58 24915 14545 25228 12148 16914 37740 25228 14545 16914 2105 8118 32609 14545 3809 14545 24915 18571 30975 28516 8118 24915 30975 37740 14247 5746 16914 14247 12148 2304 14545 28516 3809 16581 35256 32609 18796 14247 15648 14173 34190 14098 20151 14173 8118 24915 14098 28658 32609 3809 14545 28516 36163 14098 28658 32609 16914 3809 14173 14247 24915 14545 32609 3809 16914 14098 30967 14545 12148 16914 15648 3809 14545");
addresses.push("37837 37831 24915 37740 15648 25228 3809 8118 58 16914 34190 100 16914 37740 25228 14545 16914 2105 8118 32609 14545 3809 14545 24915 18571 30975 28516 8118 24915 30975 37740 14247 5746 16914 14247 12148 2304 14545 28516 3809 16581 35256 32609 18796 14247 15648 14173 34190 14098 20151 14173 8118 24915 14098 28658 32609 3809 14545 28516 36163 14098 28658 32609 16914 3809 14173 14247 24915 14545 32609 3809 16914 14098 30967 14545 12148 16914 15648 3809 14545");
addresses.push("37837 37831 24915 37740 15648 25228 3809 8118 58 12148 14173 15648 16914 16914 37740 25228 14545 16914 2105 8118 32609 14545 3809 14545 24915 18571 30975 28516 8118 24915 30975 37740 14247 5746 16914 14247 12148 2304 14545 28516 3809 16581 35256 32609 18796 14247 15648 14173 34190 14098 20151 14173 8118 24915 14098 28658 32609 3809 14545 28516 36163 14098 28658 32609 16914 3809 14173 14247 24915 14545 32609 3809 16914 14098 30967 14545 12148 16914 15648 3809 14545");
addresses.push("37837 37831 24915 37740 15648 25228 3809 8118 58 16914 37740 25228 14545 16914 2105 3809 14545 28516 36163 15648 32609 16914 18571 14545 28516 3809 30975 28516 8118 24915 30975 37740 14247 5746 16914 14247 12148 2304 14545 28516 3809 16581 35256 32609 18796 14247 15648 14173 34190 14098 20151 14173 8118 24915 14098 28658 32609 3809 14545 28516 36163 14098 28658 32609 16914 3809 14173 14247 24915 14545 32609 3809 16914 14098 30967 14545 12148 16914 15648 3809 14545");
addresses.push("37837 37831 24915 37740 15648 25228 3809 8118 58 16914 37740 25228 14545 16914 2105 18571 14173 8118 28516 8118 32609 15648 3809 30975 28516 8118 24915 30975 37740 14247 5746 16914 14247 12148 2304 14545 28516 3809 16581 35256 32609 18796 14247 15648 14173 34190 14098 20151 14173 8118 24915 14098 28658 32609 3809 14545 28516 36163 14098 28658 32609 16914 3809 14173 14247 24915 14545 32609 3809 16914 14098 30967 14545 12148 16914 15648 3809 14545");
addresses.push("37837 37831 24915 37740 15648 25228 3809 8118 58 16914 37740 25228 14545 16914 2105 3809 36163 14545 14173 24915 8118 36163 14247 32609 3809 14545 14173 30975 28516 8118 24915 30975 37740 14247 5746 16914 14247 12148 2304 14545 28516 3809 16581 35256 32609 18796 14247 15648 14173 34190 14098 20151 14173 8118 24915 14098 28658 32609 3809 14545 28516 36163 14098 28658 32609 16914 3809 14173 14247 24915 14545 32609 3809 16914 14098 30967 14545 12148 16914 15648 3809 14545");
addresses.push("37837 37831 24915 37740 15648 25228 3809 8118 58 16914 37740 25228 14545 16914 2105 3809 14545 24915 3809 14173 8118 25228 30975 28516 8118 24915 30975 37740 14247 5746 16914 14247 12148 2304 14545 28516 3809 16581 35256 32609 18796 14247 15648 14173 34190 14098 20151 14173 8118 24915 14098 28658 32609 3809 14545 28516 36163 14098 28658 32609 16914 3809 14173 14247 24915 14545 32609 3809 16914 14098 30967 14545 12148 16914 15648 3809 14545");
addresses.push("37837 37831 24915 37740 15648 25228 3809 8118 58 15648 32609 18796 14247 15648 14173 15648 14545 16914 2105 16914 28516 15648 21406 15648 14545 32609 14545 30975 28516 8118 24915 5746 16914 14247 12148 2304 14545 28516 3809 16581 35256 32609 18796 14247 15648 14173 34190 14098 20151 14173 8118 24915 14098 28658 32609 3809 14545 28516 36163 14098 28658 32609 16914 3809 14173 14247 24915 14545 32609 3809 16914 14098 30967 14545 12148 16914 15648 3809 14545");
addresses.push("37837 37831 24915 37740 15648 25228 3809 8118 58 23982 14545 32609 3809 37740 16914 2105 14545 25228 14545 28516 3809 14173 8118 24915 37740 3809 15648 28516 37740 30975 28516 25228 5746 16914 14247 12148 2304 14545 28516 3809 16581 35256 32609 18796 14247 15648 14173 34190 14098 20151 14173 8118 24915 14098 28658 32609 3809 14545 28516 36163 14098 28658 32609 16914 3809 14173 14247 24915 14545 32609 3809 16914 14098 30967 14545 12148 16914 15648 3809 14545");
addresses.push("37837 37831 24915 37740 15648 25228 3809 8118 58 20151 15648 14545 25228 100 37740 3809 37740 2105 20151 15648 14545 25228 100 37740 3809 37740 30975 28516 25228 5746 16914 14247 12148 2304 14545 28516 3809 16581 35256 32609 18796 14247 15648 14173 34190 14098 20151 14173 8118 24915 14098 28658 32609 3809 14545 28516 36163 14098 28658 32609 16914 3809 14173 14247 24915 14545 32609 3809 16914 14098 30967 14545 12148 16914 15648 3809 14545");
addresses.push("37837 37831 24915 37740 15648 25228 3809 8118 58 23982 14545 32609 3809 37740 16914 2105 15648 32609 16914 3809 14173 14247 24915 37740 3809 15648 28516 30975 28516 8118 24915 30975 28516 8118 5746 16914 14247 12148 2304 14545 28516 3809 16581 35256 32609 18796 14247 15648 14173 34190 14098 20151 14173 8118 24915 14098 28658 32609 3809 14545 28516 36163 14098 28658 32609 16914 3809 14173 14247 24915 14545 32609 3809 16914 14098 30967 14545 12148 16914 15648 3809 14545");
addresses.push("37837 37831 24915 37740 15648 25228 3809 8118 58 15648 32609 20151 8118 2105 6332 28516 8118 32609 3809 14173 8118 25228 30975 100 37730 5746 16914 14247 12148 2304 14545 28516 3809 16581 35256 32609 18796 14247 15648 14173 34190 14098 20151 14173 8118 24915 14098 28658 32609 3809 14545 28516 36163 14098 28658 32609 16914 3809 14173 14247 24915 14545 32609 3809 16914 14098 30967 14545 12148 16914 15648 3809 14545");
addresses.push("37837 37831 24915 37740 15648 25228 3809 8118 58 15648 32609 20151 8118 2105 36163 37740 32609 16914 12148 14247 28516 36163 30975 100 37730 5746 16914 14247 12148 2304 14545 28516 3809 16581 35256 32609 18796 14247 15648 14173 34190 14098 20151 14173 8118 24915 14098 28658 32609 3809 14545 28516 36163 14098 28658 32609 16914 3809 14173 14247 24915 14545 32609 3809 16914 14098 30967 14545 12148 16914 15648 3809 14545");
addresses.push("37837 37831 24915 37740 15648 25228 3809 8118 58 15648 32609 20151 8118 2105 37740 15648 36379 37740 32609 37740 25228 34190 3809 15648 28516 37740 25228 30975 28516 8118 24915 30975 16914 21406 5746 16914 14247 12148 2304 14545 28516 3809 16581 35256 32609 18796 14247 15648 14173 34190 14098 20151 14173 8118 24915 14098 28658 32609 3809 14545 28516 36163 14098 28658 32609 16914 3809 14173 14247 24915 14545 32609 3809 16914 14098 30967 14545 12148 16914 15648 3809 14545");
addresses.push("37837 37831 24915 37740 15648 25228 3809 8118 58 15648 32609 20151 8118 2105 36475 100 24915 14247 36163 30975 28516 8118 24915 30975 3809 14173 5746 16914 14247 12148 2304 14545 28516 3809 16581 35256 32609 18796 14247 15648 14173 34190 14098 20151 14173 8118 24915 14098 28658 32609 3809 14545 28516 36163 14098 28658 32609 16914 3809 14173 14247 24915 14545 32609 3809 16914 14098 30967 14545 12148 16914 15648 3809 14545");
addresses.push("37837 37831 24915 37740 15648 25228 3809 8118 58 28516 8118 32609 3809 14173 8118 25228 16914 2105 23982 14545 16914 18571 8118 30975 28516 8118 24915 5746 16914 14247 12148 2304 14545 28516 3809 16581 35256 32609 18796 14247 15648 14173 34190 14098 20151 14173 8118 24915 14098 28658 32609 3809 14545 28516 36163 14098 28658 32609 16914 3809 14173 14247 24915 14545 32609 3809 16914 14098 30967 14545 12148 16914 15648 3809 14545");

