var xmlhttp

function addToCart(product_id,proQty,oa_id)
{
	
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
//var url="public_ajax_popup_cart.php";
var url="index.php";
url=url+"?pid="+product_id;
url=url+"&oa_quantity="+proQty;
url=url+"&oa=AddItem";
//url=url+"&ua=";
//url=url+"&wl_action=";
url=url+"&oa_id="+oa_id;
//url=url+"&p_url=";
//index.php?pid=17&oa_quantity=2&oa=AddItem&ua=&wl_action=&oa_id=GRHD001&pid=17&p_url=http://122.166.23.38/dev3/tallgrassbeef/products/1_lb_Tallgrass_Ground_Beef-17-2.html

url=url+"&sid="+Math.random();
//alert(url);
//xmlhttp.onreadystatechange=stateChanged;
xmlhttp.onreadystatechange=function() 
{
    
	if (xmlhttp.readyState == 4)
	{
	 //var responseTextRes=parseInt(xmlhttp.responseText);
	 if(document.getElementById("cartItemsCount"))
	 {
	 document.getElementById("cartItemsCount").innerHTML =parseInt(document.getElementById("cartItemsCount").innerHTML)+parseInt(proQty);
	 }
	 
	 hideWindowNew();
	 return false;
	
	}
	
}

xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function stateChanged()
{
if (xmlhttp.readyState==4)
  {
	//alert(xmlhttp.responseText);
	//alert(document.getElementById("cartItemsCount").innerHTML);
	alert(proQty)
	
	hideWindowNew();
	 return false;
	  
	  
	  //return false;
  //document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
  }
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}