//-------------------------------------------------------------------
// AJAX LIB
//-------------------------------------------------------------------
function create_XMLHttpRequest() {

	var req = null;
	try {
		req = new ActiveXObject("MSXML2.XMLHTTP");
		} catch(err_MSXML2) {
		try {
			req = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(err_Microsoft) {
				if(typeof XMLHttpRequest != "undefined")
					req = new XMLHttpRequest;
			}
		}

    if(req==null)
        document.location='/shared/wrongbrowser.asp';

	return req;

};
//-------------------------------------------------------------------
function AJAXCall(	methode,		// POST or GET
					aspScript,  	// the URL to the ASP script file
					data,			// the data passed to the aspScript URL
					parsefunction	// function to parse data
		 			) {

	this.methode = methode;
	this.aspScript = aspScript;
	this.data = data;
	this.response = null;

	var xmlhttp = create_XMLHttpRequest();
	if(xmlhttp == null)
		return;
	xmlhttp.open(methode,aspScript,true);
	xmlhttp.onreadystatechange = function() {
	 //	this.response = xmlhttp.responseText;
		if(xmlhttp.readyState == 4) {
			if(xmlhttp.status == 200){
				var response = xmlhttp.responseText;
				parsefunction(response);
				xmlhttp = null;
			} else {
				alert("An error occured during your operation. Please try again later! status:" + xmlhttp.status + "/" + response);
				xmlhttp = null;
			}
		}
   	};
	xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
	xmlhttp.send(data);
};
//-------------------------------------------------------------------






