
function parseEmail(node) {
	// replace the " dot " and " at " words with the appropriate symbols
	var email = node.firstChild.nodeValue.replace(/ dot /gi, ".").replace(/ at /i, "@");
	var link  = document.createElement("a");

	link.className = node.className;
	link.href = "mailto:" + email;

	// set the text depending on the title of the span
	link.appendChild(document.createTextNode((node.title != "") ? node.title : email));

	node.parentNode.replaceChild(link, node);
}

window.onload = function() {
	// converts email links
	var nodes = document.getElementsByTagName("span");
	var idx   = 0;

	while(nodes.length > idx)
		if(nodes[idx].className == "email")
			parseEmail(nodes[idx]);
		else
			idx++;
}
