
function Extrair_scripts(texto){

var ini, pos_src, fim, codigo;
var objScript = null;
ini = texto.indexOf('<script', 0)
while (ini!=-1){
var objScript = document.createElement("script");

pos_src = texto.indexOf(' src', ini)
ini = texto.indexOf('>', ini) + 1;
if (pos_src < ini && pos_src >=0){
ini = pos_src + 4;
fim = texto.indexOf('.', ini)+4;
codigo = texto.substring(ini,fim);
codigo = codigo.replace("=","").replace(" ","").replace("\"","").replace("\"","").replace("\'","").replace("\'","").replace(">","");
objScript.src = codigo;
}else{
fim = texto.indexOf('</script>', ini);
codigo = texto.substring(ini,fim);
objScript.text = codigo;
}
document.body.appendChild(objScript);
ini = texto.indexOf('<script', fim);
objScript = null;
}
} 



try{
xmlhttp = new XMLHttpRequest();
}
catch(ee){
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){
try{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

}
catch(E){
xmlhttp = false;
}
}
}
function abre(arquivo,metodo,onde){
xmlhttp.open(metodo,arquivo);
xmlhttp.onreadystatechange=conteudo;
xmlhttp.setRequestHeader("Pragma", "no-cache");
xmlhttp.setRequestHeader("Cache-Control", "no-cache");
xmlhttp.send(null)

function conteudo() {

document.getElementById(onde).innerHTML="<img src='/imagens/loading.gif' border=0>";
if (xmlhttp.readyState==4){
		if (xmlhttp.status ==200){
			var texto=xmlhttp.responseText;



            //codigo = xmlhttp.responseText;codigo = codigo.replace(String.fromCharCode(13) + String.fromCharCode(10), "");
			texto = xmlhttp.responseText;texto = texto.replace(String.fromCharCode(13) + String.fromCharCode(10), "");
            //document.getElementById(onde).innerHTML=codigo;
			document.getElementById(onde).innerHTML=texto;
		    Extrair_scripts(texto);			
             }
          }
     }

}
