function showHideFilters(event) {
    theBlock = $('product_filter_inner');
    if(theBlock.getStyle('display')=='none') {
        theBlock.show();
    } else {
        theBlock.hide();
    }
    return false;
}


function runProductFilter(event) {
    var mesProductBlockElements = $$('.article');
    var productsToShow = [];
    var arrayVierge = true;
    
    // Build the product list (products to show)
    mesRadioElements.each(function(item) {
        
        if ((item.checked) && (item.value!='')) {       
            curProducts = item.value.split(',');
            if (arrayVierge) {
                // Just copy the array
                productsToShow = curProducts;
                
            } else {
                // Perform the logical AND
                newProductsToShow = [];
                productsToShow.each(function(item) {
                    if (curProducts.indexOf(item)>=0) {
                        newProductsToShow.push(item);
                    }
                });
                productsToShow = newProductsToShow;
            }
            arrayVierge = false;
        }
    });
    
    // Foreach productsToShow[] => show the right products, hide the others
    if (arrayVierge) {
        mesProductBlockElements.each(function(item) {
            item.show();
        });
    } else {
        mesProductBlockElements.each(function(item) {
            curProductCode = item.id.split('-');
            curProductCode = curProductCode[2];
            if (productsToShow.indexOf(curProductCode)>=0) {
                item.show();
            } else {
                item.hide();
            }
        });
    }
    
    // Hide the header if no product is listed below
    var  mesFamilyBlockElements = $$('.table_class');
    var allHidden;
    mesFamilyBlockElements.each(function (familyBlock) {
        articles = familyBlock.select('.article');
        allHidden = true;
        articles.each(function (item) {
            if (item.getStyle('display')!='none') {
                allHidden = false;
            }
        });
        if (allHidden) {
            familyBlock.hide();
        } else {
            familyBlock.show();
        }
    });
    
    // Display an error message if the product list is empty
    if (productsToShow.size() == 0 && (!arrayVierge)) {
        $('no_product_div').show();
    } else {
        $('no_product_div').hide();
    }
        
}

// alert(arrayVierge+"\n"+productsToShow);
    
