// JavaScript Document
var req;

function process_request() 
{
	var response;

	if (req.readyState == 4)
	{
		if (req.status == 200) 
		{
			var myXML;
			
			// enable this line for testing
			//alert(req.responseText);
			
			if (myXML = req.responseXML.documentElement)
			{
				method = myXML.getElementsByTagName('method')[0].firstChild.data;
				eval(method + '(\'\', 1, myXML)');
			}
			else alert("XML file corruption, please try again: " + req.statusText);
		}
		else alert("error retrieving XML data: " + req.statusText);
	}
}

function rpc_exec(url) 
{	
	// branch for native XMLHttpRequest object
	if (window.XMLHttpRequest)
	{
		//alert("mozilla or 3rd party");
		req = new XMLHttpRequest();
		
		if (req)
		{
			req.onreadystatechange = process_request;
			req.open("GET", url, true);
			req.send(null);
		}
		else alert("no object created");
	}
	// branch for IE/Windows ActiveX version
	else if (window.ActiveXObject)
	{
		req = new ActiveXObject("Microsoft.XMLHTTP");
		
		if (req)
		{
			req.onreadystatechange = process_request;
			req.open("GET", url, true);
			req.send();
		}
		else alert("no active x");
	}
	else alert("browser cannot handle this script");
}
