function get_req()
{
   var xmlHttp;
   try
   {
      xmlHttp = new XMLHttpRequest();
   }
   catch(e)
   {
      var XmlHttpVersions = new Array("MSXML2.XMLHTTP.6.0",
      "MSXML2.XMLHTTP.5.0",
      "MSXML2.XMLHTTP.4.0",
      "MSXML2.XMLHTTP.3.0",
      "MSXML2.XMLHTTP",
      "Microsoft.XMLHTTP");
      for (var i = 0; i < XmlHttpVersions.length && ! xmlHttp;
      i ++ )
      {
         try
         {
            xmlHttp = new ActiveXObject(XmlHttpVersions[i]);
         }
         catch (e)
         {
         }
      }
   }
   if ( ! xmlHttp)
   alert("Error creating the XMLHttpRequest object.");
   else
   return xmlHttp;
}


function zakaz(id,title,price,ves){
xmlReq=get_req();
xmlReq.onreadystatechange = function()
{
   if(xmlReq.readyState == 4)
   {
   
		document.getElementById('zakaz_div_'+id).innerHTML="<span>Товар добавлен</span>";
        document.getElementById('cart_count').innerHTML=xmlReq.responseText;
   }
}

xmlReq.open('post', "ajax.php", true);
var content_type = 'application/x-www-form-urlencoded';             
xmlReq.setRequestHeader('Content-Type', content_type);
xmlReq.send("ajax_cart=1&id="+id+"&price="+price+"&title="+title+"&ves="+ves);

document.getElementById('zakaz_div_'+id).innerHTML="<img src=\"img/loading_line.gif\">";

}
