var allegatoaGlobale;

function addPersonaPerAllegatoa(allegatoa){
    var cognome         = document.getElementById('cognome').value;
    var nome            = document.getElementById('nome').value;
    var note            = document.getElementById('note').value;
    
    allegatoaGlobale = allegatoa;
    x_addAnagraficaReturnIndex(cognome, nome, note, addPersonaPerAllegatoa2);
    

}

function addPersonaPerAllegatoa2(f, z){
    var gruppo = document.getElementById("gruppo").value;
    
    x_addPersonaAllegatoa(allegatoaGlobale, gruppo, z, personeCallback);

}


function personeCallback(f, z){
    document.getElementById('personeInserite').innerHTML = z;
}

function delAllegatoA(allegato){
    if(!confirm("Eliminare il record selezionato?"))
	return;
    x_delAllegatoA(allegato, generalAjaxCallback);
}


function addAgentePerAllegatoa(allegatoa){
    var agenti = document.getElementById('agenti');
    var matricolaAgente = parseInt(agenti.options[agenti.selectedIndex].id);

    x_addAgenteAllegatoa(allegatoa, matricolaAgente, agenteCallback);

}

function agenteCallback(f, z){
    document.getElementById('accertatoriInseriti').innerHTML = z;
}

