﻿/// <reference path="jquery-1.5.1-vsdoc.js" />
/// <reference path="jquery-ui-1.8.11.js" />

$(document).ready(function () {

    $(":input[acomplete]").each(function () {
        $(this).autocomplete({ source: $(this).attr("acomplete") });
    });

    $('#searchform').submit(function () {

        $("#loadingbox").html("<img src=\"/Content/Images/spinner.gif\" />");

        var input = $(this).serialize();

        $.post("/Search/ValidateInput", input, function (data1) {

            if (data1 == true) {
                $.post("/Search/UpdateSearch", input, function (data) {
                    $(location).attr('href', data);
                });
            } else {
                $("#loadingbox").html("");
            }
        });

        return false;
    });

    /*
    $.post("/BulkSearch/Run", function (ret) {

    });
    */
});
