function pgmouseover(tr){
    var mdiv = document.getElementById('mobilediv');   
}

var tipoPersonaPg = null;
var pgregGlobal = null;

function cercaNumeroSDI_callback(focus, z){
    var a = z.split(",");
    if(confirm("Nuovo numero SDI: VIEVA5 " + a[1] + " " + a[0] + ".\n Modificare il dato?" )){
	document.getElementById('annosdi').value = a[1];
	document.getElementById('numerosdi').value = a[0];
	updateValue("~~~~"+a[2], "~~~~annosdi", "~~~~pgreg", a[3], a[1]);
	updateValue("~~~~"+a[2], "~~~~numerosdi", "~~~~pgreg", a[3], a[0]);
    }else{
    }
    

}

function aggiungiPersonaPg(pgreg){
	var tipi = document.getElementById("tipoPersone");
	var tipo = tipi.options[tipi.selectedIndex].text;
	var cognome = document.getElementById("cognome").value;
	var nome = document.getElementById("nome").value;
	//var note = document.getElementById("note").value;
	pgregGlobal = pgreg;
	tipoPersonaPg = tipo;

	x_addAnagraficaReturnIndex(cognome, nome, personaPgCallback1);
}

function personaPgCallback1(focus, z){
	x_aggiungiPersonaPg(pgregGlobal, tipoPersonaPg, z, personaPgCallback2);
}

function personaPgCallback2(focus, z){
	document.getElementById("pgpers").innerHTML = z;

}

function aggiungiProvvedimentoPg(pgreg){
    var tipi = document.getElementById("provvedimenti");
    var tipo = tipi.options[tipi.selectedIndex].id;

    x_aggiungiProvvedimentoPg(pgreg, tipo, provvedimentoPgCallback);
}

function provvedimentoPgCallback(focus, z){
	document.getElementById("pgprov").innerHTML = z;
}

function delRegistroPG(pgreg){
	if(confirm("Eliminare il record " + pgreg + "?"))
		x_delRegistroPg(pgreg, generalAjaxCallback);
}

function pgGeneralCallback(focus, z){
    generalAjaxCallback(focus, z);

}

