var onloadBeforeThis = window.onLoad;
window.onload = function() {
	if (onloadBeforeThis) onloadBeforeThis();
	emailLinks()
}

function emailLinks() {
	var reTagEnds = /[<>]/;
	var reImgTag = /<img[^>]*>/gi;	/* need case insensitive - ie outputs capital letter tag names */
	var spans = document.getElementsByTagName('span');
	for (i = 0; i < spans.length; i++) {
		if (spans[i].className == 'emailLink') {
			var spanToSplit = 'firefox' + spans[i].innerHTML	/* firefox handles split() differently to IE where there is no text before the first split point - this makes sure that they both behave the same */
			var spanToSplit = spanToSplit.replace(reImgTag, "@");
			var spanToSplit = spanToSplit.replace("</P>\r\n", ""); /* don't ask - IE adds '</P>\r\n' before the <DIV> tag ?? - so we need to strip it out */
			var arrSpanPieces = spanToSplit.split(reTagEnds);
			var emailName = arrSpanPieces[2];
			var emailAddress = arrSpanPieces[4];
			spans[i].innerHTML = "<a href=\"mailto:" + emailAddress + "\">" + emailName + "</a>";
			
		}
	}
}