/*
   AJAX function to request data from URL, and update innerHTML content
   of HTML element specified by supplied id
*/
function ajaxFunction(url,id)
{
   /* usual stuff to create xmlHttp object */
   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("Could not display some data as your browser does not support AJAX.");
            return false;
         }
      }
   }
   /* when data received, update contents of specified HTML element */
   xmlHttp.onreadystatechange=function()
   {
      if(xmlHttp.readyState==4)
      {
         document.getElementById(id).innerHTML = xmlHttp.responseText;
      }
   }
   /* display "loading" message before requesting new data */
   document.getElementById(id).innerHTML = '<p>Loading, please wait....</p>';
   /* Send request */
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null);
}

