var lastValor = 0;
var idpadre;
var idhijo;
function callbackCombo()
{
	var comboPadre = document.getElementById(idpadre);
	if (comboPadre.selectedIndex == lastValor)
	{
		var comboHijo = document.getElementById(idhijo);
		var	rows = resultXML.getElementsByTagName("entry");
		
		comboHijo.disabled = false;
		for (var i = 0; i < rows.length; i++)
		{
			var	texto = rows[i].getElementsByTagName("texto")[0].firstChild.nodeValue;
			
			var id = rows[i].getElementsByTagName("id")[0].firstChild.nodeValue;
			comboHijo.options[comboHijo.options.length] = new Option(texto, id);
		}
	}
}

function actualizarCombo(idp, idh, urlxml)
{
	idpadre=idp;
	idhijo=idh;
	var comboPadre = document.getElementById(idpadre);
	var comboHijo = document.getElementById(idhijo);

	for (var i = (comboHijo.options.length-1); i >= 0; i--){
		comboHijo.options[i]=null;
	}
	comboHijo.options[0]=new Option("Todos", "-");
	comboHijo.disabled = true;

	if (comboPadre.selectedIndex > 0)
	{
		if (comboPadre.options[comboPadre.selectedIndex].value != "" && comboPadre.options[comboPadre.selectedIndex].value != "-")
		{
			lastValor = comboPadre.selectedIndex;
			loadXMLDoc(urlxml + comboPadre.options[comboPadre.selectedIndex].value, callbackCombo,false);
		}
	}

}
