// interclimax copyright 2009
function debug(text) 
{
	if(document.getElementById("javascript-debug-pane")) document.getElementById("javascript-debug-pane").value+=text + "\n";
}
//
function display(obj)
{
 	info_showing = obj.id;
}
//
function uncross(obj)
{
	if(obj.className == 'fail')
	{
  		obj.className = '';
 	}
 	return;
}
//										
function httpRequest() 
{
	// Create the requestHandler
 	try {
  		this.requestHandler=new ActiveXObject("Msxml2.XMLHTTP");
 	}
 	catch(e1) {
	  	try {
	   		this.requestHandler=new ActiveXObject("Microsoft.XMLHTTP");
	  	}
	  	catch(e2) {
	   		this.requestHandler=false;
	  	}
	}
 	if(!this.requestHandler && window.createRequest) 
	{
  		try {
   			this.requestHandler=window.createRequest();
  		}
  		catch(e) {
   			this.requestHandler=false;
  		}
 	}
 	if(!this.requestHandler && typeof(XMLHttpRequest)!='undefined') 
	{
  		try {
   			this.requestHandler=new XMLHttpRequest();
  		}
  		catch(e) {
   			this.requestHandler=false;
  		}
 	}
 	debug("New httpRequest created");
}
//
httpRequest.prototype.handleChange=function() 
{
	//debug("ReadyState changed to " + this.requestHandler.readyState);
 	if(this.requestHandler.readyState==4 && this.callback) this.callback(this.requestHandler.responseText);
}
//
httpRequest.prototype.get=function(url, callback) 
{
 	//debug("GET " + url + (callback==null ? " (no callback)" : " (with callback)"));
 	var copy=this;
 	this.requestHandler.onreadystatechange=function() {copy.handleChange();} 
 	if(callback) this.callback=callback;
 	else this.callback=null;
 	this.requestHandler.open("GET", url, true);
 	this.requestHandler.send(null);
}
//
function describe(what) 
{
	a="";
 	for(part in what) try{a+=part + "=" + what[part] + "\n";} catch(e) {}
 	return a;
}
//
function throwaway_request(url) 
{
	var req=new httpRequest();
 	req.get(url);
}
//
function callback_request(url, callback) 
{
	var req=new httpRequest();
 	req.get(url, callback);
}
// end 

