// --------------------------------------------------------------------------
// function for fixing html chars in url's
// --------------------------------------------------------------------------
function HTMLEncode(str){
	var result = '';
	for(var i=0; i<str.length; i++){
		result += '&#' + str.charCodeAt(i) + ';';
	}
	return result;
}

// --------------------------------------------------------------------------
// Called automatically when we get data back from server
// --------------------------------------------------------------------------
function callback(serverData, serverStatus) {
//	document.getElementById('serverStatus').innerHTML = serverStatus;
//	document.getElementById('result').innerHTML = HTMLEncode(serverData);
	document.getElementById('entry').innerHTML = serverData;
}

// --------------------------------------------------------------------------
// onreadystatechange function
// --------------------------------------------------------------------------

function ajaxRequest(url,method) {

	// Initialize the AJAX variable.
	var AJAX = null;											
	// Does this browser have an XMLHttpRequest object?
	if (window.XMLHttpRequest) {
		// Yes -- initialize it.
		AJAX=new XMLHttpRequest();
	// No, try to initialize it IE style
	} else {
		//  Wheee, ActiveX, how do we format c: again?
		AJAX=new ActiveXObject("Microsoft.XMLHTTP");
	}
	// End setup Ajax.
	// If we couldn't initialize Ajax...
	if (AJAX==null) {
		alert("Your browser doesn't support AJAX.");															  
		// Return false, couldn't set up ajax
		return false
	}
	// When the browser has the request info check state
   AJAX.onreadystatechange = function() {                      // When the browser has the request info..
      if (AJAX.readyState==4 || AJAX.readyState=="complete") { //  see if the complete flag is set.
         callback(AJAX.responseText, AJAX.status);             // Pass the response to our processing function
      }                                                        // End Ajax readystate check.
   }

	// Open the url this object was set-up with.
	AJAX.open(method, url, true);
	// http.open("GET",url+"?"+params, true);

	// Send the request.
	AJAX.send(null);
}

