window.onload = obfusEmail;											//Wait until the whole page is loaded to do anything
function obfusEmail() {												//The purpose of this function is to make it more difficult for nefarious agents to scrape email addresses off our site - thus reducing spam
	if (!document.getElementsByTagName) return false;				//Object Detection - if the browser isn't DOM friendly, go away
	var linkText													//set up a variable named linkText for later
	var emailAddr = document.getElementsByTagName ('email');		//find all email tags and add them to the array named emailAddr
	for (i=0; i<emailAddr.length; i++){								//start the loop
	if (emailAddr[i].firstChild.nodeValue.match(/\s+?\[at]\s+/g)) {	//if the contents of the emailAddr array contain the string [at] then do some stuff
		var str = emailAddr[i].firstChild.nodeValue;				//set variable str to the value of the nth item in the emailAddr array
		str = str.replace( /\s+?\[(?:dot|period)]\s+?/g, '.');		//replace the [dot]'s
		str = str.replace( /\s+?\[(?:at)]\s+?/g, '@');				//replace the [at]'s 
		str = str.replace( /\s+?\[(?:dash|hyphen)]\s+?/g, '-' );	//replace the [dash]'s
		var txt = emailAddr[i].getElementsByTagName ('txt');		//look for txt tags in the email tag
		if (txt.length >= 1){										//are there any?
			var txtStr = txt[0].firstChild.nodeValue;				//set variable txtStr to the value in the txt tag
			emailAddr[i].removeChild(txt[0]);						//pull the txt tag off the page
			linkText = txtStr;										//set variable link text to the contents of the txt tag
		}else{														//if there aren't any txt tags
			linkText = str;											//set the variable link text to the email address
		}															//end the else
		var subj = emailAddr[i].getElementsByTagName ('subj');		//now look for any subj tags in the email tag
		var subjText = ''
		if (subj.length >= 1){										//are there any?
			var subjText = subj[0].firstChild.nodeValue;			//set variable subjText to the value in the subj tag
			emailAddr[i].removeChild(subj[0]);						//pull the subj tag off the page
			subjText = "?subject=" + subjText;						//add appropriate format to subjText
		}															//end the if
		var a = document.createElement('a');						//create a new a tag
			a.setAttribute('href','mailto:' + str + subjText);		//set the href attribute to mailto:[address]
			a.appendChild(document.createTextNode(linkText));		//add the link text to the a tag
		emailAddr[i].replaceChild(a,emailAddr[i].firstChild);		//replace the contents of the email tag with the new link
		}															//end of the first if statement
	}																//end the loop
}