///////////////////////////////////////////////////////////////////////////
/////////////////// Funciones para la Comunicacion ////////////////////////
///////////////////////////////////////////////////////////////////////////
var peticion_http = null;
var READY_STATE_COMPLETE=4;

function inicializa_xhr() {
  if(window.XMLHttpRequest) {
    return new XMLHttpRequest(); 
  }
  else if(window.ActiveXObject) {
    return new ActiveXObject("Microsoft.XMLHTTP");
  } 
}
function envia(XML) {
  peticion_http = inicializa_xhr();
  peticion_http.onreadystatechange = procesaRespuesta;
  if(peticion_http) {
    peticion_http.open("POST", "./servlet/Servlet.Server", true);//todo: cambiar localhost por la ip del servidor
    //peticion_http.open("POST", "./Server", true);//todo: cambiar localhost por la ip del servidor
    peticion_http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    peticion_http.send("a=" + XML);
  }
}