var xmlhttp
var my_div = null;
var newDiv = null;

function doRequest(url, onOk, onError){
    var http, e;
    
    try{
        http = new XMLHttpRequest();
    }
    catch(e){
         // Para o IE funcionar...
         http = new ActiveXObject("Microsoft.XMLHTTP");
    }
    // O pedido é não bloqueante (por isso passa-se true como parâmetro)
    http.open("GET", url , true );
    http.setRequestHeader("Cache-Control", "no-cache");
	http.setRequestHeader("Pragma", "no-cache"); 
   
    http.onreadystatechange = function() {
            if(http.readyState == 4 && http.status == 200) {
                onOk(http);
            }
            else if (http.readyState == 4 && http.status != 200) onError(http);
    };
    http.send(null);
}

function show( http ) {
 
  var div=document.getElementById("caixaGeral");
  
  var text = document.createElement("div");
  
   while(text.hasChildNodes()) text.removeChild(text.firstChild);
  
  text.className='caixaTexto';
        
  text.innerHTML = http.responseText;    
           
  div.appendChild(text);

}

function processError(http){

    alert("Opps...An error ocurred while performing search. Please cross your fingers and try again!");

}




