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";
        }
    });

    $('input[name=q]').each(function () {
        if (this.value === "") {
            this.value = "Site search";
        }
        this.onclick = function () {
            if (this.value === "Site search") {
                this.value = "";
            }
        };
    });
});

/**
 * 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";
    });
    $("a[rel='pdf']").each(function (i) {
        if (!this.target) {
            this.target = "_blank";
        }
        this.title = "the PDF document will open in a new window";
    });
    $("a[rel='doc']").each(function (i) {
        if (!this.target) {
            this.target = "_blank";
        }
        this.title = "the Word document will open in a new window";
    });
    $("a[rel='xls']").each(function (i) {
        if (!this.target) {
            this.target = "_blank";
        }
        this.title = "the Excel spreadsheet will open in a new window";
    });
    $("a[rel='ppt']").each(function (i) {
        if (!this.target) {
            this.target = "_blank";
        }
        this.title = "the Power Point presentation will open in a new window";
    });
    $("a[rel='wav']").each(function (i) {
        if (!this.target) {
            this.target = "_blank";
        }
        this.title = "the audio clip will open in a new window";
    });
    $("a[rel='mp3']").each(function (i) {
        if (!this.target) {
            this.target = "_blank";
        }
        this.title = "the MP3 audio clip will open in a new window";
    });
    $("area[class='rel_external']").each(function (i) {
        if (!this.target) {
            this.target = "_blank";
        }
        this.title = "the page will open in a new window";
    });
}


/**
 * Enables site map.
 */
$(document).ready(function () {
    $('.sitemap').toggle(
        function () {
            $('.slide_container .one_column').slideDown();
            $('.slide_container').animate(
                {top: '-=300'},
                1000,
                function() {}
            );
            $('.column_container').animate(
                {height: '+=300'},
                1000
            );
            $('.sitemap').addClass("button_down");
        },
        function(){
            $('.slide_container').animate(
                {top: '+=300'},
                1000,
                function() {
                    $('.slide_container .one_column').hide();
                }
            );
            $('.column_container').animate(
                {height: '-=300'},
                1000
            );
            $('.sitemap').removeClass("button_down");
        }
    );
});

/**
 * Initializes links that open in a new window.
 */
$(document).ready(function () {
    anchorRels();
});


