$(document).ready(function() {
	$("a.obfuscated_email_address").each(function() {
		// get the obfuscated email address
		var obfuscatedEmail = this.href;

		// extract everything between 'mailto:' and the '@' symbol
		obfuscatedEmail = obfuscatedEmail.substring(7, obfuscatedEmail.indexOf("@"));

		// split on the '-' character to get the obfuscated characters
		var emailParts = obfuscatedEmail.split("-");

		// loop through the email parts and convert back to a char, building the email string as we go along
		var email = "";
		for (var i = 0; i < emailParts.length; i++) {
			email += String.fromCharCode(emailParts[i]);
		}

		// check to see if the inner HTML contains an email address (may not if just plain text is being used)
		if (this.innerHTML.indexOf("@nospam.com") != -1)
			this.innerHTML = email;

		// update the 'mailto:' link
		this.href = "mailto:" + email;
	});
});
