// here we define global variable
var ajaxdestination="";
var xmlHttp;

function getdata(what,where) { // get data from source (what)
	try{	
		xmlHttp=new XMLHttpRequest();// Firefox, Opera 8.0+, Safari
	}
	catch (e){
		try{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
		}
		catch (e){
		    try{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e){
				alert("No AJAX!?");
				return false;
			}
		}
	}

	document.getElementById(where).innerHTML ="<center><img src='loading.gif'></center>";
	// we are defining the destination DIV id, must be stored in global variable (ajaxdestination)
	ajaxdestination=where;
	xmlHttp.onreadystatechange = triggered; // when request finished, call the function to put result to destination DIV
	xmlHttp.open("GET", what);
	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;
}

