function UpdateElement(id, uri)
{
var xmlHttp;
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<=3)
		{
		  //document.getElementById(id).innerHTML="<center><img src='assets/widgets/loading_anim_48.gif'></center>";
		  document.getElementById(id).uri=uri;
		}
	  
		if(xmlHttp.readyState==4)
	    {
			if(xmlHttp.status!=200)
			{
				document.getElementById(id).innerHTML="Error - " + xmlHttp.status + ": " + xmlHttp.statusText;
			}
			else
			{
				//alert(xmlHttp.responseText);
				response = xmlHttp.responseXML;
				if(response != null && typeof(response.getElementsByTagName("content")[0]) != "undefined" && response.getElementsByTagName("content")[0] != null)
				{
					// Reset any special navigation options that have been activated, if we're updating the mainpanel
					if("mainpanel" == id && typeof(document.getElementById('navigation_actions')) != "undefined" && document.getElementById('navigation_actions') != null)
					{
						document.getElementById('navigation_actions').innerHTML = ('');
					}
					document.getElementById(id).innerHTML=response.getElementsByTagName("content")[0].firstChild.nodeValue;
				}
				else
				{
					document.getElementById(id).innerHTML = "<!--Error - Could not load content tag! Page returned was:" + xmlHttp.responseText + "-->";
				}
				if(typeof(response.getElementsByTagName("script")[0]) != "undefined" && response.getElementsByTagName("script")[0] != null)
				{
					document.getElementById(id).script=response.getElementsByTagName("script")[0].firstChild.nodeValue;
					eval(response.getElementsByTagName("script")[0].firstChild.nodeValue);
				}
				if("mainpanel" == id) //then also update navigation
				{
					keepDivsOnScreen(true);
					if(null != response.getElementsByTagName("childof")[0].firstChild)
						UpdateNavigation(response.getElementsByTagName("navi")[0].firstChild.nodeValue, response.getElementsByTagName("childof")[0].firstChild.nodeValue);
					else
						UpdateNavigation(response.getElementsByTagName("navi")[0].firstChild.nodeValue, '');
				}
			}
		}
    }
  xmlHttp.open("GET",uri,true);
  xmlHttp.send(null);
}
