
function switchScopes(newScope) {
    var filterTermsElement = byId("search_form_filter_terms");
    var navigationEnabledElement = byId("search_form_navigation_enabled");
    if (typeof submitSearch == "function" && applyCurrentSimilarity()) {
        switch (newScope) {
        case "product":
            filterTermsElement.value = "searchscopes:product";
            navigationEnabledElement.value = "true";
            break;
        case "support":
            filterTermsElement.value = "searchscopes:support";
            navigationEnabledElement.value = "false";
            break;
        default:
            filterTermsElement.value = "";
            navigationEnabledElement.value = "false";

        }
        submitSearch();
    }
}

function switchSort(newSort) {
    var fieldElement = byId("additional_multi_sort_field_0");
    var directionElement = byId("additional_multi_sort_direction_0");
    if (typeof submitSearch == "function" && newSort && applyOldNavigation() && applyCurrentSimilarity()) {
        switch (newSort) {
        case "relevance":
            fieldElement.value = "default";
            directionElement.value = "ascending";
            break;
        case "alphabetic":
            fieldElement.value = "title";
            directionElement.value = "ascending";
            break;
        case "productid":
            fieldElement.value = "productid";
            directionElement.value = "ascending";
            break;
        default:
            fieldElement.value = "default";
            directionElement.value = "ascending";
        }
        submitSearch();
    }
}

function hqfilter(content) {
    var filterTermsElement = byId("search_form_filter_terms");
    filterTermsElement.value="searchscopes:not(rolls)";
    if( content.match("^[A-Za-z0-9]+-[A-Za-z0-9]+$") && content.match(".*[A-Za-z].*")) {
        filterTermsElement.value="";
    }
}

