/**
 * Sets the target and title attributes for anchor and area elements.
 */
function anchorRels() {
    $("a[rel='external']").each(function (i) {
        if (!this.target) {
            this.target = "_blank";
        }
        this.title = "the page will open in a new window";
        $(this).click(function() {trackPageview(this.href);});
    });
    $("a[rel='pdf']").each(function (i) {
        if (!this.target) {
            this.target = "_blank";
        }
        this.title = "the PDF document will open in a new window";
        $(this).click(function() {trackPageview(this.href);});
    });
    $("a[rel='doc']").each(function (i) {
        if (!this.target) {
            this.target = "_blank";
        }
        this.title = "the Word document will open in a new window";
        $(this).click(function() {trackPageview(this.href);});
    });
    $("a[rel='xls']").each(function (i) {
        if (!this.target) {
            this.target = "_blank";
        }
        this.title = "the Excel spreadsheet will open in a new window";
        $(this).click(function() {trackPageview(this.href);});
    });
    $("a[rel='ppt']").each(function (i) {
        if (!this.target) {
            this.target = "_blank";
        }
        this.title = "the Power Point presentation will open in a new window";
        $(this).click(function() {trackPageview(this.href);});
    });
    $("a[rel='wav']").each(function (i) {
        if (!this.target) {
            this.target = "_blank";
        }
        this.title = "the audio clip will open in a new window";
        $(this).click(function() {trackPageview(this.href);});
    });
    $("a[rel='video']").each(function (i) {

        $(this).click(function() {
            trackPageview(this.href);});
    });
    $("a[rel='mp3']").each(function (i) {
        if (!this.target) {
            this.target = "_blank";
        }
        this.title = "the MP3 audio clip will open in a new window";
        $(this).click(function() {trackPageview(this.href);});
    });
    $("area[class='rel_external']").each(function (i) {
        if (!this.target) {
            this.target = "_blank";
        }
        this.title = "the page will open in a new window";
        $(this).click(function() {trackPageview(this.href);});
    });
    $("a[rel='rns']").each(function (i) {
        if (!this.target) {
            this.target = "_blank";
        }
        this.title = "the RNS article will open in a new window";
        $(this).click(function() {trackPageview(this.href);});
    });
}

/**
 * Initializes links that open in a new window.
 */
$(document).ready(function () {
    anchorRels();
});

