$(document).ready(function () {
    //
    // Since target="_blank" is not valid XHTML: where this would be used,
    // anchors are defined as external instead.
    //
    $('a[rel=external]').attr('target', '_blank');
});


//
// Replace the href of the email link with an email.
//
function email(anchor_id, address) {
    address = jQuery.map(address.split(','), function(c) {
        return String.fromCharCode(c);
    }).join('');
    
    anchor = $("#" + anchor_id);
    anchor.attr('href', 'mailto:' + address);
    if (anchor.text() == "") {
        anchor.text(address);
    }
}
