// Documento JavaScript
function createRequestObject() {

   var req;

   if(window.XMLHttpRequest){
      // Firefox, Safari, Opera...
      req = new XMLHttpRequest();
   } else if(window.ActiveXObject) {
      // Internet Explorer 5+
      req = new ActiveXObject("Microsoft.XMLHTTP");
   } else {
      // There is an error creating the object,
      // just as an old browser is being used.
      alert('Su navegador no soporta AJAX.');
   }

   return req;

}

// Make the XMLHttpRequest object
var http = createRequestObject();

function verCaso(caso) {

   // Open PHP script for requests
   http.open('get', 'casos.php?caso='+caso);
   http.onreadystatechange = handleResponse;
   http.send(null);
   showbox(); //muestra ya el box

}

//TARJETAS DE CREDITO
function verCartera(cartera) {

   // Open PHP script for requests
   http.open('get', 'cartera.php?cartera='+cartera);
   http.onreadystatechange = handleResponse;
   http.send(null);
   showbox(); //muestra ya el box

}

//BALANCES
function verBalance(balance) {

   // Open PHP script for requests
   http.open('get', 'balance.php?balance='+balance);
   http.onreadystatechange = handleResponse;
   http.send(null);
   showbox(); //muestra ya el box

}

//ESTADÍSTICAS
function verEstadistica(estadistica) {

   // Open PHP script for requests
   http.open('get', 'estadistica.php?estadistica='+estadistica);
   http.onreadystatechange = handleResponse;
   http.send(null);
   showbox(); //muestra ya el box

}


function handleResponse() {

   if(http.readyState == 4 && http.status == 200){

      // Text returned FROM the PHP script
      var response = http.responseText;

      if(response) {
         // UPDATE ajaxTest content
		 document.getElementById("box").innerHTML = response;
      }

   } else {
	   
	   document.getElementById("box").innerHTML = '<div align="center" style="color:#fff;margin-top:180px;"><img src="gfx/loader.gif" width="16" height="16" /></div><div align="center" style="margin-top:20px;"><strong>Cargando...</strong></div>';
   }

}