﻿function CheckLinks() {
    $("a[rel=\"External\"],a[@href^=http]:not([rel=\"External\"])").each(function() {
        // If the URL is definitely external OR its container is "event-bookmark"
        if (this.href.indexOf(location.hostname) == -1 || $(this).parent().parent().attr("id") == "event-bookmark") {
            var anchor = this;
            if ($(anchor).attr("title") != "") {
                $(anchor).attr("title", $(anchor).attr("title") + " (opens in a new window)");
            }
            else {
                $(anchor).attr("title", "Opens in a new window");
            }
            $(this).click(function() {
                window.open($(anchor).attr("href"));
                return false;
            });
        }
    });
}