var NutritionVO = new Class({
	initialize: function(item) {
		this.carbs = new Object();
		this.fat = new Object();
				
		this.energy = 0;
		this.protein = 0;
		this.carbs.total = 0;
		this.carbs.sugars = 0;
		this.fat.total = 0;
		this.fat.sat = 0;
		this.fibre = 0;
		this.salt = 0;
		
		if (item) { this.increaseBy(item);}
	},
	
	increaseBy: function(item) {
		this.energy 		+= (item.calories);
		this.protein		+= (item.protein);
		this.carbs.total	+= (item.carbs);
		this.carbs.sugars 	+= (item.sugar);
		this.fat.total 		+= (item.fat);
		this.fat.sat 		+= (item.satfat);
		this.fibre 			+= (item.fibre);
		this.salt 			+= (item.salt);
	},
	
	decreaseBy: function(item) {
		this.energy 		-= (item.calories);
		this.protein		-= (item.protein);
		this.carbs.total	-= (item.carbs);
		this.carbs.sugars 	-= (item.sugar);
		this.fat.total 		-= (item.fat);
		this.fat.sat 		-= (item.satfat);
		this.fibre 			-= (item.fibre);
		this.salt 			= (this.salt).toPrecision(4) - (item.salt).toPrecision(4);
	},
	
	calculateGDAWith: function(options) {
		if (!options.item) { options.item = this; }
		this.energy 		= (options.item.energy		 / options.scale.energy		   * 100).toPrecision(4);
		this.protein 		= (options.item.protein		 / options.scale.protein       * 100).toPrecision(4);
		this.carbs.total 	= (options.item.carbs.total	 / options.scale.carbs.total   * 100).toPrecision(4);
		this.carbs.sugars 	= (options.item.carbs.sugars / options.scale.carbs.sugars  * 100).toPrecision(4);
		this.fat.total 		= (options.item.fat.total	 / options.scale.fat.total     * 100).toPrecision(4);
		this.fat.sat 		= (options.item.fat.sat		 / options.scale.fat.sat       * 100).toPrecision(4);
		this.fibre 			= (options.item.fibre		 / options.scale.fibre         * 100).toPrecision(4);
		this.salt 			= (options.item.salt		 / options.scale.salt          * 100).toPrecision(4);
	}
});