// here we define global variable
var ajaxdestination2="";

function getdata2(what2,where2) { // get data from source (what2)
 try {
   xmlhttp = window.XMLHttpRequest?new XMLHttpRequest():
  		new ActiveXObject("Microsoft.XMLHTTP");
 }
 catch (e) { /* do nothing */ }

 document.getElementById(where2).innerHTML ="<center><img src='images/loading.gif'></center>";
// we are defining the destination DIV id, must be stored in global variable (ajaxdestination2)
 ajaxdestination2=where2;
 xmlhttp.onreadystatechange = triggered2; // when request finished, call the function to put result to destination DIV
 xmlhttp.open("GET", what2);
 xmlhttp.send(null);
  return false;
}

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


