// This script is (c) copyright 2006 Jim Tucek under the
// GNU General Public License (http://www.gnu.org/licenses/gpl.html)
// For more information, visit www.jracademy.com/~jtucek/email/ 
// Leave the above comments alone!

if(!addresses) var addresses = new Array();
var gk = 0;
var chap = 1;
var dgk = 2;
var chan = 3;
var rec = 4;
var fs = 5;
var treas = 6;
var lect = 7;
var adv = 8;
var war = 9;
var ig = 10;
var og = 11;
var t3 = 12;
var t2 = 13;
var t1 = 14;
var dd = 15;
var fa = 16;
addresses[gk] = "21079 13851 9210 6276 19359 16051 1050 18575 5401 17698 2461 9196 2461 18575 7258 665 6984 1324 18822 9911 13020 18575 6014 17698 2197";
addresses[chap] = "21079 13851 9210 6276 19359 16051 1050 18575 5401 7258 6014 9287 6276 19949 19359 9287 9196 3187 1050 10592 20688 9287 18509 665 7677 6276 1050 1050 6276 3023 18575 18575 17698 6276 13020 18575 6014 17698 2197";
addresses[dgk] = "21079 13851 9210 6276 19359 16051 1050 18575 5401 18509 6014 19359 665 9196 18509 10592 13714 18509 16051 1050 18575 3023 13020 665 18575 9210 2197";
addresses[chan] = "21079 13851 9210 6276 19359 16051 1050 18575 5401 19359 3023 7258 18575 9196 2461 18575 7258 665 6984 1324 18822 9911 13020 18575 6014 17698 18178 3187 20688 13716 10592 18509 665 1050 16191 13874 18509 3187 3187 6276 17698 18509 11689 7258 18575 6014 11689 5657 7677 6276 3023 665 18509 16051 16051 18575 6014";
addresses[rec] = "21079 13851 9210 6276 19359 16051 1050 18575 5401 9287 6276 3023 19359 18509 16051 13714 16051 12254 19605 6177 9196 665 3187 13020 665 18575 9210";
addresses[fs] = "21079 13851 9210 6276 19359 16051 1050 18575 5401 6014 18575 925 665 18509 1324 5197 9196 665 18575 9210 665 6276 3187 1050 13020 3023 18509 1050 2197";
addresses[treas] = "21079 13851 9210 6276 19359 16051 1050 18575 5401 1050 3023 13714 6276 20688 16051 3023 18509 16051 3187 18575 3023 9196 925 6276 7677 18575 18575 13020 665 18575 9210 2197";
addresses[lect] = "21079 13851 9210 6276 19359 16051 1050 18575 5401 19359 3023 7258 18575 9196 2461 18575 7258 665 6984 1324 18822 9911 13020 18575 6014 17698 18178 3187 20688 13716 10592 18509 665 1050 16191 13874 18509 3187 3187 6276 17698 18509 11689 7258 18575 6014 11689 17396 18509 665 1050 18575 6014 18509 6014";
addresses[adv] = "21079 13851 9210 6276 19359 16051 1050 18575 5401 19359 3023 7258 18575 9196 2461 18575 7258 665 6984 1324 18822 9911 13020 18575 6014 17698 18178 3187 20688 13716 10592 18509 665 1050 16191 13874 18509 3187 3187 6276 17698 18509 11689 7258 18575 6014 11689 598 9287 19949 18575 665 6276 1050 18509";
addresses[war] = "21079 13851 9210 6276 19359 16051 1050 18575 5401 9287 6276 3023 1050 7677 18575 9210 19605 9911 9196 665 18575 9210 665 6276 3187 1050 13020 3023 18509 1050 2197";
addresses[ig] = "21079 13851 9210 6276 19359 16051 1050 18575 5401 19359 3023 7258 18575 9196 2461 18575 7258 665 6984 1324 18822 9911 13020 18575 6014 17698 18178 3187 20688 13716 10592 18509 665 1050 16191 13874 18509 3187 3187 6276 17698 18509 11689 7258 18575 6014 11689 9595 3023 3187 19359 9287 18509 11689 20647 20688 6276 6014 9287";
addresses[og] = "21079 13851 9210 6276 19359 16051 1050 18575 5401 19359 3023 7258 18575 9196 2461 18575 7258 665 6984 1324 18822 9911 13020 18575 6014 17698 18178 3187 20688 13716 10592 18509 665 1050 16191 13874 18509 3187 3187 6276 17698 18509 11689 7258 18575 6014 11689 8222 20688 1050 3187 19359 9287 18509 11689 20647 20688 6276 6014 9287";
addresses[t3] = "21079 13851 9210 6276 19359 16051 1050 18575 5401 17698 6276 6014 925 6014 18575 9287 9196 665 18575 9210 665 6276 3187 1050 13020 3023 18509 1050 2197";
addresses[t2] = "21079 13851 9210 6276 19359 16051 1050 18575 5401 19359 3023 7258 18575 9196 2461 18575 7258 665 6984 1324 18822 9911 13020 18575 6014 17698 18178 3187 20688 13716 10592 18509 665 1050 16191 13874 18509 3187 3187 6276 17698 18509 11689 7258 18575 6014 11689 2492 6014 20688 3187 1050 18509 18509 11689 19605";
addresses[t1] = "21079 13851 9210 6276 19359 16051 1050 18575 5401 1050 18575 9210 13714 9196 2461 18575 7258 665 6984 1324 18822 9911 13020 18575 6014 17698 2197";
addresses[dd] = "21079 13851 9210 6276 19359 16051 1050 18575 5401 19918 6276 13716 18509 16051 16051 9196 13716 18509 16051 16051 3187 18575 20688 1050 7677 13020 3023 18509 1050 2197";
addresses[fa] = "21079 13851 9210 6276 19359 16051 1050 18575 5401 9287 6276 3023 19359 18509 16051 13020 3187 665 7677 6276 665 7677 16051 18509 9196 2461 18575 7258 665 13020 18575 6014 17698";

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 crypted_string + " not found";

	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;
}
// -->