/* 
* This Ajax stuff was taken from the uncovered email sent by Rasmus Lerdorf that was published at 
* http://rajshekhar.net/blog/archives/85-Rasmus-30-second-AJAX-Tutorial.html. It seems to be proving 
* useful to me and hopefully it will help you out as well. 
*/

function createRequestObject() 
	{
    	var ro;
    	var browser = navigator.appName;
    	if(browser == "Microsoft Internet Explorer")
		{ ro = new ActiveXObject("Microsoft.XMLHTTP"); }
	else
		{ ro = new XMLHttpRequest(); }
    	return ro;
	}

var http = createRequestObject();

function sndReq(action) 
	{ 
    	http.open('get', 'rpc.php?action='+action);
    	http.onreadystatechange = handleResponse;
    	http.send(null);
	}

  function sndReqArg(action,arg) 
  	{
    	http.open('get', 'rpc.php?action='+action+'&arg='+arg);
    	http.onreadystatechange = handleResponse;
    	http.send(null);
  	}

function handleResponse() 
	{
    	if(http.readyState == 4)
		{
        	var response = http.responseText;
        	var update = new Array();

        	if(response.indexOf('|' != -1)) 
			{
            	update = response.split('|');
            	document.getElementById(update[0]).innerHTML = update[1];
        		}
    		}
	}
	
/* **************************************************************************************** */	
/* These next two functions are a test that displays a cached dataset on the page 				 */
/* **************************************************************************************** */
function sndReqDataSet(action, arg)
	{
    	http.open('get', 'rpc.php?action='+action+'&arg='+arg);
    	http.onreadystatechange = handleSndReqDataSet;
    	http.send(null);	
	}


function handleSndReqDataSet()
	{
    	if(http.readyState == 4)
		{
        	var response = http.responseText; 
        	var update = new Array();
		document.getElementById('foo').innerHTML = response;
		return; 
		}
	}
	


/* **************************************************************************************** */
