function ajax(script, post, vars, callback, sync) {
	
	var xmlHttp;
	try {
		xmlHttp=new XMLHttpRequest();
	}
	catch (e) {
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
    	catch (e) {
			try {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) {
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	
    xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState == 4 && callback) {
			callback(xmlHttp.responseText);
		}
	}
	
	var async = !sync;
	
	if(post) {
		xmlHttp.open("POST", script, async);
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.send(vars);
	} else {
		xmlHttp.open("GET", script + "?" + vars, async);
		xmlHttp.send(null);
	}
}
