/// <reference path="../jquery-1.2.6-vsdoc.js" />
google.setOnLoadCallback(function() {

    $("#domain").focus(function() {
        $("#domain").select();
    });

    $("#domain").keyup(function(event) {

        thisSearch = $("#domain").val();

        setTimeout(runSearch, 2000);
    });

    $("#submit").click(function() {

        runSearch();

        return false;
    });

    $("#domain").focus();

});


var lastSearch = "";
var thisSearch = "";

function runSearch() {

    if ($("#domain").val() == thisSearch) {

        if (thisSearch != lastSearch) {

            lastSearch = thisSearch;

            var url = "search.html?domain=" + thisSearch + "&ticks=" + getTicks();

            $("#results").empty();

            $.get(url, function(data) {
                $("#results").html(data);
            });
        }
    }
}