/* 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("7493 7489 2650 2353 3788 1886 5417 1262 6135 785 2268 4516 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [0]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 3782 1886 2353 3788 2650 4905 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [1]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 5039 3409 2268 785 1886 1886 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [2]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 2268 7392 1262 1889 785 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [3]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 7392 2268 785 1889 5417 1262 2268 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [4]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 865 4875 3008 6015 865 785 4905 4905 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [5]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 5039 3409 3788 2268 3782 2353 3788 6553 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [6]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 865 2268 3788 3782 7392 1262 1886 1886 4905 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [7]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 6553 4875 785 6015 4905 785 4476 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [8]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 6015 7392 2353 1889 3409 3788 2268 865 4905 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [9]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 5039 4875 2353 1886 1886 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [10]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 5039 2353 2650 785 6015 4476 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [11]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 5417 2268 1262 5417 5417 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [12]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 2650 1150 1262 6015 5417 2650 2353 2268 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [13]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 5039 3782 1262 3008 5417 5417 4905 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [14]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 6015 4875 6015 1262 1889 2268 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [15]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 2650 4905 2650 2353 1886 785 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [16]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 1150 1889 3788 1886 4905 1262 2268 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [17]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 865 3782 7392 2353 1150 1150 1886 785 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [18]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 1150 7392 2353 1889 3409 3788 2268 4905 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [19]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 2353 6015 1262 3008 2268 4905 785 3776 785 1886 1886 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [20]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 2353 865 1262 6553 6553 2353 6015 6553 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [21]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 3782 6015 3788 6553 865 785 6015 4905 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [22]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 3788 2650 785 5417 3782 2353 1886 7189 785 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [23]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 1150 7392 2353 6553 6553 6015 785 1886 1886 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [24]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 6553 785 2268 6553 785 2353 2268 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [25]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 1150 6553 2353 2268 3788 785 1886 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [26]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 1886 4905 2650 2353 1886 6553 1262 2268 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [27]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 4905 1150 3788 1150 785 6015 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [28]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 5417 2353 1886 1886 785 2268 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [29]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 3409 1889 7392 3788 5417 785 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [30]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 6553 6553 3788 865 4875 4476 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [31]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 4905 7392 3008 4875 4875 2353 6015 6553 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [32]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 865 1889 7392 4476 1886 785 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [33]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 2353 1889 3788 1886 3409 785 4905 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [34]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 2268 1150 3788 2268 3782 1262 5417 5417 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [35]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 4905 1889 7392 3788 5417 785 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [36]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 6553 7392 2353 1889 3409 3788 2268 865 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [37]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 865 7392 2353 1886 1886 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [38]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 3008 1889 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [39]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 7189 1262 1886 6553 4905 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [40]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 1150 1150 7392 3788 1886 1886 3788 1150 4905 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [41]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 4905 1889 785 5417 7392 785 6015 2353 1886 1886 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [42]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 5039 2268 785 1889 7392 2353 2650 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [43]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 785 4875 2353 5417 785 4905 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [44]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 1150 4875 785 2353 3008 2650 1262 2268 5417 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [45]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 1886 7392 2353 6015 6015 3788 4905 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [46]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 4875 6015 3788 3782 7392 2353 6015 6553 4905 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [47]
addresses.push("7493 7489 2650 2353 3788 1886 5417 1262 6135 4905 3782 1262 3008 4905 3788 2268 4905 3685 3782 1262 6015 2268 3788 4905 7392 2650 3008 5417 3008 2353 1886 3670 3782 1262 3670 3008 3409");  // [48]
