﻿function SearchListBrowser(url) {
    this.url = url;
    this.defaults.rpp = 50;
    this.defaults.loggedin = 0;
    this.defaults.ci = 0;
    this.bindToViewState();
}

SearchListBrowser.prototype = new ListBrowser("#search_results_place", null);

SearchListBrowser.prototype.beforeChangePage = function () {
    window.scrollTo(0, 0);
}

SearchListBrowser.prototype.afterInit = function () {
    jQuery('.search_option_container').each(function () {
        var jopt = jQuery(this);
        if (jopt.find("a:contains('See all')").length > 0) {
            var ids = '';
            jopt.find("input[type='checkbox']").each(function () {
                if (this.checked)
                    ids += ',' + this.value;
            });
            var id = jopt.attr('id').replace('srch_opt_cntnr', '');
            jQuery.get(__root + 'Bars/GetOption/' + id, { values: ids }, function (resp) {
                jopt.replaceWith(resp);
            });
        }
    });
}

SearchListBrowser.prototype.doSrch = function () {
    if (this.inProcess)
        return false;
    viewState.untrack();
    this.applyFilter();
    this.show();
    viewState.track(400);
}

SearchListBrowser.prototype.clear_q = function () {
    this.masterFilter.q = '';
    this.show();
}


