// JavaScript Document
var request;
var render;

function ajax_query(URL,params,r){
	render = r;
  if(window.XMLHttpRequest){ request = new XMLHttpRequest(); }
  else if (window.ActiveXObject) { request = new ActiveXObject("Microsoft.XMLHTTP"); }
  
  if (request) {
	request.onreadystatechange = results;
	request.open("GET", "/API/"+URL+".php?"+params, true);
	request.send(null);
    }
}

function results(){
  if (request.readyState == 4){
    if (request.status == 200){
		response = request.responseText;
		eval (render+"('"+response+"')");
	}
  }
}