﻿$(document).ready(function () {

    //Set the active tab for navagation.
    $("#navigation a[href$='/searchbyhelpfullinks.aspx']").removeAttr("onmouseover").removeAttr("onmouseout")
                .children("img").attr("src", "images/nav_federal-links-h.gif");

    //Attach enter key event.
    $("[id$='textBoxKeywords']").keypress(function (e) {
        keyCode = e.which ? e.which : e.keyCode;

        if (keyCode == 13) {
            $(this).blur();
            __doPostBack($("[id$='linkButtonSearchFederalLinks']").attr("id").replace(/_/g, "$"), "");
            e.preventDefault();
        }
    });

    //Handle form posts from other pages.
    if (isFormPost) {
        __doPostBack($("[id$='linkButtonSearchFederalLinks']").attr("id").replace(/_/g, "$"), '');
    }

    //Scroll the display if results are returned.
    if ($("#tableFederalLinks")[0] != null)
    { $("#searchResults").scrollTo(250); }

    $("#tableFederalLinks").tablesorter(
        {
            sortList: [[0, 0]]
        });

    //Add hover styles for command buttons.
    $(".command").hover(function () {
        $(this).addClass("ui-state-hover");
    }, function () {
        $(this).removeClass("ui-state-hover");
    });

});

