  
  var init = new Array();
  var __cartPOSTu = '?process/cart';
  
  init['URL_MAKER'] = function(){ return __cartPOSTu; };
  init['ON_SUCCESS'] = function(XmlHttp){
     var __t = XmlHttp.responseText.split('#&*$');
     switch(__t[0]){ //action
        case 'CARTOVERVIEW':
          document.getElementById('_cartOverview').innerHTML = __t[1];
        	break;
        default:
     		  alert(XmlHttp.responseText);
     			break;
     }
  }
  
	var __cartAjax = new rageAjax('__Cart', init);
	
	function __cartAddItem(pid, n){
	   var elem = null;
		 if(pid && n){
			 __cartAjax.postParams = 'action=ADD_ITEMS'
		    														+'&pid='+pid
                                    +'&n='+n;
		   __cartAjax.process();
		   if(elem = document.getElementById('cart_product_n_'+pid)){
		     elem.value = new Number(elem.value) + n;
		     document.getElementById('cart_product_total_cost_'+pid).innerHTML = new Number(elem.value * new Number(document.getElementById('cart_product_item_cost_'+pid).innerHTML)).toFixed(2) + ' zł.';
     		 if(new Number(elem.value) == 0){
		       document.getElementById('cart_product_reduce_'+pid).style.display = 'none';
		     }else{
		       document.getElementById('cart_product_reduce_'+pid).style.display = 'block';
	       }
	     }
	   }
	}
	
	function __cartRemItem(pid, n){
	   var elem = null; var newVal = null;
		 if(pid && n){
			 __cartAjax.postParams = 'action=REMOVE_ITEMS'
		    														+'&pid='+pid
                                    +'&n='+n;
		   __cartAjax.process();
		   if(elem = document.getElementById('cart_product_n_'+pid)){
         newVal = new Number(elem.value) - n;
         if(newVal < 0) newVal = 0;
         elem.value = newVal;
         document.getElementById('cart_product_total_cost_'+pid).innerHTML = new Number(elem.value * new Number(document.getElementById('cart_product_item_cost_'+pid).innerHTML)).toFixed(2) + ' zł.';
         if(new Number(elem.value) == 0){
		       document.getElementById('cart_product_reduce_'+pid).style.display = 'none';
		     }else{
		       document.getElementById('cart_product_reduce_'+pid).style.display = 'block';
	       }
	     }
	   }
	}
	
	function __cartSetItem(pid, n){
	   var elem = null; var newVal = null;
		 if(pid && n){
			 __cartAjax.postParams = 'action=SET_ITEMS'
		    														+'&pid='+pid
                                    +'&n='+n;
		   __cartAjax.process();
		   if(elem = document.getElementById('cart_product_n_'+pid)){
		     if(n >= 0){
           elem.value = n;
           document.getElementById('cart_product_total_cost_'+pid).innerHTML = new Number(elem.value * new Number(document.getElementById('cart_product_item_cost_'+pid).innerHTML)).toFixed(2) + ' zł.';
           if(new Number(elem.value) == 0){
		         document.getElementById('cart_product_reduce_'+pid).style.display = 'none';
    	     }else{
    	       document.getElementById('cart_product_reduce_'+pid).style.display = 'block';
           }
         }
	     }
	   }
	}
	
  function gotoPlaceOrderForm(){
    location.href = '?shop,order';
  }
  
  function orderDisplayForm(f){
    var forms = new Array('fPerson','fFirm');
    for(i in forms){
      //alert(forms[i]);
      var elem = document.getElementById(forms[i]);
      if(forms[i] == f){
        elem.style.display = 'block';
      }else{
        elem.style.display = 'none';
      }
    }
  }

	




