
function getxmlhttp(){
	//boolean variable to check for a valid MS activex instance
	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 to process an XMLHttpRequest

function processajax (serverPage, obj, getOrPost, str){
	// get object

	xmlhttp = getxmlhttp();
	if (getOrPost == "get")
		{
		xmlhttp.open("GET", serverPage);
		xmlhttp.onreadystatechange = function() 
			{
			//alert ('readyState: '+xmlhttp.readyState +'; status: '+xmlhttp.status );
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				document.getElementById(obj).innerHTML = xmlhttp.responseText;
				}
			}	
		xmlhttp.send(null);
		}
	else
		{
		//alert(obj+ ' '+serverPage);
		//document.getElementById(obj).innerHTML = serverPage;
		xmlhttp.open("POST", serverPage, true);	 
		xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8");
		xmlhttp.onreadystatechange = function()
			{
			//alert ('readyState: '+xmlhttp.readyState +'; status: '+xmlhttp.status );
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
				{
				//alert ('here');
				window.document.getElementById(obj).innerHTML = xmlhttp.responseText;
				//alert (xmlhttp.responseText);
				}
			}
		xmlhttp.send(str);
		}
	}
