<!--

/*
=========
BASIC FUNCTIONS
=========
*/
var newWindow = null;
function popup(theURL, winName, features) { 
	closePopup(winName);
	newWindow=window.open(theURL,winName,features);
	newWindow.focus();
}
function closePopup(winName) {
	if (newWindow && newWindow.open && !newWindow.closed) newWindow.close();
}

/* replaces rel="external" with target="_blank" so new window links still validate as XHTML strict */
function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
addDOMLoadEvent(externalLinks);

/*
=========
EMAIL DECRYPTION
In CMS we are encrypting address to kill spambots
=========
*/
function flipLetter (chrLetter) { 
	//  Executes a reflection cipher on the character   
	//  substituting one letter for its alphabetic inverse
	switch(chrLetter) {
		case "a": chrLetter = "z"; break;
		case "b": chrLetter = "y"; break;
		case "c": chrLetter = "x"; break;
		case "d": chrLetter = "w"; break;
		case "e": chrLetter = "v"; break;
		case "f": chrLetter = "u"; break;
		case "g": chrLetter = "t"; break;
		case "h": chrLetter = "s"; break;
		case "i": chrLetter = "r"; break;
		case "j": chrLetter = "q"; break;
		case "k": chrLetter = "p"; break;
		case "l": chrLetter = "o"; break;
		case "m": chrLetter = "n"; break;
		case "n": chrLetter = "m"; break;
		case "o": chrLetter = "l"; break;
		case "p": chrLetter = "k"; break;
		case "q": chrLetter = "j"; break;
		case "r": chrLetter = "i"; break;
		case "s": chrLetter = "h"; break;
		case "t": chrLetter = "g"; break;
		case "u": chrLetter = "f"; break;
		case "v": chrLetter = "e"; break;
		case "w": chrLetter = "d"; break;
		case "x": chrLetter = "c"; break;
		case "y": chrLetter = "b"; break;
		case "z": chrLetter = "a"; break;
	}
	return chrLetter;
}

function encryptString (strPlain) {
	// Convert the string passed to this function from the form to lower case
	strPlain = strPlain.toLowerCase();
	
	// Run the reflection cipher on each letter in the string
	var strCipher = "";
	for (var i = 0; i < strPlain.length; i++) { 
		strCipher = strCipher + flipLetter(strPlain.charAt(i));
    }
   
	// Set the input value to the encrypted string
	return strCipher;
}

function spamkiller(part1,part2,s,b){
	part1 = encryptString(part1);
	part2 = encryptString(part2);
	address = part1+String.fromCharCode(64)+part2;
	window.location="mailto:"+address+"?subject="+s+"&body="+b;
}
-->