function addLoadEvent(func)
{
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}

// Special thanks to badboy <www.badboy.ro>
// for creating the script
// and Octavio Heredia <www.octavioheredia.com>
// for improving it

function email_cloak()
{
	if (!document.getElementById) return false;
	
	var alltags = document.all? document.all : document.getElementsByTagName("*");
	for (i=0;i<alltags.length;i++)
	{
		if (alltags[i].className == "email_cloak")
		{
			var oldText = alltags[i].firstChild;
			var emailAddress = alltags[i].firstChild.nodeValue;
			var user = emailAddress.substring(0, emailAddress.indexOf("("));
			var website = emailAddress.substring(emailAddress.indexOf(")")+1, emailAddress.length);
			var newText = user+"@"+website;
			var a = document.createElement("a");
			a.href = "mailto:"+newText;
			var address = document.createTextNode(newText);
			a.appendChild(address);
			alltags[i].replaceChild(a,oldText);
		}
	}
}

addLoadEvent(email_cloak);
