	function addToCart(id, ver, what) {
		Cover(false, "PrintProgressBox('Trwa dodawanie produktu do koszyka...')");
		var myAjax = new Ajax.Request('web_services/cart.php',
		{
			method:'post',
			parameters: {ID: id, VERSION:ver, WHAT:what},
			encoding: 'ISO-8859-2',	
			onSuccess: function(transport){
				var response = transport.responseText || -7;
				if (catchError(response) === true) {
					$('cart_box').innerHTML = response;
					Cover(true, 'progress_box');
				}
			},
			onFailure: function(){
				catchError(-7);
			}
		});		
	}
	
	function loadSmallCart() {
		if ($('cart_box')){
			var myAjax = new Ajax.Request('web_services/cart.php',
			{
				method:'post',
				parameters: {show:1},
				encoding: 'ISO-8859-2',	
				asynchronous: true,		
				onSuccess: function(transport){
					var response = transport.responseText || -7;
					if (catchError(response) === true) {
						$('cart_box').innerHTML = response;
					}
				},
				onFailure: function(){
					catchError(-7);
				}
			});
		}
	}
	
	function loadLargeCart(){
		if ($('cart_list')) {
			var myAjax = new Ajax.Request('web_services/large_cart.php',
			{
				method:'post',
				parameters: {show:1},
				encoding: 'ISO-8859-2',	
				asynchronous: false,		
				onSuccess: function(transport){
					var response = transport.responseText || -7;
					if (catchError(response) === true) {
						$('cart_list').innerHTML = response;
					}
				},
				onFailure: function(){
					catchError(-7);
				}
			});
		}
	}
	
	function removeFromCart(index, what) {
		Cover(false, "PrintProgressBox('Trwa usuwanie produktu z koszyka...')");
		var myAjax = new Ajax.Request('web_services/cart.php',
		{
			method:'post',
			parameters: {remove:index, what:what},
			encoding: 'ISO-8859-2',
			onSuccess: function(transport){
				var response = transport.responseText || -7;
				if (catchError(response) === true) {
					$('cart_box').innerHTML = response;
					loadLargeCart();
					Cover(true, 'progress_box');
				}
			},
			onFailure: function(){
				catchError(-7);
			}
		});		
	}

	function order() {
		Cover(false, "PrintProgressBox('Trwa realizowanie zamówienia...', true)");
		var myAjax = new Ajax.Request('web_services/order.php',
		{
			method:'post',
			encoding: 'ISO-8859-2',	
			asynchronous: true,		
			onSuccess: function(transport){
				var response = transport.responseText || -7;
				if (catchError(response) === true) {					
					var obj = eval(response);
					if (obj.forfree == "1") {
						document.location="index.php?page=order&ps=1&oid="+obj.id;
					} else {
						$('session_id').value = obj.md5;
						$('order_id').value = obj.id;
						$('amount').value = obj.amount;
						$('amount_netto').value = obj.amount_netto;
						$('desc').value = obj.title;
						$('payform').submit();
					}
				}
			},
			onFailure: function(){
				catchError(-7);
			}
		});				
	}
	
	function checkPaymentType() {
		if ($('pay_type').value == 'sms') {
			$('pos_id').value = "86388";
			$('pos_auth_key').value = "66fHE8H";
			$('payform').action = "https://www.platnosci.pl/paygw/ISO/NewSMS";
			//https://www.platnosci.pl/paygw/ISO/NewSMS
			$('lang').style.display = 'none';
			return;
		}
		
		if ($('pay_type').value == 'c') {
			$('lang').style.display = '';
		} else {
			$('lang').style.display = 'none';
		}
		
		$('pos_id').value = "5079";
		$('pos_auth_key').value = "80be33c";
		$('payform').action = "https://www.platnosci.pl/paygw/ISO/NewPayment";
		//https://www.platnosci.pl/paygw/ISO/NewPayment
	}
