$(document).ready(function()
{
/*  $('.search input[type="submit"]').hide(); */

  var handler = function() {
      $('#loader').show();
      var cs = '';
      var fs = $('input.categories_list');
      for (var i=0;i<fs.length;++i) {
        var f = fs[i];
        if (f.checked) cs += ","+f.value;
      }
      cs = cs.substr(1);
      $('#profiles').load(
        $(this).parents('form').attr('action'),
        { detail_name: $('#detail_name').val(),
          detail_crosssection_id: $('#detail_crosssection_id').val(),
          detail_categories_list: cs,
          detail_mmod: $('#detail_mmod').val(),

          detail_lmod: $('#detail_lmod').val(),
          detail_xsize: $('#detail_xsize').val(),
          detail_ysize: $('#detail_ysize').val(),
          detail_zsize: $('#detail_zsize').val(),
          detail_length: $('#detail_length').val(),
          detail_weight: $('#detail_weight').val(),
          detail_wmod: $('#detail_wmod').val(),
          detail_alloy_id:  $('#detail_alloy_id').val() },
        function() { $('#loader').hide(); }
      );
  };
  

  $('.search input[type="text"]').keyup(handler);
  $('.search input[type="checkbox"]').change(handler);
  $('.search select').change(handler);
});

