// here's our little Ajax Function that will load the element :)
function instrument( value , element )
    {    
var xmlHttp;
  
//everyone has thier own way of making a random number for the end. I tend to use the time/date to keep it unique  
var date = new Date();

// lets make up our little timestamp then shall we? :) 
 
var timestamp = date.getDay() + date.getMonth() + date.getYear() + date.getHours() + date.getMinutes() + date.getSeconds();
  
// last but not least, let's build our URL to query and add the timestamp on to stop it getting a cached result. 
var location = '../scripts/instrument.php?value=' + value + '&timestamp=' + timestamp;

    // this next little bit tries to create the Ajax Event depending on the browser. If it fails, it goes on till it runs out of trys  
   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)
        { 
     // Give up trying and tell the user to get a decent browser ;)
        alert("Your browser does not support AJAX!");
                return false;        }      }    }
       // this bit is called whenever Ajax reports a change in state (like loading / loaded / failed, etc)
       xmlHttp.onreadystatechange=function()
      {
      // readyState4 means it's all ok and it's got a result
      if(xmlHttp.readyState==4)
        {
        // change the element we sent it when we called the function
       document.getElementById( element ).innerHTML=xmlHttp.responseText;
         }
      }
     // this bit makes the request.
    xmlHttp.open("GET", location ,true);
    // we fill this in if we want to send anymore headers (like if we used Post and needed to send postVars :))
    xmlHttp.send(null);
  } 