function newAjax(){
	var xmlhttp=false;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {
			xmlhttp = false;
		}
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

function callAjax(callback, paramsGET, urlServlet, xmlhttp){
	if(urlServlet==null || urlServlet=="") urlServlet = "/common/project/resources/servlet.php";
	if(xmlhttp==null){
		var xmlhttp = newAjax();
	}else{
		xmlhttp.abort();
	}
	xmlhttp.open("GET", urlServlet+paramsGET);
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200) {
			if(callback!=null) callback(xmlhttp);
		}
	}
	xmlhttp.send(null);
}

function callAjaxPOST(callback, func, data, urlServlet, xmlhttp){
	if(urlServlet==null || urlServlet=="") urlServlet = "/common/project/resources/servlet.php";
	urlServlet+= "?func="+func;
	if(xmlhttp==null){
		xmlhttp = newAjax();
	}else{
		xmlhttp.abort();
	}
	xmlhttp.open("POST", urlServlet);
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200) {
			if(callback!=null) callback(xmlhttp);
		}
	}
	xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");	
	xmlhttp.send(data);
}
