document.observe("dom:loaded", function() {
  liner = $$('.product-liner');
  ultrathin = $$('.product-ultrathin');
  pads = $$('.product-pads');
});

function respond_to_click_on_liner(event){ updateProductList(liner); }
function respond_to_click_on_ultrathin(event){ updateProductList(ultrathin); }
function respond_to_click_on_pads(event){ updateProductList(pads); }

function remove_checks_from(input_elements){
  input_elements.each(function(input){ input.checked = false; });
}

function updateProductList(product_type){
  //Remove elements
  $('product').childElements().each(function(obj){
    if(obj!=$('product_id-default')){
      obj.remove();
    }
  });
  //Add elements
  product_type.each(function(ele){
    $('product').insert({bottom: ele});
  });
}

