function basket_aj()
{
  var oForm=document.fr_bas;
  var sBody=getRequestBody1(oForm);
  var oXmlHttp=zXmlHttp.createRequest();
  //var cnt;
  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)
      {
        var str=oXmlHttp.responseText;
        document.getElementById("main_td").innerHTML=str;
        //if (str=="В корзине нет ни одного товара")
      }
      else
        saveResult("Обнаружена ошибка "+oXmlHttp.statusText);
    }
  }
  oXmlHttp.send(sBody);
  var oXmlHttp1=zXmlHttp.createRequest();
  oXmlHttp1.open("post","/top_basket.php",true);
  oXmlHttp1.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
  oXmlHttp1.onreadystatechange = function ()
  {
    if (oXmlHttp1.readyState == 4)
    {
      if (oXmlHttp1.status==200)
        document.getElementById("top_basket").innerHTML=oXmlHttp1.responseText;
      else
        saveResult("Обнаружена ошибка "+oXmlHttp1.statusText);
    }
  }
  oXmlHttp1.send('bsk=1');
  return false;
}

function basket_sub(step)
{
  document.getElementById("but").value=step;
  document.fr_bas.onsubmit();
  if (step==2)
    document.getElementById("f_zak").innerHTML="";
  return false;
}

function getRequestBody1(oForm) // функция создает строку параметров для передачи post
{
  //alert("asdsa1");
  var aParams = new Array();
  for(var i=0;i<oForm.elements.length;i++)
  {
    if (oForm.elements[i].type=="checkbox")
      if (!oForm.elements[i].checked)
        continue;
    var sParam=encodeURIComponent(oForm.elements[i].name);
    sParam+="=";
    sParam+=encodeURIComponent(oForm.elements[i].value);
    aParams.push(sParam);
  }
  return aParams.join("&");
}
