$(document).ready(function(){
    // Email obfuscation: find all links that start with contact/ and de-obfuscate them
    $("a[href^='contact/']").each(deObfuscate);
});

function deObfuscate(e)
{
    var href = $(this).attr('href');
    var address = href.replace(/^contact\/([^+]+)\+([^+]+)\+(.+)/, '$1' + '@' + '$2' + '.' + '$3');
    if (href != address) {
        $(this).attr('href','mailto:' + address);
        // If the text of the link is the same as the href, replace it too
        if ($(this).text() == href) $(this).html(address);
    }
}
