var cnt = 0;

function callAjax_del(ii) {
  new Ajax.Request(
    'kosar.php',
    {
    	method: 'get',
      parameters: 'kosar_del=1&id=' + ii,
      onComplete: ajaxReturn
    }
  );
}

function callAjax_add(ii) {
  new Ajax.Request(
    'kosar.php',
    {
    	method: 'get',
      parameters: 'kosar_add=1&id=' + ii,
      onComplete: ajaxReturn
    }
  );
}

function callAjax_fulldel() {
  new Ajax.Request(
    'kosar.php',
    {
    	method: 'get',
      parameters: 'kosar_fulldel=1',
      onComplete: ajaxReturn
    }
  );
}

window.onload = function() {	
	call();
};
function call() {
  new Ajax.Request(
    'kosar_csik.php',
    {
    	method: 'get',
      onComplete: ajaxReturn_csik
    }
  );
}
function ajaxReturn_csik(request) {
	this.div = $('cart_in');
	this.div.innerHTML = request.responseText;
	//this.div.innerHTML = JSON.parse(request.responseText)
}

function callAjax(ii) {
  new Ajax.Request(
    'kosar.php',
    {
    	method: 'get',
      parameters: 'kosar=1&id=' + ii,
      onComplete: ajaxReturn
    }
  );
  //call(); // kosár frissítésnél a kosár felső csíkját is frissíteni kell
}

function ajaxReturn(request) {
	cnt++;
	this.div = $('cart');
	this.div.innerHTML = request.responseText;
	if(cnt == 1) new Effect.toggle('cart'); // blind, appear, ,'blind', {duration: 0.5}
	call();
}

