Probleminha com AJAX

Galera, tenho essas duas funções:

function addLinha(){
    try{
        numLinhas = parseInt(document.getElementById("numLinhas").value);       
        
        numLinhas = numLinhas + 1;
        document.getElementById("numLinhas").value = numLinhas;
        
        encDep = 0;
        
        var novoNome = document.createElement("input");    
        novoNome.id = "nomComposicaoFamiliar";
        novoNome.name = "nomComposicaoFamiliar";    
        novoNome.type = "text";
        novoNome.size = "30";
        novoNome.style.width = "100%";
        if(ie)
            novoNome.setAttribute("maxLength", "50"); 
        else
            novoNome.setAttribute("maxlength", "50");
           
        var novoParentesco = document.createElement("select");    
        novoParentesco.id = "codParentesco";
        novoParentesco.name = "codParentesco";
        novoParentesco.style.width = "100%";
        
        var optionItem = new Option("", "-1",  false, false);        
        novoParentesco.options[novoParentesco.length] = optionItem;
        
        for(i=0; i<opcoesParentesco.length; i++){
            var valorOpcao = opcoesParentesco[i].getAttribute("valor");
            var textoOpcao = (opcoesParentesco[i].textContent || opcoesParentesco[i].innerText || opcoesParentesco[i].text);
            optionItem = new Option(textoOpcao, valorOpcao,  false, false);
            novoParentesco.options[novoParentesco.length] = optionItem;
        }
        
        var novoIdadeDep = document.createElement("input");    
        novoIdadeDep.id = "qtdIdadeDep"+numLinhas;
        novoIdadeDep.name = "qtdIdadeDep";
        novoIdadeDep.type = "text";
        novoIdadeDep.size = "8";
        novoIdadeDep.style.width = "100%";
        if(ie){
            novoIdadeDep.setAttribute("maxLength", "10");
            novoIdadeDep.setAttribute("onkeyup", function(){formatar(this,'##/##/####',event) });
            novoIdadeDep.setAttribute("onkeydown", function(){formatar(this,'##/##/####',event) });
            novoIdadeDep.setAttribute("onblur", function(){validaData(this)});

        }else{
            novoIdadeDep.setAttribute("maxlength", "10");
            novoIdadeDep.setAttribute("onkeyup", "formatar(this,'##/##/####',event)");
            novoIdadeDep.setAttribute("onkeydown", "formatar(this,'##/##/####',event)");
            novoIdadeDep.setAttribute("onblur", "validaData(this)");
        }
     
        var novoIdade = document.createElement("input");

        novoIdade.id = "qtdIdade"+numLinhas;
        novoIdade.name = "qtdIdade";
        novoIdade.type = "text";
        novoIdade.size = "1";

        if(ie){
            novoIdade.setAttribute("maxLength", "3");
            novoIdade.setAttribute("onblur", function(){idadeOnchange(this)});
            novoIdade.setAttribute("onfocus", function(){mudaFoco()});

        }else{
            novoIdade.setAttribute("maxlength", "3");
            novoIdade.setAttribute("onblur", "idadeOnchange(this)");
            novoIdade.setAttribute("onfocus", "mudaFoco()");
            
        }
        
       var novoIdadeMeses = document.createElement("input");

        novoIdadeMeses.id = "qtdIdadeMeses"+numLinhas;
        novoIdadeMeses.name = "qtdIdadeMeses";
        novoIdadeMeses.type = "text";
        novoIdadeMeses.size = "1";

        if(ie){
            novoIdadeMeses.setAttribute("maxLength", "2");
            novoIdadeMeses.setAttribute("onfocus", function(){mudaFoco()});
        }else{
            novoIdadeMeses.setAttribute("maxlength", "2");
            novoIdadeMeses.setAttribute("onfocus", "mudaFoco()");
        }
        
        var novoOcupacao = document.createElement("select");
        novoOcupacao.id = "codOcupacao"+numLinhas;
        novoOcupacao.name = "codOcupacao";        
        novoOcupacao.style.width = "100%";
        
        var optionItem = new Option("", "-1",  false, false);
        novoOcupacao.options[novoOcupacao.length] = optionItem;
        
        var novoRenda = document.createElement("input");
        novoRenda.id = "vlrRenda";
        novoRenda.name = "vlrRenda";
        novoRenda.type = "text";
        novoRenda.size = "3";
        if(ie){            
            novoRenda.setAttribute("maxLength", "7");
            novoRenda.setAttribute("onchange", function(){ calculaRemuneracao() });            
        }else{
            novoRenda.setAttribute("maxlength", "7");
            novoRenda.setAttribute("onchange", "calculaRemuneracao()");
        }

        var novoPaternidade = document.createElement("select");
        novoPaternidade.id = "stsPaternidade";
        novoPaternidade.name = "stsPaternidade";        
        novoPaternidade.style.width = "100%";
        
        var optionItem2 = new Option("SIM","S", false, false);
        var optionItem3 = new Option("NAO","N", false, false);
        
        novoPaternidade.options[novoPaternidade.length] = optionItem2;
        novoPaternidade.options[novoPaternidade.length] = optionItem3;
        
        
        var novoBtnDel = document.createElement("input");    
        novoBtnDel.id = "btnDel";
        novoBtnDel.name = "btnDel"; 
        novoBtnDel.type = "button";
        novoBtnDel.value = " - Dep ";
        if(ie)
              novoBtnDel.setAttribute("onclick", function(){ dimLinha(this) });
        else
              novoBtnDel.setAttribute("onclick", "dimLinha(this)");
        
        
        var novoBtnAddEnc = document.createElement("input");    
        novoBtnAddEnc.id = "btnAddEnc";
        novoBtnAddEnc.name = numLinhas;    
        novoBtnAddEnc.type = "button";
        novoBtnAddEnc.value = "+ Prog";
        if(ie)
            novoBtnAddEnc.setAttribute("onclick", function(){ addLinhaEncDep(this.parentNode.parentNode, this.name) });            
        else
            novoBtnAddEnc.setAttribute("onclick", "addLinhaEncDep(this.parentNode.parentNode, this.name)");
        
        var indexCompFamiliar = document.createElement("input");
        indexCompFamiliar.id = numLinhas;
        indexCompFamiliar.name = numLinhas;
        indexCompFamiliar.type = "text";
        indexCompFamiliar.size = "2";
        indexCompFamiliar.value = numLinhas;
        
        var novoQtdEncDep = document.createElement("input");
        novoQtdEncDep.id = "QtdEncDep"+numLinhas;
        novoQtdEncDep.name = "QtdEncDep";
        novoQtdEncDep.type = "text";
        novoQtdEncDep.size = "5";
        novoQtdEncDep.value = encDep;
        
        var tBodyEncDep = document.createElement("tbody");
        tBodyEncDep.id = "tBodyEnc"+numLinhas;
        
        var tabLinhaTitulos = document.createElement("tr");
        var tabLinha = document.createElement("tr");
        var tabLinhaQtdEncDep = document.createElement("tr");
        
        var tabColunaNome = document.createElement("td");
        tabColunaNome.innerHTML = "<b>Nome do dependente<font color='red'>*</font></b>";
        tabColunaNome.width = "35%";
        tabLinhaTitulos.appendChild(tabColunaNome);
        
        var tabColunaParentesco = document.createElement("td");
        tabColunaParentesco.innerHTML = "<b>Parentesco<font color='red'>*</font></b>";
        tabColunaParentesco.width = "25%";
        tabLinhaTitulos.appendChild(tabColunaParentesco);
        
        var tabColunaIdadeDep = document.createElement("td");
        tabColunaIdadeDep.innerHTML = "<b>Nascimento<font color='red'>*</font></b>";
        tabColunaIdadeDep.width = "1%";
        tabLinhaTitulos.appendChild(tabColunaIdadeDep);
        
        var tabColunaIdade = document.createElement("td");
        tabColunaIdade.innerHTML = "<b>Anos</b>";
        tabColunaIdade.width = "1%";
        tabLinhaTitulos.appendChild(tabColunaIdade);
        
        var tabColunaIdadeMeses = document.createElement("td");
        tabColunaIdadeMeses.innerHTML = "<b>Meses</b>";
        tabColunaIdadeMeses.width = "1%";
        
        tabLinhaTitulos.appendChild(tabColunaIdadeMeses);
        
        var tabColunaOcupacao = document.createElement("td");
        tabColunaOcupacao.innerHTML = "<b>Ocupacao<font color='red'>*</font></b>";
        tabColunaOcupacao.width = "25%";
        tabLinhaTitulos.appendChild(tabColunaOcupacao);
        
        var tabColunaRenda = document.createElement("td");
        tabColunaRenda.innerHTML = "<b>Renda</b>";
        tabColunaRenda.width = "1%";
        tabLinhaTitulos.appendChild(tabColunaRenda);
        
        var tabColunaPaternidade = document.createElement("td");
        tabColunaPaternidade.innerHTML = "<b>Paternidade</b>";
        tabColunaPaternidade.width = "1%";
        tabLinhaTitulos.appendChild(tabColunaPaternidade);
        
        var tabColunaDel = document.createElement("td");
        tabColunaDel.appendChild(novoBtnDel);
        tabLinhaTitulos.appendChild(tabColunaDel);

        var tabColunaNome = document.createElement("td");        
        tabColunaNome.appendChild(novoNome);
        
        var tabColunaParentesco = document.createElement("td");        
        tabColunaParentesco.appendChild(novoParentesco);
        
        var tabColunaIdadeDep = document.createElement("td");        
        tabColunaIdadeDep.appendChild(novoIdadeDep);
        
        var tabColunaIdadeMeses = document.createElement("td");        
        tabColunaIdadeMeses.appendChild(novoIdadeMeses);
       
        var tabColunaIdade = document.createElement("td");        
        tabColunaIdade.appendChild(novoIdade);

        var tabColunaOcupacao = document.createElement("td");
        tabColunaOcupacao.appendChild(novoOcupacao);
        
        var tabColunaRenda = document.createElement("td");        
        tabColunaRenda.appendChild(novoRenda);

        var tabColunaPaternidade = document.createElement("td");
        tabColunaPaternidade.appendChild(novoPaternidade);
        
        var tabColunaDel = document.createElement("td");
        tabColunaDel.appendChild(novoBtnAddEnc);
        
        var tabColunaQtdEncDep = document.createElement("td");
        tabColunaQtdEncDep.appendChild(novoQtdEncDep);
        
        var tabColunaIndexDependente = document.createElement("td");
        tabColunaIndexDependente.appendChild(indexCompFamiliar);
        
        tabLinhaQtdEncDep.appendChild(tabColunaQtdEncDep);
        tabLinhaQtdEncDep.appendChild(tabColunaIndexDependente);
  
        tabLinha.appendChild(tabColunaNome);
        tabLinha.appendChild(tabColunaParentesco); 
        tabLinha.appendChild(tabColunaIdadeDep);
        tabLinha.appendChild(tabColunaIdade);
        tabLinha.appendChild(tabColunaIdadeMeses);
        tabLinha.appendChild(tabColunaOcupacao);
        tabLinha.appendChild(tabColunaRenda);
        tabLinha.appendChild(tabColunaPaternidade);
        tabLinha.appendChild(tabColunaDel);

        tabBody = document.getElementById("tbody_com_fam");
        
        tabBody.appendChild(tabLinhaTitulos);
        tabBody.appendChild(tabLinha);
        tabBody.appendChild(tBodyEncDep);
        tabBody.appendChild(tabLinhaQtdEncDep);
      
        
        calculaRemuneracao();
    }catch(ee){
        alert("Erro no JavaScript: "+ee);
    }
}

E nessa segunda função, os parâmetros são o “tr” em que está o botão clicado e um índice para saber qual Dependente está sendo usado.

function addLinhaEncDep(linhaDep, indexDep){
    
    index = document.getElementById(indexDep).name;
    encDep = parseInt(document.getElementById("QtdEncDep"+index).value);
    encDep++;

    document.getElementById("QtdEncDep"+index).value = encDep;

    
var novoEncDependente = document.createElement("select");    
    novoEncDependente.id = "EncDependente";
    novoEncDependente.name = "EncDependente";
    novoEncDependente.style.width = "100%";
      
var optionItem = new Option("", "-1",  false, false);        
    novoEncDependente.options[novoEncDependente.length] = optionItem;
        
        for(i=0; i<opcoesEncaminhamento.length; i++){
            var valorOpcao = opcoesEncaminhamento[i].getAttribute("valor");
            var textoOpcao = (opcoesEncaminhamento[i].textContent || opcoesEncaminhamento[i].innerText || opcoesEncaminhamento[i].text);
            optionItem = new Option(textoOpcao, valorOpcao,  false, false);
            novoEncDependente.options[novoEncDependente.length] = optionItem;
        }
        
 var novoDtInicioDep = document.createElement("input");    
     novoDtInicioDep.id = "dtInicioDep";
     novoDtInicioDep.name = "dtInicioDep";
     novoDtInicioDep.type = "text";
     novoDtInicioDep.size = "10";
     if(ie){
            novoDtInicioDep.setAttribute("maxLength", "10");
            novoDtInicioDep.setAttribute("onkeyup", function(){formatar(this,'##/##/####',event) });
            novoDtInicioDep.setAttribute("onkeydown", function(){formatar(this,'##/##/####',event) });
            novoDtInicioDep.setAttribute("onblur", function(){validarData(this,this.id)});
            

      }else{
            novoDtInicioDep.setAttribute("maxlength", "10");
            novoDtInicioDep.setAttribute("onkeyup", "formatar(this,'##/##/####',event)");
            novoDtInicioDep.setAttribute("onkeydown", "formatar(this,'##/##/####',event)");
            novoDtInicioDep.setAttribute("onblur", "validarData(this,this.id)");
        }
        
 var novoDtFinalDep = document.createElement("input");    
     novoDtFinalDep.id = "dtFinalDep";
     novoDtFinalDep.name = "dtFinalDep";
     novoDtFinalDep.type = "text";
     novoDtFinalDep.size = "10";
     novoDtFinalDep.style.width = "100%";
        if(ie){
            novoDtFinalDep.setAttribute("maxLength", "10");
            novoDtFinalDep.setAttribute("onkeyup", function(){formatar(this,'##/##/####',event) });
            novoDtFinalDep.setAttribute("onkeydown", function(){formatar(this,'##/##/####',event) });
            novoDtFinalDep.setAttribute("onblur", function(){validarData(this,this.id)});

        }else{
            novoDtFinalDep.setAttribute("maxlength", "10");
            novoDtFinalDep.setAttribute("onkeyup", "formatar(this,'##/##/####',event)");
            novoDtFinalDep.setAttribute("onkeydown", "formatar(this,'##/##/####',event)");
            novoDtFinalDep.setAttribute("onblur", "validarData(this,this.id)");
        }
        
        
var novoBtnDelEnc = document.createElement("input");    
    novoBtnDelEnc.id = "btnDelEnc";
    novoBtnDelEnc.name = index;
    novoBtnDelEnc.type = "button";
    novoBtnDelEnc.value = "  -  ";
    if(ie)
          novoBtnDelEnc.setAttribute("onclick", function(){ dimLinhaEncDep(this,this.name) });              
    else
         novoBtnDelEnc.setAttribute("onclick", "dimLinhaEncDep(this.name)");   


var tabLinhaTitulosEnc = document.createElement("tr");
var tabLinha2 = document.createElement("tr");

var tabColunaEncaminhamento = document.createElement("td");
    tabColunaEncaminhamento.innerHTML = "<b>Encaminhamento</b>";
    
var tabColunaDtInicioDep = document.createElement("td");
    tabColunaDtInicioDep.innerHTML = "<b>&nbsp;&nbsp;&nbsp;Inicio</b>";
    tabColunaDtInicioDep.width = "1%"
    
var tabColunaDtFinalDep = document.createElement("td");
    tabColunaDtFinalDep.innerHTML = "<b>Final</b>";
    tabColunaDtFinalDep.width = "1%"
        
var tabColunaRmvEnc = document.createElement("td");
    tabColunaRmvEnc.innerHTML = "";
    
    tabLinhaTitulosEnc.appendChild(tabColunaEncaminhamento);
    tabLinhaTitulosEnc.appendChild(tabColunaDtInicioDep);
    tabLinhaTitulosEnc.appendChild(tabColunaDtFinalDep);
    tabLinhaTitulosEnc.appendChild(tabColunaRmvEnc);



var tabColunaEncaminhamento = document.createElement("td");
    tabColunaEncaminhamento.appendChild(novoEncDependente);
        
var tabColunaDtInicioDep = document.createElement("td");
    tabColunaDtInicioDep.align = "center";
    tabColunaDtInicioDep.appendChild(novoDtInicioDep);
        
var tabColunaDtFinalDep = document.createElement("td");
    tabColunaDtFinalDep.appendChild(novoDtFinalDep);
    
var tabBtnRmvEnc = document.createElement("td");
    tabBtnRmvEnc.appendChild(novoBtnDelEnc);

tabLinha2.appendChild(tabColunaEncaminhamento);
tabLinha2.appendChild(tabColunaDtInicioDep);
tabLinha2.appendChild(tabColunaDtFinalDep);
tabLinha2.appendChild(tabBtnRmvEnc);

 tabBody = document.getElementById("tBodyEnc"+index);
 tabBody = tabBody.document.getElementById(linhaDep);
 linhaDep.appendChild(tabLinhaTitulosEnc);
 linhaDep.appendChild(tabLinha2);
 }

A primeira função gera um dependente com uma linha de títulos dos dados, uma linha com os campos,um tbody, e uma linha com dois campos de controle, e cada vez que o botão é clicado gera um novo dependente.

E a segunda função deve gerar uma linha com títulos dos campos de Encaminhamentos, e uma linha com os campos para serem preenchidos, e da mesma forma cada vez que o botão é clicado gera um novo encaminhamento, e essas linhas tem que ser geradas dentro do tbody gerado na primeira função.

O meu problema é o seguinte, quando eu gero o primeiro dependente, ele aparece normal, porém quando eu adiciono outro ele conta como se tivesse adicionado mas não aparece nada, alguém pode me dar uma ajuda???

Valeeuuuu!!!