function updateCart(p_id,qtt) {
	var query='action=update&id='+p_id+'&quantity='+qtt;
	//if(enviroument.last_action!=query)
	$.ajax({
    	type: 'POST',
        url: './controllers/c_cart/action.php',
        data: query,
        beforeSend: function() {$("#preloader").css({"top":Math.floor($(window).height()/2-$('#preloader').height()/2), "left":Math.floor($(window).width()/2-$('#preloader').width()/2)}).show();},
        success: function(response){if(response != 'false') get_cart_properties();},
        complete: function() {$("#preloader").hide();enviroument.last_action=query}
    });
}
function updateCartInf(p_id,p_quantity,isrefresh) {
	var query='action=updateinf&id='+p_id+'&q='+p_quantity;
	//if(enviroument.last_action!=query)
	$.ajax({
    	type: 'POST',
        url: './controllers/c_cart/action.php',
        data: query,        
        success: function(response){if(response != 'false') get_cart_properties();if(isrefresh == 1)location.href=location.href;},        
		    		
        /*beforeSend: function() {$("#preloader").css({"top":Math.floor($(window).height()/2-$('#preloader').height()/2), "left":Math.floor($(window).width()/2-$('#preloader').width()/2)}).show();},
        success: function(response){if(response != 'false') get_cart_properties();},        
		  complete: function() {$("#preloader").hide();enviroument.last_action=query}*/
    });	
	
}

function get_cart_properties() {
	$.post("./controllers/c_cart/action.php",{action:"get_properties"},
		function(response) {
			if(response != "false") {
				var pos = new Array;
				var j=0;
				var temp='';
				for(var i=0;response.indexOf(':') != -1;i++) {
					pos[i]=response.substr(0,response.indexOf(':'));
					response=response.substr(response.indexOf(':')+1);
				}
				var quantity = pos[0];
				var sum = pos[1];
				var currency = pos[2];
				if($("#cartCount").text() != quantity) $("#cartCount").animate({opacity: "hide"},300,null,function(){$("#cartCount").text(quantity).animate({opacity: "show"}, 300).css("display", "inline");});
				if($("#cartSumm").text() != sum) $("#cartSumm").animate({opacity: "hide"}, 300,null,function(){$("#cartSumm").text(sum).animate({opacity: "show"}, 300).css("display","inline");});
				if($("#cartCurrency").text() != currency) $("#cartCurrency").animate({opacity: "hide"}, 300, null, function(){$("#cartCurrency").text(currency).animate({opacity: "show"}, 300).css("display","inline");});
			}
		}
	);
}