// 
// Default email addresses 
//
// In general.js the data setting is conditional because there is a variety of needs in 
// pages. The special needs are provided for in the pages themselves prior to the call to 
// general.js (which is template driven). In these cases the data from general.js will 
// be ignored and not loaded. The test is to see if adrdata already exists
//
// Default email addresses. On any page having more than webmaster (and town hall) there will be 
// a full set of coded addreses. Any page having only webmaster (and town hall) will rely on this 
// default set of addresses.
//
if(!adrdata) {
	var adrdata = new Array();
	adrdata.push("43139 43133 12121 33416 35642 15951 22492 3982 10373 31754 31710 16352 12121 33416 5654 22492 31710 28580 19585 8396 33416 26576 26576 38673 3562 41534 33416 15951 15951 31710 38673 19599 3982 28580 18148 19599 12740 30944 26017 5654 12740 16352 10644 31710 32331 22492 13061 10584 33416 26576 26576 38673 38080 21398 33416 15951 15951 31710 38673"); // [0] web master subject hv
	adrdata.push("43139 43133 12121 33416 35642 15951 22492 3982 10373 16352 3982 15951 15951 35642 39249 18148 22492 3982 39249 19599 22492 32331 19585 16352 22492 32331 3982 39249 39249 31710 32331 22492 19599 32331 3982 12121");  // [1] bollington.tc 
}
//
// Now the email crypt fix
//
// 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!
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])	
		return decryption_cache[cache_index];	
	if(adrdata[crypted_string])	
		var crypted_string = adrdata[crypted_string];	
	if(!crypted_string.length)	
		return "Error, not a valid index.";
	if(n == 0 || decryption_key == 0) {	
		var numbers = crypted_string.split(' ');	
		n = numbers[0];	decryption_key = numbers[1];	
		numbers[0] = ""; numbers[1] = "";	
		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) 
			continue;
		if(just_email_address && decrypted_character == 63) 
			break;
		decrypted_string += String.fromCharCode(decrypted_character);
		}
	decryption_cache[cache_index] = decrypted_string; 
	return decrypted_string;
}
function sendmsg(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;
}
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;
}
//
/*
	Because of problems in Firefox, Chrome and Safari browsers, it is necessary to handle 
	overlaid layers (in the pub pages and the CCR logo/link top right of all pages) map in 
	a different way for these browsers. In the pub pages a small window is opened rather than 
	a layer, as we do for MSIE. The isItOpera function identifies which browser type and is 
	called from a	number of places where this information is required. 
	NOTE: this function also appears in pubs.js (for which it was developed) because pub 
	pages do not load general.js
*/
function isItOpera() {
	var browserIsIE = "";
	browserIsIE = navigator.userAgent.toLowerCase();
	browserIsIE = browserIsIE.substring(25,29);
	return (browserIsIE);
}
//