//custom javascript functions


// Email obfuscator script 2.1 by Tim Williams, University of Arizona
// Random encryption key feature by Andrew Moulden, Site Engineering Ltd
// PHP version coded by Ross Killen, Celtic Productions Ltd
// This code is freeware provided these six comment lines remain intact
// A wizard to generate this code is at http://www.jottings.com/obfuscator/
// The PHP code may be obtained from http://www.celticproductions.net/

//**********************
function writeEncodedEmail(coded, key) {
	var shift = coded.length;
	var link = "";

	for (i=0; i<coded.length; i++) {
		if (key.indexOf(coded.charAt(i)) == -1) {
			var ltr = coded.charAt(i);
			link += (ltr);
		} else {
			var ltr = (key.indexOf(coded.charAt(i)) - shift + key.length) % key.length;
			link += (key.charAt(ltr));
		}
	}

	document.write("<a href='mailto:" + link + "'>" + link + "</a>");
}