/**
 * AJAX support
 * @param {String} url Honnan jön az info.
 * @param {String} method GET/POST.
 * @param {String} params Paraméterek.
 * @param {Boolean} async true/false.
 * @param {String} responseType XML/text.
 * @return {Object} response Az eredmény.
 */
function AJAXRequest(url, method, params, async, responseType) {
	//create a xmlhttp object for cross browser support
	if (window.XMLHttpRequest) {
	    // code for IE7+, Firefox, Chrome, Opera, Safari
	    xmlhttp = new XMLHttpRequest();
	}
	else {
	    // code for IE6, IE5
	    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	xmlhttp.open(method, url, async);	
	if (method == "POST") {
		xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	}    
	xmlhttp.send(params);
	
	//return the result in the specified format
	if (responseType == 'XML') {
		var response = xmlhttp.responseXML;
	} else {
		var response = xmlhttp.responseText;
	}
	
	return response;
}
