function ajaxInit() {
var xmlhttp;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
xmlhttp = false;
}
}	
if (!xmlhttp && typeof XMLHttpRequest != 'undefined' ) {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp = false ;
}
}
return xmlhttp;
}
function getSecoes(pagina,layer,pesquisa) {
var carregando = document.getElementById("carregando");
var layer = document.getElementById(layer);
carregando.style.display = 'block';
ajax = ajaxInit();
ajax.open("GET","process/"+pagina+".php?pesquisa="+pesquisa, true);
ajax.onreadystatechange = function() {
if(ajax.readyState == 4 && ajax.status == 200) {
var resultado = ajax.responseText;
resultado=resultado.replace(/\+/g," ");
resultado = unescape(resultado);
carregando.style.display = 'none';
layer.innerHTML = resultado;
jsScript(resultado);
} 
};
ajax.send(null);
}

function jsScript(texto){
var ini = 0;
while (ini!=-1){
ini = texto.indexOf('<script', ini);
if (ini >=0){
ini = texto.indexOf('>', ini) + 1;
var fim = texto.indexOf('</script>', ini);
codigo = texto.substring(ini,fim);
novo = document.createElement("script");
novo.text = codigo;
document.body.appendChild(novo);
}
}
}