/* Create a new XMLHttpRequest object to talk to the Web server */
var xmlHttp = false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp = false;
  }
}
@end @*/

var selectedElement;

if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();
}

function lomasenviado() {
  var url = "/scripts/enviados.php";
  selectedElement = "lomasenviado";
  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatePage;
  xmlHttp.send(null);
}
function lomascomentado() {
  var url = "/scripts/comentados.php";
  selectedElement = "lomascomentado";
  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatePage;
  xmlHttp.send(null);
}
function lomasleido() {
  var url = "/scripts/leidos.php";
  selectedElement = "lomasleido";
  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatePage;
  xmlHttp.send(null);
}

function updatePage() {
  if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText;
    document.getElementById("lomas").innerHTML = response;
    document.getElementById("lomasleido").className = "tab_no_select";
    document.getElementById("lomasenviado").className = "tab_no_select";
    document.getElementById("lomascomentado").className = "tab_no_select";
    document.getElementById(selectedElement).className = "tab";
  }
}

