// JavaScript Document

function createXMLHTTP(){
	try {
			ajax = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e){
		try{
			ajax = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(ex){
		try{
			ajax = new XMLHttpRequest();
		}
		catch(exc){
		alert("Esse browser não tem recursos para uso do Ajax");
		ajax = null;
		}
	}
	return ajax;
}

var arrSignatures = ["MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0",
"MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP",
"Microsoft.XMLHTTP"];
	for (var i=0; i < arrSignatures.length; i++) {
	try {
	oRequest = new ActiveXObject(arrSignatures[i]);
	return oRequest;
} catch (oError){
	}
}
 throw new Error("MSXML is not installed on your system.");
}


function TiraConcelhos(Distrito){
	var oHTTPRequest = createXMLHTTP();
	oHTTPRequest.open("post", "/includes2005/pesquisa09_concelhos.asp?Distrito="+Distrito, true);
	oHTTPRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	oHTTPRequest.onreadystatechange=function() {
		// O valor 4 significa que o objeto já completou a solicitação
		if (oHTTPRequest.readyState==4){
			// Abaixo o texto é gerado no arquivo executa.asp e colocado no div
			document.getElementById('divConcelhos').innerHTML = oHTTPRequest.responseText;
			//document.all.divseccoes.innerHTML = oHTTPRequest.responseText;
		}
	}

	oHTTPRequest.send("tipo=" + Distrito);
}

