//E-mail decloaking
function correctEmailAddress(obfuscatedEmailAddress) {
	return obfuscatedEmailAddress.replace(/\(at\)/, "@").replace(/\u00B7/g, ".");
}

$(function() {
	// De-obfuscate e-mail addresses
	$("a[href^='mailto:']").attr("href", function() {
		return correctEmailAddress($(this).attr("href"));
	});
	$(".emailaddress").each(function() {
		var emailAddress = correctEmailAddress($(this).html());
		$(this).html(emailAddress);
		if ($(this).is("a:not([href])")) {
			$(this).attr("href", "mailto:" + emailAddress);
		}
	});
	
	// Make external links open in a new tab.
	$("a.external").each(function() {
		$(this).not("[title]").attr("title", "This link opens in a new window");
		$(this).click(function() {window.open(this.href); return false;});
	});
});

