function GetXmlHttpObject () {
	var xmlHttp = null;
	try {
		// Firefox, Opera 8.0+, Safari
  		xmlHttp = new XMLHttpRequest();
	}
	catch (e) {
		// Internet Explorer
		try {
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) {
			try {
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) {
				alert ("Please update your browser!");
			}
		}
	}
	return xmlHttp;
}

function ajaxAction (fn, url, param) {
	var xmlHttp;
	xmlHttp = GetXmlHttpObject()

	if (xmlHttp == null) return;
	xmlHttp.onreadystatechange = stateChanged;
	xmlHttp.open ("GET", url, true);
	xmlHttp.send (null);

	function stateChanged () {
		if (xmlHttp.readyState == 4) {
			if (xmlHttp.status == 200) {
				var xmldoc = xmlHttp.responseXML;

				if (fn == 'showPrice') {
					var root_node = xmldoc.getElementsByTagName('price').item(0);
					var id = document.getElementById('selected').value;
					document.getElementById('status_' + id).checked = true;
					document.getElementById('price_' + id).innerHTML = root_node.firstChild.data;
				}

				if (fn == 'updateStatus') {
					document.getElementById('UpdatedLbl' + param).innerHTML = 'UPDATED!';
				}

				if (fn == 'updateLicence') {
					document.getElementById('btn_' + param).disabled = true;
				}
			} else {
				if (fn == 'showPrice') {
					document.getElementById('new_' + id).value = '';
				}
				alert('Sorry, there was some kind of a problem.');
			}
		}
	}
}
