function buscarFamii(b, a){
  const parametros = new FormData();
  parametros.append("txtNom", document.formFamii.txtNom.value);

  $.ajax({
    data:  parametros,
    url:   "busFamii/data.php",
    type:  "post",
    contentType: false,
    processData: false,
    beforeSend: function () {
      alLoad("Consultando...")
    },
    success: function (jsonPhp) {
      const jsonJS = JSON.parse(jsonPhp);

      tblClear("tblFamii");
      jsonJS.deptosi.forEach(function(i){
        addRowFamii(i.dep_cod, i.dep_nom);
      });

      $("#tblFamii tbody tr").dblclick(function() {
        selectFamii(a, $(this));
      });

      $("#tblFamii tbody #btnSelecFamii").click(function() {
        selectFamii(a, $(this).parents("tr"));
      });

      alClose();
    }
  });
}

function addRowFamii(cod, nom) {
  const markup =  "<tr>"
                    +"<td>"+cod+"</td>"
                    +"<td>"+nom+"</td>"
                    +"<td><button class='btn btn-sm btn-warning badge' id='btnSelecFamii'>"+textBtnSelec+"</button></td>"
                  +"</tr>";
  $("#tblFamii tbody").append(markup);
}

function selectFamii(a, tr) {
  $("#pills-"+a+"-tab").click();
  /*if (inputProvee == "txtNit") {
    document.thisform.txtNit.value = tr.find("td:eq(0)").text();
    $("form[name='thisform'] #txtNit").trigger("change");
  } else {*/
    $("#"+inputCod).val(tr.find("td:eq(0)").text());
    $("#"+inputCod).trigger("change");
  //}

  //$('html, body').animate( { scrollTop : 0 }, 500 );
  tblClear("tblFamii");
}