function Cart(){
	this.content = [];
	this.cartInfo = [];
	
	this.uniqueTotal = function(){
		return this.cartInfo.uniqueQuantity;
	}
	
	this.refresh = function(){
		
	}
	
	this.replaceContent = function(newcontent){
		this.content = newcontent.Cart;
		this.cartInfo = newcontent.Total;
		this.updateCartWidget();
	}
	
	this.updateCartWidget = function(){
		var total = this.uniqueTotal();
		if(total == 0){
			$('#cart-icon').removeClass('basket-icon-full').addClass('basket-icon-empty');
		}else{
			$('#cart-icon').removeClass('basket-icon-empty').addClass('basket-icon-full');
		}
		var selector = $('#cart-counter');
		selector.text('[' + total + ' ' + this.inflector(total) + ']');
	}
	
	this.prepareForDeletion = function(){
		$.each(this.content, function(index, value){
			if(value.selected == false){
				value.deleted = true;
			}
			
		});
	}
	
	this.inflector = function(number){
		if (String(number).match(/^([0-9]*[023456789])?1$/)) {
			return 'товар';
		} else if (String(number).match(/^([0-9]*[023456789])?[234]$/)) {
			return 'товара';
		} else {
			return 'товаров';
		}
	}
}
