function createObject() {
	var req;
	if(window.XMLHttpRequest){
		req = new XMLHttpRequest();
	} else if(window.ActiveXObject) {
		req = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		alert('Problem creating the XMLHttpRequest object');
	}
	return req;

}

var http = createObject();

function catalog() {
	var textOut = http.responseText;
	document.getElementById('all-'+cid).innerHTML = textOut;
}

function useHttpResponse() {
  if (http.readyState == 4) {
	setTimeout("catalog()",1000);
  }
}

function sendopen(id) {
	cid = id;
	var newLoad = '<div align="center" style="margin:5px;"><img src="/images/wait.gif" alt="" /></div>';
	document.getElementById('all-'+cid).innerHTML = newLoad;
	http.open('get', 'infusions/board/ajax/board.php?action=open&id='+cid+'&rand='+Math.random(), true);
	
	http.onreadystatechange = useHttpResponse;
	http.send(null);
}

function sendclose(id) {
	cid = id;
	var newLoad = '<div align="center" style="margin:5px;"><img src="/images/wait.gif" alt="" /></div>';
	document.getElementById('all-'+cid).innerHTML = newLoad;
	http.open('get', 'infusions/board/ajax/board.php?action=cansel&id='+cid+'&rand='+Math.random(), true);
	
	http.onreadystatechange = useHttpResponse;
	http.send(null);
}

function sendcount(id) {
	cid = id;
	var newLoad = '<div align="center" style="margin:5px;"><img src="/images/wait.gif" alt="" /></div>';
	document.getElementById('all-'+cid).innerHTML = newLoad;
	http.open('get', 'infusions/board/ajax/count.php?action=count&id='+cid+'&rand='+Math.random(), true);
	
	http.onreadystatechange = useHttpResponse;
	http.send(null);
}

function sendstat(id) {
	cid = id;
	var newLoad = '<div align="center" style="margin:5px;"><img src="/images/wait.gif" alt="" /></div>';
	document.getElementById('all-'+cid).innerHTML = newLoad;
	http.open('get', 'infusions/board/ajax/stat.php?id='+cid+'&rand='+Math.random(), true);
	
	http.onreadystatechange = useHttpResponse;
	http.send(null);
}