/*
 * some javascript
 */

function convertLinks() {
	if (!document.getElementsByTagName)
		return;

	var spans = document.getElementsByTagName('span');

	for (i = 0; i < spans.length; i++) {
		if (spans[i].className == 'link') {
			if (spans[i].firstChild.data.match(/^(.*)<([^\s]+)\s+at\s+([^\s]+)\s+(\w+)>$/)) {
				var email = RegExp.$2 + "@" + RegExp.$3 + "." + RegExp.$4;
				var text = RegExp.$1.replace(/\s+$/, "");
				if (text == "")
					text = "<" + email + ">";
				var a = document.createElement('a');
				a.setAttribute('href', 'mailto:' + email);
				a.appendChild(document.createTextNode(text));
				spans[i].parentNode.replaceChild(a, spans[i--]);
			}
		}
	}

	var mungingnote = document.getElementById('mungingnote');
	if (mungingnote) {
		mungingnote.parentNode.removeChild(mungingnote);
	}
}

function fixCSS() {
	if (navigator.appName == "Microsoft Internet Explorer") {
		document.writeln('<style type="text/css">\n' +
			'div, p, table, ul, ol, pre { font-size: 10pt; }\n' +
			'</style>');
	}
}

// run after page is loaded
self.onload = function () {
	convertLinks();
}

// run instantly in <head>:
fixCSS();
