var AJAX= new ajaxClass();

function ajaxClass() {
	var xhr= false;

	this.fetchXML= function(url, postdata, callback) {

		if (xhr) delete xhr;

	    if (window.XMLHttpRequest) { // Mozilla, Safari, ...
	        xhr = new XMLHttpRequest();
	    } else if (window.ActiveXObject) { // IE
	        try {
	            xhr = new ActiveXObject("Msxml2.XMLHTTP");
	        } catch (e) {
	            try {
	                xhr = new ActiveXObject("Microsoft.XMLHTTP");
	            } catch (e) {}
	        }
	    }

	    if (!xhr) {
	        alert('Giving up :( Cannot create an XMLHTTP instance');
	        return false;
	    }

		xhr.onreadystatechange = function() {
			try {
			    if (xhr.readyState == 4) {
			        if (xhr.status == 200) {
			            callback(xhr.responseXML);
			        } else {
			            alert('There was a problem with the request.');
			        }
			    }
			} catch( e ) {
			    alert('Error contacting server: ' + e.message);
			}
		}

		xhr.open('POST', url, true);
	    xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	    xhr.send(postdata);
	}
}