// definiendo variables globales
var ajaxdestination="";
var xmlhttp;

function getdata(what,where) { // get data from source (what)
 try {
     if (window.ActiveXObject) xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
     else if (window.XMLHttpRequest) xmlhttp = new XMLHttpRequest();
     else xmlhttp = null;
 } catch (e) { alert("Lo sentimos tu buscador no soporta AJAX.");}
 
//document.getElementById(where).innerHTML ="<center><img src='imagenes/adn.jpg'></center>";
// we are defining the destination DIV id, must be stored in global variable (ajaxdestination)
 ajaxdestination=where;
// when request finished, call the function to put result to destination DIV
 xmlhttp.onreadystatechange = triggered;
 xmlhttp.open("GET", what, true);
 xmlhttp.send(null);
  return false;
}

function triggered() { // put data returned by requested URL to selected DIV
  if (xmlhttp.readyState == 4)
     //if (xmlhttp.status == 200)
        document.getElementById(ajaxdestination).innerHTML =xmlhttp.responseText;
}




