function populate_cidades(obj, estado)
{
	var combo = document.getElementById(obj);

	if(estado == '')
	{
		combo.length = 0;
		combo.disabled = true;
		combo.length = 1;
		combo.options[0].value = '';
		combo.options[0].text = ' -- Selecione o Estado -- ';
	}else{
		combo.disabled = true;
		combo.length = 0;
		combo.length = 1;
		combo.options[0].value = '';
		combo.options[0].text = ' --- Carregando --- ';

		var xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
			return;
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				var XML = xmlHttp.responseXML.documentElement.getElementsByTagName('cidade');

				combo.length = 0;
				combo.length = XML.length;
				for(i=0; i<XML.length; i++)
				{
					combo.options[i].value = XML[i].getAttribute("nome");
					combo.options[i].text = XML[i].getAttribute("nome");
				}
				combo.disabled = false;
			}
		}
		url = '../xml/' + estado + '.xml';
		xmlHttp.open("GET", url, true);
		xmlHttp.send(null);
	}
}


function populate_galeria(obj, id_galeria)
{
	var combo = document.getElementById(obj);

	if(id_galeria == '')
	{
		combo.length = 0;
		combo.disabled = true;
		combo.length = 1;
		combo.options[0].value = '';
		combo.options[0].text = 'Selecione um Álbum';
	}else{
		combo.disabled = true;
		combo.length = 0;
		combo.length = 1;
		combo.options[0].value = '';
		combo.options[0].text = ' --- Carregando --- ';

		var xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
			return;
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				var XML = xmlHttp.responseXML.documentElement.getElementsByTagName('galeria');

				combo.length = 0;
				combo.length = XML.length + 1;

				combo.options[0].value = '';
				combo.options[0].text = 'Selecione a Data/Grupo';

				for(i=0; i<XML.length; i++)
				{
					combo.options[i+1].value = XML[i].getAttribute("id_galeria_foto");
					combo.options[i+1].text = XML[i].getAttribute("nome");
				}
				combo.disabled = false;
			}
		}
		url = '../actions/xml_galeria.php?id_galeria='+id_galeria;
		xmlHttp.open("GET", url, true);
		xmlHttp.send(null);
	}
}