	
	var xmlHttp = createXmlHttpRequestObject();
	
	function createXmlHttpRequestObject() {
		// store the ref to the object
		var xmlHttp;
		
		/*
		try {
			xmlHttp = new XMLHttpRequest();
		}
		// works with IE 6 or older
		catch(e) {
			var xmlHttpVersions = new Array("MSXML2.XMLHTTP.6.0",
											"MSXML2.XMLHTTP.5.0",
											"MSXML2.XMLHTTP.4.0",
											"MSXML2.XMLHTTP.3.0",
											"MSXML2.XMLHTTP",
											"Microsoft.XMLHTTP");
			// try every version until one works
			for(var i = 0; i < xmlHttpVersions.length && !xmlHttp; $i++) {
				try {
					xmlHttp = new ActiveXObject(xmlHttpVersions[i]);
				}
				catch(e) { 
					alert('AJAX is not supported by your browser!');
					return false;				
				}
			}
		}
		*/
		try {
			xmlHttp = new XMLHttpRequest();
		}
		catch(e) {
			try {
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e) {
				alert('AJAX is not supported by your browser!');
				return false;
			}
		}
		
		
		// return the created object or display an error
		if(!xmlHttp) {
			alert("Error creating the XmlHttpRequest object");
		}
		else {
			return xmlHttp;
		}
	}
	
	// read a file from the server
	function process(numValue) {
		// only continue if xmlHttp is not void
		if(xmlHttp) {
			// try to connect
			try {
				
				// create the params string
				var params = "styleVal=" + numValue;
				
				// initialise the async server request
				xmlHttp.open("GET", "setStyle.php?" + params, true);
				xmlHttp.onreadystatechange = handleRequestStateChange;
				xmlHttp.send(null)
			}
			// catch error in case of failure
			catch(e) {
				alert("Can't connect to server\n" + e.toString());
			}
		}
	}
	
	// function called when the http request changes
	function handleRequestStateChange() {
		// when readystate is 4 we are ready for the response
		if(xmlHttp.readyState == 4) {
			// continue only if HTTP status is OK
			if(xmlHttp.status == 200) {
				try {
					// do something with the resonse from the server
					handleServerResponse();
				}
				catch(e) {
					alert("Error reading the response: " + e.toString());
				}
			}
			else {
				alert("There was a problem reading the data:\n" + xmlHttp.statusText);
			}
		}
	}
	
	// handle the response from the server
	function handleServerResponse() {
		// retrieve the servers response packaged as an XML DOM object
		var xmlResponse = xmlHttp.responseXML;
		window.location.reload();
		
	}