Logical problem,seeking an algorithm
<p><br>
I am developing a javascript filtering of some results and have some difficulties..<br>
Here is the problem...<br>
Suppose that we have some criteria  </p>

<ol>
<li>Manufacter  (Trusardi, Calvin Kein, Armani...)  </li>
<li>Color  (red, blue, black...)</li>
<li>OtherFeatures (goretex, blah, blah...)  </li>
</ol>

<p>Each feature is displayed as a checkbox...<br>
The problem is that i want to disable the checkboxes if its selection would lead to no results..For example Armani's products may have color blue only so checking armani should disable the black and red,but other manufactors shouldnt be disabled... as checking them should provide a result...<br>
Here is the code so far  </p>

<pre><code>results = $("#products li");
results.hide();
var filtersGroup = $("#filters li.filtersGroup");

$("#filters li.filtersGroup a").removeClass("disabled");
filtersGroup.each(function(index) {
    var classes = "";

    $(this).find("a.checked").each(function(index) {
        classes = classes + "." + $(this).attr("id") + ",";
    });
    if (classes == "") return true;

    results = results.filter(classes.substr(0, classes.length - 1));
    //periorismos
    filtersGroup.not($(this)).each(function(index) {
        $(this).find("a").each(function(index) {
            if (results.filter("." + $(this).attr("id")).length &lt;= 0) {
                $(this).removeClass("checked").addClass("disabled");
            }
        });
    });
});
</code></pre>

<p>Although it filters them successfully ,the disabling isnt always correct. for example to reproduce the problem ,if you choose all the manufactors and then choose a color manufactors would be disabled but colors not at the first time..<br>
One solution i figured is to create multiple results which would simulate all the next possible check.(if 16 features and 4 checked means 12 possible other checked ..<br>
But i think that this approach sucks... Any other idea?</p>
