$(document).ready(function(){
   var $tiposN48 = $('#t_3840, #t_256, #t_512, #t_1024, #t_32768, #t_2048, #t_28672, #t_4096, #t_8192, #t_16384');
   var $tiposN03 = $('#t_28672, #t_4096, #t_8192, #t_16384');
   var $ofertasNneg = $('#o_16, #o_32');
   var $ofertasNter = $('#o_1, #o_2, #o_4, #o_16, #o_32');
 
   $('#t_txt').Select({
      defaultValue: lbl[179],
      onChange: function() { checkTiposOfertas(); }
   });
  
  $('#o_txt').Select({
      defaultValue: lbl[180],
      onChange: function () {
         if ($('#o').val()&48) {
            $('#lbl_cTxt').hide();
            $('#tp_div').show();
         }
         else {
            $('#tp_div').hide();
            $('#lbl_cTxt').show();
         }
         checkTiposOfertas();
      }
   });
  
  $('#u_txt').LocField({
      defaultValue: lbl[181]
  });
   
   $('#tp_menu').MenuSelect({
      onSelect: function (val,txt) {
         $(".label",$("#tp_div")).text(txt);
      }
   });
   
   $('.busq_simple .error .close img').click(function() {
      $(this).parents('.error').fadeOut("slow");
   });
   
   $('#b_simple').submit(function() {
      if (($('#u').val()=="0" || $('#u').val()=="") && ($.trim($('#u_txt').val())=="" || $('#u_txt').val() == lbl[181])) {
         return showError('u','u_txt');
      }
      if ($('#u_txt').val()=="" || $('#u_txt').val() == lbl[181])
         $('#u').val("");
      return true;
   });
   
   checkTiposOfertas();
   
   function checkTiposOfertas() {
      var of = $('#o').val();
      var tp = $('#t').val();
      $tiposN48.show();
      $tiposN03.show();
      $ofertasNneg.show();
      $ofertasNter.show();
      if (of==32 || of==16)
         $tiposN48.hide();
      if (of==1 || of==2)
         $tiposN03.hide();
      if ((tp&3840 && tp<16777215) || tp==32768)
         $ofertasNneg.hide();
      if (tp&28672 && tp<16777215)
         $ofertasNter.hide();
   }
   
});


