///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Send the given string to the server. Update the given element with the result text when received, and 
// finally "eval" the given string.
//
// The string_to_eval argument can be used to call an arbitrary function after the result is received
// from the server.
function MakeAjaxRequest(server_string, element_to_update, string_to_eval)
{
	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("Your browser does not support AJAX!");      
			return false;     
		}
	   }
	}
	
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			if (typeof(element_to_update) != 'undefined')
			{
				document.getElementById(element_to_update).innerHTML = xmlHttp.responseText;
			}
			
			if (typeof(string_to_eval) != 'undefined')
			{
				eval(string_to_eval);
			}
		}
	}
	xmlHttp.open("GET",server_string,true);
	xmlHttp.send(null);
}

