	var xmlhttp = getXmlHttpRequest();
	
	function getXmlHttpRequest() {
		if (window.XMLHttpRequest) {
			return new XMLHttpRequest();
		} else if (window.ActiveXObject) {
			return new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	

function Inserir(url,id_membro,id_distrito){
	  xmlhttp.open("GET", url + '?id_membro=' + id_membro + '&id_distrito=' + id_distrito, true);
	  xmlhttp.onreadystatechange = function(){
	  
		   if (xmlhttp.readyState == 4){
		   
			   var texto = xmlhttp.responseText;
			   texto = texto.replace(/\+/g," ");
			   texto = unescape(texto);
				alert(texto);
			}
	  } 
	  xmlhttp.send(null);
 }


function Carrega(url,ID){
  document.getElementById("conselhos").innerHTML = '<select name="conselho" id="conselho" disabled="disabled"><option>Carregando...</option></select>';
  xmlhttp.open("GET", url + '?id=' + ID, true);
  xmlhttp.onreadystatechange = function(){
  
   if (xmlhttp.readyState == 4){
   
   var texto = xmlhttp.responseText;
   texto = texto.replace(/\+/g," ");
   texto = unescape(texto);
	document.getElementById("conselhos").innerHTML = xmlhttp.responseText;
   }
  } 
  xmlhttp.send(null);
 }

	
function Carrega2(url,ID){
  document.getElementById("concelhos").innerHTML = '<select name="conselho" id="conselho" disabled="disabled"><option>Carregando...</option></select>';
  xmlhttp.open("GET", url + '?id=' + ID, true);
  xmlhttp.onreadystatechange = function(){
  
   if (xmlhttp.readyState == 4){
   
   var texto = xmlhttp.responseText;
   texto = texto.replace(/\+/g," ");
   texto = unescape(texto);
	document.getElementById("concelhos").innerHTML = xmlhttp.responseText;
   }
  } 
  xmlhttp.send(null);
 }
 
 function Carrega3(url,ID){
  document.getElementById("categoria").innerHTML = '<select name="id_categoria" id="id_categoria" disabled="disabled"><option>Carregando...</option></select>';
  xmlhttp.open("GET", url + '?id=' + ID, true);
  xmlhttp.onreadystatechange = function(){
  
   if (xmlhttp.readyState == 4){
   
   var texto = xmlhttp.responseText;
   texto = texto.replace(/\+/g," ");
   texto = unescape(texto);
	document.getElementById("categoria").innerHTML = xmlhttp.responseText;
   }
  } 
  xmlhttp.send(null);
 }
 
 
 function Carrega4(url,ID){
  alvara(ID);
  document.getElementById("Pcategoria").innerHTML = '<select name="id_categoria" id="id_categoria" disabled="disabled"><option>Carregando...</option></select>';
  xmlhttp.open("GET", url + '?id=' + ID, true);
  xmlhttp.onreadystatechange = function(){
  
   if (xmlhttp.readyState == 4){
   
   var texto = xmlhttp.responseText;
   texto = texto.replace(/\+/g," ");
   texto = unescape(texto);
	document.getElementById("Pcategoria").innerHTML = xmlhttp.responseText;
   }
  } 
  xmlhttp.send(null);
 }
 
 function Carrega5(url,ID){
  document.getElementById("Pcategoria").innerHTML = '<select name="id_categoria" id="id_categoria" disabled="disabled"><option>Carregando...</option></select>';
  xmlhttp.open("GET", url + '?id=' + ID, true);
  xmlhttp.onreadystatechange = function(){
  
   if (xmlhttp.readyState == 4){
   
   var texto = xmlhttp.responseText;
   texto = texto.replace(/\+/g," ");
   texto = unescape(texto);
	document.getElementById("Pcategoria").innerHTML = xmlhttp.responseText;
   }
  } 
  xmlhttp.send(null);
 }
 


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}