// Email obfuscator script 2.1 by Tim Williams, University of Arizona
// Random encryption key feature by Andrew Moulden, Site Engineering Ltd
// This code is freeware provided these four comment lines remain intact
// A wizard to generate this code is at http://www.jottings.com/obfuscator/

var decryption_cache = new Array();
function decript(n) {
	if(decryption_cache[n]) {
		return decryption_cache[n];
	}
	shift=coded[n].length
	decrypted_string=""
	for (i=0; i<coded[n].length; i++) {
		if (key[n].indexOf(coded[n].charAt(i))==-1) {
			ltr = coded[n].charAt(i)
			decrypted_string += (ltr)
		} else {     
			ltr = (key[n].indexOf(coded[n].charAt(i))-shift+key[n].length) % key[n].length
			decrypted_string += (key[n].charAt(ltr))
		}
	}
	decryption_cache[n] = decrypted_string;
	return decrypted_string;
}

function decrypt_and_email(n) {
	var decrypted_string = decript(n);
	parent.location = 'mailto:'+decrypted_string;
}

function decrypt_and_echo(n) {
	var decrypted_string = decript(n);
	while (document.getElementById("email"+n).firstChild) {
		document.getElementById("email"+n).removeChild(document.getElementById("email"+n).firstChild);
	}
        document.getElementById("email"+n).appendChild(document.createTextNode(decrypted_string));
	//document.write(decrypted_string);
	return true;
}
