  /*################################################################
  #
  #         Ajax MySQL shoutbox for btit
  #         Version 1.0
  #         Author: miskotes
  #         Created: 11/07/2007
  #         Contact: miskotes [at] yahoo.co.uk
  #         Website: http://www.yu-corner.com
  #         Credits: linuxuser.at, plasticshore.com
  #
  ################################################################*/


var mainUrl = "online/mail.php";
var httpReceiveMain = createRequestObjectMain();

 receiveMain();

function receiveMain() {
    if (httpReceiveMain.readyState == 4 || httpReceiveMain.readyState == 0) {
    httpReceiveMain.open("GET",mainUrl, true);
     httpReceiveMain.onreadystatechange = handlehHttpReceiveMain; 
    httpReceiveMain.send(null);
    }
}

//deals with the servers' reply to requesting new content
function handlehHttpReceiveMain() {

  if (httpReceiveMain.readyState == 4) {

     var resultsMain = document.getElementById("mainusertoolbar");
     resultsMain.innerHTML = httpReceiveMain.responseText;

    setTimeout('receiveMain(mainUrl);',43000); //executes the next data query in 4 seconds

  }
}

//initiates the XMLHttpRequest object
//as found here: http://www.webpasties.com/xmlHttpRequest
function createRequestObjectMain() {
   var req;
   if(window.XMLHttpRequest){
      // Firefox, Safari, Opera...
      req = new XMLHttpRequest();
   } else if(window.ActiveXObject) {
      // Internet Explorer 5+
      req = new ActiveXObject("Microsoft.XMLHTTP");
   } else {
      // There is an error creating the object,
      // just as an old browser is being used.
      alert('Problem creating the XMLHttpRequest object');
   }
   return req;

}


