function GetXmlHttpObject()
{
    var xmlHttp=null;
    try
      {
      // Firefox, Opera 8.0+, Safari
        xmlHttp=new XMLHttpRequest();
      }
    catch (e)
      {
      // Internet Explorer
      try
        {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
      catch (e)
        {
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      }
    return xmlHttp;
}

function getReadyStateHandler(req) {

  // Return an anonymous function that listens to the 
  // XMLHttpRequest instance
  return function () {

    // If the request's status is "complete"
    if (req.readyState == 4) {
      
      // Check that a successful server response was received
      if (req.status == 200) {

        // Pass the XML payload of the response to the 
        // handler function
        //responseXmlHandler(req.responseXML);
        

      } else {

        // An HTTP problem has occurred
        alert("HTTP error: "+req.status);
      }
    }
  }
}

function addClick(bannerNumber){
      // Obtain an XMLHttpRequest instance
      var req = GetXmlHttpObject();

      // Set the handler function to receive callback notifications
      // from the request object
      var handlerFunction = getReadyStateHandler(req);
      req.onreadystatechange = handlerFunction;

      // Open an HTTP POST connection to the shopping cart servlet.
      // Third parameter specifies request is asynchronous.
      req.open("POST", "/inc/banners.jsp", true);

      // Specify that the body of the request contains form data
      req.setRequestHeader("Content-Type", 
                           "application/x-www-form-urlencoded");

      // Send form encoded data stating that I want to add the 
      // specified item to the cart.
      req.send("action=add&bannerId="+bannerNumber);
}