function NuevoAjax(){
    var xmlhttp=false;
    try{
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
        try{
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }catch(E){
            xmlhttp = false;
        }
    }

    if(!xmlhttp && typeof XMLHttpRequest!='undefined'){
        xmlhttp = new XMLHttpRequest();
    }
    return xmlhttp;
}
function cargar_pagina (url, contenido){
    contenedor = document.getElementById(contenido);
    var tipo = contenedor.tagName;
    ajax=NuevoAjax();
    ajax.open("GET", url,true); 
    ajax.onreadystatechange=function(){
        if(ajax.readyState==1){
            //Sucede cuando se esta cargando la pagina
            if (tipo=='INPUT'){
                contenedor.value = "Cargando...";//<-- Aca puede ir una precarga
            }else{
                contenedor.innerHTML = "Cargando...";//<-- Aca puede ir una precarga
            }
        }else if(ajax.readyState==4){
         	//Sucede cuando la pagina se cargó
            if (tipo=='INPUT'){
                contenedor.value = ajax.responseText;
            }else{
                contenedor.innerHTML = ajax.responseText;
            }
            var textoo = ajax.responseText;
        }
    }
    ajax.send(null);
}

