function getXmlHttp() {
  var xmlhttp;
  try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
      xmlhttp = false;
    }
  }
 
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    xmlhttp = new XMLHttpRequest();
  }
  return xmlhttp;
}

function loading()
{

    var el2=document.getElementById('img_load');
    el2.style.visibility='visible';
}

function loading_end()
{

    var el2=document.getElementById('img_load');
    el2.style.visibility='hidden';
}

/////////////////////
///////////////////// Fade Effect
/////////////////////


function v_korziny(id,name,price,img,article) {

  var korzina = document.getElementById("korzina");
  korzina.style.display = 'block';

  var xmlHttp;
  xmlHttp = getXmlHttp();
 
  var httpParams = "v_korziny=1&id="+ id +"&name="+ name +"&price="+ price +"&img="+ img +"&article="+ article;
 
  xmlHttp.onreadystatechange = function()  {
    if (xmlHttp.readyState == 4)
    {
      var response = xmlHttp.responseText;
      if (response.substring(0,3) == "200")
      {
        korzina.innerHTML = "" + response.substring(3);
		  loading_end();
      }
      else
      {
		  loading_end();
      }
    }
  }
 
  xmlHttp.open('POST', 'ajax.php', true);
  xmlHttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded;');
  xmlHttp.setRequestHeader('Content-length', httpParams.length);
  xmlHttp.setRequestHeader('Connection','close');
  xmlHttp.send(httpParams);  
}

function clear_korzina() {

  var korzina = document.getElementById("korzina");
  korzina.style.display = 'block';
  korzina.innerHTML = "&nbsp";

  var xmlHttp;
  xmlHttp = getXmlHttp();
 
  var httpParams = "clear=1";
 
  xmlHttp.onreadystatechange = function()  {
    if (xmlHttp.readyState == 4)
    {
      var response = xmlHttp.responseText;
      if (response.substring(0,3) == "200")
      {
        korzina.innerHTML = "<div class=\"t\">закладок нету</div>";
		  loading_end();
      }
      else
      {
        korzina.innerHTML = "no data";
		  loading_end();
      }
    }
  }
 
  xmlHttp.open('POST', 'ajax.php', true);
  xmlHttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded;');
  xmlHttp.setRequestHeader('Content-length', httpParams.length);
  xmlHttp.setRequestHeader('Connection','close');
  xmlHttp.send(httpParams);  
}

function del_from(i) {

  var korzina = document.getElementById("korzina");
  korzina.style.display = 'block';
  korzina.innerHTML = "&nbsp";

  var xmlHttp;
  xmlHttp = getXmlHttp();
 
  var httpParams = "del_from="+i;
 
  xmlHttp.onreadystatechange = function()  {
    if (xmlHttp.readyState == 4)
    {
      var response = xmlHttp.responseText;
      if (response.substring(0,3) == "200")
      {
        korzina.innerHTML = "" + response.substring(3);
		  loading_end();
      }
      else
      {
		  loading_end();
      }
    }
  }
 
  xmlHttp.open('POST', 'ajax.php', true);
  xmlHttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded;');
  xmlHttp.setRequestHeader('Content-length', httpParams.length);
  xmlHttp.setRequestHeader('Connection','close');
  xmlHttp.send(httpParams);  
}

function tov(i) {

  var xmlHttp;
  xmlHttp = getXmlHttp();
 
  var httpParams = "tov="+ i;
 
  xmlHttp.onreadystatechange = function()  {
    if (xmlHttp.readyState == 4)
    {
      var response = xmlHttp.responseText;
      if (response.substring(0,3) == "200")
      {
        korzina.innerHTML = "" + response.substring(3);
		  loading_end();
      }
      else
      {
		  loading_end();
      }
    }
  }
 
  xmlHttp.open('POST', 'ajax.php', true);
  xmlHttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded;');
  xmlHttp.setRequestHeader('Content-length', httpParams.length);
  xmlHttp.setRequestHeader('Connection','close');
  xmlHttp.send(httpParams);  
}