function fillAddress() {
	var at = / at /;
	var dot = / dot /g;
	var address = this.getAttribute("title");

	address = address.replace(at, "@");
	address = address.replace(dot, ".");

	this.innerHTML = address;
	this.setAttribute("href", "mailto:"+address);
	this.setAttribute("title", "");
	this.className = "email";
	this.onmouseover = null;
	this.onfocus = null;
}

function mangle() {
	if (!document.getElementsByTagName && !document.createElement &&
		!document.createTextNode) return;
	var nodes = document.getElementsByTagName("*");
	for(var i=nodes.length-1;i>=0;i--) {
		if (nodes[i].className.search("sendto")>=0) {
			var node = document.createElement("a");
			node.setAttribute("href", "mailto:");
			node.className = "email";
			node.setAttribute("title", nodes[i].innerHTML);
			node.innerHTML = nodes[i].innerHTML;
			node.onmouseover = fillAddress;
			node.onfocus = fillAddress;

			var prnt = nodes[i].parentNode;
			for(var j=0;j<prnt.childNodes.length;j++)
				if (prnt.childNodes[j] == nodes[i]) {
					if (!prnt.replaceChild) return;
					prnt.replaceChild(node, prnt.childNodes[j]);
					break;
				}
		}
	}
}

/*
Copyright (c) 2006 Marko Samastur

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

/*
Modified 06 September 2006 by the Math Wizard:
    - Line 20 : Changed the class name to be searched for from "change" into "sendto"
    - Line 24 : Added setting of class to "email" (for style purposes)
    - Line 12 : Added setting of class to "email" (for style purposes)
Modified 05 October 2006 by the Math Wizard
    - Line 29 : Added onFocus method
    - Line 14 : Added onFocus method
*/
