﻿var xmlhttp = null;

function pegaConteudo(page) {
    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 ; 
        } 
    }

    if (xmlhttp) {
        xmlhttp.onreadystatechange = processadorMudancaEstado;
        xmlhttp.open("GET",page);
        xmlhttp.setRequestHeader('Content-Type','text/xml');
        xmlhttp.setRequestHeader('encoding','ISO-8859-1');
        xmlhttp.send(null);
    }
}

function processadorMudancaEstado () {
    if ( xmlhttp.readyState == 4) { // Completo 
        if ( xmlhttp.status == 200) { // resposta do servidor OK 
            document.getElementById ("conteudo"). innerHTML = xmlhttp.responseText ; 
        } else { 
            alert( "Problema: " + xmlhttp.statusText );  
        } 
    }
}


