// JavaScript Document

var xmlhttp;
var Loaded = "<img src='engine/javascript/ajax/load.gif' />";

function createobject() {
	if(window.ActiveXObject) {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} else if (window.XMLHttpRequest) {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

function do_main(method, url, query, loading) {
	if(method == "post") {
		createobject();
		xmlhttp.open("POST", url, true);
		xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlhttp.onreadystatechange = function() {
			if(xmlhttp.readyState == 4) {
				document.getElementById(loading).innerHTML = xmlhttp.responseText;
			} else {
				document.getElementById(loading).innerHTML = Loaded;
			}
		}
		xmlhttp.send(query);
	}
}
