function filtr(val,select)
{
 var nullopt = '<option value="0">-- все --</option>';
 if (select == 'ffiltr' && $('#gene').attr('value') == 0)
 {
    $('#ffiltr').html(nullopt);
    $('#sfiltr').html(nullopt);
    $('#tfiltr').html(nullopt);
 }
 else if (select == 'sfiltr' && $('#ffiltr').attr('value') == 0) 
 {
    $('#sfiltr').html(nullopt);
    $('#tfiltr').html(nullopt);
 }
 else if (select == 'tfiltr' && $('#sfiltr').attr('value') == 0) 
 {
    $('#tfiltr').html(nullopt);
 }
 else
 {
    $.ajax({
       type: "POST",
       url: "/inc/catalog.ajax.php",
       data: "opt=1&par="+val,
       success: function(msg){
         $('#'+select).html(msg);
       }
     });
 }
}
function megafiltr(prod)
{
    $('#cloading').html('<img src="/i/loading.gif" alt="Загрузка..." title="Пожалуйста подождите" />');
    var gene = $('#gene').attr('value');
    var first  = $('#ffiltr').attr('value');
    var second = $('#sfiltr').attr('value');
    var third  = $('#tfiltr').attr('value');
    $.ajax({
   type: "POST",
   url: "/inc/catalog.ajax.php",
   data: "opt=2&prod="+prod+"&gene="+gene+"&first="+first+"&second="+second+"&third="+third,
   success: function(msg) {
    $('#prodtable').html(msg);
    $('#cloading').html('');
   }
 });
}