function addToCart(id,qty,optionid)
{
  xmlHttp = createHTTPRequest();
  
  xmlHttp.onreadystatechange = function()
  {
    // xmlHttp.readyState
    // 0 The request is not initialized ,1 The request has been set up, 2 The request has been sent, 3 The request is in process, 4 The request is complete 
    if (xmlHttp.readyState == 4)
    {
      var totalqty = parseInt(xmlHttp.responseText);
      if (isNaN(totalqty) == true || totalqty < 0)
        totalqty = 0;
      
      var cartcount = document.getElementById('numInCart');
      
      cartcount.innerHTML = totalqty;
      
      ShowMessage('Item added successfully!');
    }
  }
  
  var params = "id=" + escape(id) + "&qty=" + escape(qty) + "&optionid=" + escape(optionid);
  
  xmlHttp.open("POST","/eitcommerce/general/addtocart.php",true);
  
  //Send the proper header information along with the request
  xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  xmlHttp.setRequestHeader("Content-length", params.length);
  xmlHttp.setRequestHeader("Connection", "close");

  xmlHttp.send(params);
}