var READY_STATE_UNINITIALIZED=0;
var READY_STATE_LOADING=1;
var READY_STATE_LOADED=2;
var READY_STATE_INTERACTIVE=3;
var READY_STATE_COMPLETE=4;

var peticion_http;

function cargaContenido(url, metodo, funcion) {
  peticion_http = inicializa_xhr();

  if(peticion_http) {
    peticion_http.onreadystatechange = funcion;
    peticion_http.open(metodo, url, true);
    peticion_http.send(null);
  }
}

function inicializa_xhr() {
  if (window.XMLHttpRequest) { // Mozilla, Safari, ...
    return new XMLHttpRequest();
  }
  else if (window.ActiveXObject) { // IE
    return new ActiveXObject("Microsoft.XMLHTTP");
  }
}

function muestraMensaje() {
  var capa = window.document.getElementById("texto");
  if(peticion_http.readyState == READY_STATE_COMPLETE) {
    if (peticion_http.status == 200) {
      capa.innerHTML = peticion_http.responseText;
    }
  }
}

function cargarDiapositiva(pathAux, puntAux){
	cargaContenido("diapositives/punt_"+puntAux+".html", "GET", muestraMensaje);
}
