﻿//Make appropriately tagged links popup in new window, and inform user via alt text or title attributes
$(function() {
    $('a[rel=\'external\']')
        .each(function(index) {
            $(this).attr('target', '_blank');

            var title = $(this).attr('title');

            if (title != '') {
                $(this).attr('title', title + " (opens in a new window)");
            }
            else {
                //add it to the alt attr if the A is wrapping an IMG
                var alt = $(this).children('img').attr('alt');
                if (alt != '') {
                    $(this).children('img').attr('alt', alt + " (opens in a new window)")
            }
        }
    });
});
