var http;
var dataTable = new Array();
var processCallback = { 
	update: function(data){ 
		makeArray(data);
	}
};
var displayCallback;
var updated = 0;

function getInfo(url) {
	
	if (url == null) return 0;     
		 
	if (window.XMLHttpRequest) {
		// code for all new browsers
	  	http=new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		// code for IE5 and IE6
	  	http=new ActiveXObject("Microsoft.XMLHTTP");
	}
	http.open("GET", url, true);
	http.onreadystatechange = useHttpResponse;
	http.send(null);
}

function setInfo(url) {
	if (url == null) return 0;
	 
	if (window.XMLHttpRequest) {
		// code for all new browsers
	  	http=new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		// code for IE5 and IE6
	  	http=new ActiveXObject("Microsoft.XMLHTTP");
	}
	http.open("GET", url, true);
	http.onreadystatechange = doNothing;
	http.send(null);
}

function useHttpResponse() {
	if (http.readyState == 4) {
	    var textout = http.responseText; 
		if (processCallback != null) {
			processCallback.update(textout);
		}
	}
}

function doNothing() {
	alert("No nothing");
}

function makeArray(data) {  
	var matches = data.match(/^[\s\n\r]+$/);
	if (matches != null) return;        
	var dataSets = data.split("\n");
	for (ds in dataSets) { 
		var aRecord = dataSets[ds].split('#{1}#');
		if (aRecord == "") aRecord = new Array();
		var record = new Array(); 
		for (col in aRecord) {
			record.push(aRecord[col].split('#{2}#')); 
		}
		dataTable.push(record);
	}
	if (displayCallback != null) {
		displayCallback.update();
	} 
}

