/*
EMAIL SPAMBOT BUSTER
BY DENNIS LEMBREE, OCT 2007
www.DennisLembree.com
www.CheckEngineUSA.com
http://www.checkengineusa.com/ce/articles/spambot_buster.htm

Example implementation:

<script type="text/javascript">
var emailAddress = new Array();
emailAddress[0] = "infoDiv,contact us today,info,yourDomain,com";
</script>
<script src="email_spambot_buster.js" type="text/javascript"></script>
<script type="text/javascript">
window.onload = spambotBuster;
</script>
*/

//main Email Spambot Buster function
function spambotBuster() {
	//ensure user agent can do DOM
	if(!document.getElementById || !document.createElement) return;

	//loop through email addresses
	for (var i=0;i<emailAddress.length;i++) {
		//put data in array
		x = emailAddress[i].split(',');
		
		//grab the email span element
		el = document.getElementById(x[0]);
		
		//create the actual link
		theLink = "mailto:" + x[2] + "@" + x[3] + "." + x[4];
		
		//build node for email link
		emailLink = document.createElement("a");
		emailLink.appendChild(document.createTextNode(x[1]));
		emailLink.href = theLink;
		emailLink.title = "email link";
		emailLink.rel = "email";
		
		//replace it!
		el.parentNode.replaceChild(emailLink,el)
	}
}

addLoadEvent(spambotBuster);


