
window.onload = function() {
    installSearchInput('search-input');
}

function installSearchInput(id)
{
    elt = document.getElementById(id);
    if (!elt)
        return;

    elt.emptyLabel = 'SEARCH HERE ...';

    elt.onfocus = function() {
        if (!this.bEntered)
            this.value = '';
        this.bEntered = true;
    }

    elt.onblur = function() {
        if (this.value.length == 0) {
            this.value = this.emptyLabel;
            this.bEntered = false;
        }
    }

    elt.onblur();

    elt.form.onsubmit = function() {
        this.criteria.onfocus();
    }
}
