function getAjax(){
  if (window.ActiveXObject) { // для IE 
     return new ActiveXObject("Microsoft.XMLHTTP");
  } else if (window.XMLHttpRequest){
     return new XMLHttpRequest();
  } else {
     alert("Browser does not support AJAX.");
     return null;
    }
}
function loadcards(cid){
  document.getElementById('cards').style.display="block";
  document.getElementById('wrapper').style.filter="alpha(opacity=50)";
  document.getElementById('wrapper').style.opacity="0.5";
    ajax=getAjax();
	if(document.getElementById("orders_"+cid)){
		if (document.getElementById("orders_"+cid).value<1){document.getElementById("orders_"+cid).value=1;}
		var sada = document.getElementById("orders_"+cid).value;
	}else{
		var sada = 1;
	}
      if (ajax != null) {    
        ajax.open("GET", "include/shop.php?cid="+cid+"&colvo="+sada,true);
        ajax.send(null);
        ajax.onreadystatechange = function(){
          if (ajax.readyState == 4){
            if (ajax.status == 200){
                show_ajax('count_price','price');
                var dataval=explode('|', ajax.responseText); 
            //   document.getElementById('count_price').innerHTML=dataval[0];
                document.getElementById('count_item').innerHTML=dataval[1];
             //   show_ajax1('count_item','count');
            }
          }
        }
      }
  setTimeout("niloop()", 3000);
}

function niloop(){

  document.getElementById('cards').style.display="none";
  document.getElementById('wrapper').style.filter="100";
  document.getElementById('wrapper').style.opacity="100";
}

function show_ajax(IDC,ACT){
  aja=getAjax();
    if (aja != null) {    
    aja.open("GET", "include/shop.php?action="+ACT,true);
    aja.send(null);
    aja.onreadystatechange = function(){
          if (aja.readyState == 4){
            if (aja.status == 200){
        document.getElementById(IDC).innerHTML=aja.responseText;
      }
          }
    }
  }
}
function show_ajax1(IDC,ACT){
  atload=getAjax();
    if (atload != null) {    
    atload.open("GET", "include/shop.php?action=count",true);
    atload.send(null);
    atload.onreadystatechange = function(){
      document.getElementById('count_item').innerHTML=atload.responseText;
    }
  }
}


function explode( delimiter, string ) { 
  var emptyArray = { 0: '' };
  if ( arguments.length != 2 || typeof arguments[0] == 'undefined' || typeof arguments[1] == 'undefined' ){ return null; }
  if ( delimiter === '' || delimiter === false || delimiter === null ){ return false; }
  if ( typeof delimiter == 'function' || typeof delimiter == 'object' || typeof string == 'function' || typeof string == 'object' ){ return emptyArray; }
  if ( delimiter === true ) { delimiter = '1'; }
  return string.toString().split ( delimiter.toString() );
}
function fatherloadcards(cid){
	loadcards(cid);
	setTimeout('location.replace("http://www.yborkasnega.ru/bag.html")', 1000);

	
}