/*	$Id: nospam.js,v 1.2 2003/10/17 18:45:32 makeig Exp $	Author:	Justin Makeig (makeig[at]sims|berkeley|edu)	Credit:	Modified from code from http://lojjic.net/blog/20030828-142754.rdf.html			jj[at]lojjic|net 		Purpose: 		Obfuscate email addresses (and links) from spambots. Converts a span in the form of			<span class="electronic-mail">user[at]domain|com</span>		into			<a href="mailto:user@domain.com">user@domain.com</a>		at runtime using client-side processing with the DOM. Browsers without JavaScript or 		DOM support will see the readable, but unclickable, span shown above.*/function ParseEmail() {	if(!document.getElementsByTagName) return;	var allElts = document.getElementsByTagName('SPAN'); // get an array of all span elements in the document	if(allElts.length == 0 && document.all) 		allElts = document.all; // hack for IE5	for(var i=0; i<allElts.length; i++) { // loop through all spans		var elt = allElts[i];		var className = elt.className || elt.getAttribute("class") || elt.getAttribute("className");		if(className && className.match(/\belectronic-mail\b/) && elt.firstChild.nodeType == 3) { // if the current span has a class attribute and its value is 'electronic-mail'			var addr = elt.firstChild.nodeValue; // get the value of first child (text) node i.e. the encoded email address			addr = addr.replace(/ *\[at\] */,"@").replace(/ *\| */gi,"."); // decode the address			var lnk = document.createElement("a"); // create an anchor element			lnk.setAttribute("href","mailto:"+addr); // set the achor's href atribute			lnk.appendChild(document.createTextNode(addr)); // add a text node with the decoded email address to the anchor element			elt.replaceChild(lnk, elt.firstChild); // replace the current span's first child (text node) with the anchor created above		}	}}