  function createXMLHttp() {
        if(typeof XMLHttpRequest != "undefined") { // для браузеров аля Mozilla

          return new XMLHttpRequest();
        } else if(window.ActiveXObject) { // для Internet Explorer (all versions)
          var aVersions = ["MSXML2.XMLHttp.5.0", "MSXML2.XMLHttp.4.0",
                   "MSXML2.XMLHttp.3.0", "MSXML2.XMLHttp",
                   "Microsoft.XMLHttp"
                   ];
          for (var i = 0; i < aVersions.length; i++) {
            try { //
              var oXmlHttp = new ActiveXObject(aVersions[i]);

              return oXmlHttp;
            } catch (oError) { 

            }
          }
          throw new Error("Невозможно создать объект XMLHttp.");
        }
      }
      
      function sendRequest() {
        var oForm = document.forms[0];
        var sBody = getRequestBody(oForm);
        var oXmlHttp = createXMLHttp();
        
        oXmlHttp.open("POST",oForm.action, true);
        oXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        
        oXmlHttp.onreadystatechange = function() {
          if(oXmlHttp.readyState == 4) {
            if(oXmlHttp.status == 200) {
              saveResult(oXmlHttp.responseText);
            } else {
              saveResult("Ошибка: " + oXmlHttp.statusText);
            }
          }
        };
        
        oXmlHttp.send(sBody);
      }

      function sendRequestUrl(oMode, oCode, oField, act) {
        var oXmlHttp = createXMLHttp();
        
        oXmlHttp.open("POST",act, true);
        oXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        
        oXmlHttp.onreadystatechange = function() {
          if(oXmlHttp.readyState == 4) {
            if(oXmlHttp.status == 200) {
             saveResult(oXmlHttp.responseText);
            } else {
              saveResult("Ошибка: " + oXmlHttp.statusText);
            }
          }
        };
        
        oXmlHttp.send("md="+oMode+"&id="+oCode+"&col="+document.getElementById(oField).value);
      }

      function saveResult(sText) {
        var sElem = document.getElementById("basketdivider");
        sElem.innerHTML = sText;
        alert("Товар добавлен в корзину");
      }

function utf8_to_cp1251 (aa)  {
    var bb = '', c = 0;
    for (var i = 0; i < aa.length; i++) {
        c = aa.charCodeAt(i);
        if (c > 127) {
            if (c > 1024) {
                if (c == 1025) {
                    c = 1016;
                } else if (c == 1105) {
                    c = 1032;
                }
                bb += String.fromCharCode(c - 848);
            }
        } else {
            bb += aa.charAt(i);
        }
    }
    return bb;
}
