function bookmark(title, url) {
  try {

    // Gecko or compatible
    if (window.sidebar) {
       window.sidebar.addPanel(title, url, "");
       return;
    }

    // Opera or compatible
    if (window.opera && window.print) {
       var anchor = document.createElement('a');
       anchor.setAttribute('href', url);
       anchor.setAttribute('title', title);
       anchor.setAttribute('rel', 'sidebar');
       anchor.click();
       return;
    }

    // Internet Explorer 4 or compatible
    if (document.all && (parseInt(navigator.appVersion, 10) >= 4)) {
       window.external.AddFavorite(url, title);
       return;
    }

  } catch (e) {
    // fall through
  }

  alert("To bookmark the current page press Ctrl-D" +
      "\n(Internet Explorer, Firefox, Safari and Chrome)" +
      "\nor Ctrl-T (Opera)");
}

$(document).ready(function () {
    $("a[rel='external']").each(function(i){
        if (!this.target) {
            this.target = "_blank";
        }
        if (!this.title) {
            this.title = "the page will open in a new window";
        }
    });
    $("a[rel='pdf']").each(function(i){
        if (!this.target) {
            this.target = "_blank";
        }
        if (!this.title) {
            this.title = "the PDF document will open in a new window";
        }
    });
});
