﻿// JScript File

function filter_product(refSelect, filterName)
{
    //get the value of selected item of select box
    var filterValue = refSelect.options[refSelect.selectedIndex].value;
    var queryString;
    
    //if the value of option is -1 then remove the selected filter from condition else add it.
    if (filterValue == '-1')
        queryString = '?filter_action=1&filter_name=' + encodeURI(filterName) + '&filter_value=' + filterValue + '&filter_type=1';
    else
        queryString = '?filter_action=0&filter_name=' + encodeURI(filterName) + '&filter_value=' + filterValue + '&filter_type=1';
    window.location = queryString;
}

function filter_product_type(refSelect, previousFilterName)
{
    //get the value of selected item of select box
    var filterName = refSelect.options[refSelect.selectedIndex].value;
    var queryString;
    
    //if the value of option is -1 then remove the selected filter from condition else add it.
    if (filterName == '-1')
        queryString = '?filter_action=1&filter_name=' + encodeURI(previousFilterName) + '&filter_value=Yes&filter_type=1';
    else
        queryString = '?filter_action=0&filter_name=' + encodeURI(filterName) + '&filter_value=Yes&filter_type=1';
        
    window.location = queryString;
}
