﻿function hideSuggest() {
    $("#suggest").css("display", "none");
}

function grabSuggest() {
    if ($("#txtSearch").val().length > 0) {
        $.get("/talent.aspx", { command: 'suggest', q: $("#txtSearch").val() },
        function(data) {
            var resultData = $.evalJSON(data);
            var resultString = "";
            if (resultData.length > 0) {
                for (var x = 0; x < resultData.length; x++) {
                    resultString += "<li><a href='profile.aspx/" + resultData[x].Value + "/" + resultData[x].Name + "'>" + resultData[x].Display + "</a></li>";
                }
            }
            else {
                resultString = "<li><a href='#' style='text-decoration:none;'>No Matches Found</a></li>";
            } // all that is the jquery ajax call, on the c# side it calls getSuggestions as seen below
            $("#suggest").css("display", "block");

            $("#suggestList").html(resultString);
        })
    }
}