function calculateContainers() {
var weightInput = document.getElementById('currentWeight').value;
var goal = document.getElementById('goalType').value;
var resultArea = document.getElementById('result-area');
// Validate Input
if (!weightInput || weightInput <= 0) {
alert("Please enter a valid weight in pounds.");
return;
}
var weight = parseFloat(weightInput);
// 1. Calculate Caloric Baseline
var baseline = weight * 11;
// 2. Calculate Maintenance Needs (Baseline + 400 for exercise burn)
var maintenance = baseline + 400;
// 3. Calculate Target
var target = 0;
if (goal === 'lose') {
target = maintenance – 750;
} else {
target = maintenance;
}
// Round logic: 21 Day Fix generally rounds to the nearest whole number, but ranges are fixed.
target = Math.round(target);
// Safety Floor: Generally the program doesn't recommend going below 1200
if (target < 1200) {
target = 1200;
}
// Define Plans based on Calorie Target
// Plan A: 1200-1499
// Plan B: 1500-1799
// Plan C: 1800-2099
// Plan D: 2100-2299
// Plan E: 2300-2499 (Extended)
// Plan F: 2500+ (Extended)
var plan = "";
var containers = {
green: 0,
purple: 0,
red: 0,
yellow: 0,
blue: 0,
orange: 0,
tsp: 0
};
if (target < 1500) {
plan = "Plan A";
containers = { green: 3, purple: 2, red: 4, yellow: 2, blue: 1, orange: 1, tsp: 2 };
} else if (target < 1800) {
plan = "Plan B";
containers = { green: 4, purple: 3, red: 4, yellow: 3, blue: 1, orange: 1, tsp: 4 };
} else if (target < 2100) {
plan = "Plan C";
containers = { green: 5, purple: 3, red: 5, yellow: 4, blue: 1, orange: 1, tsp: 5 };
} else if (target < 2300) {
plan = "Plan D";
containers = { green: 6, purple: 4, red: 6, yellow: 4, blue: 1, orange: 1, tsp: 6 };
} else if (target < 2500) {
// Extended Plan E logic often used in heavier starting weights
plan = "Plan E";
containers = { green: 7, purple: 5, red: 6, yellow: 5, blue: 1, orange: 1, tsp: 7 };
} else {
// Cap at Plan F equivalent or just show max
plan = "Plan F (or Higher)";
containers = { green: 8, purple: 5, red: 7, yellow: 5, blue: 1, orange: 1, tsp: 8 };
}
// Update DOM
document.getElementById('targetCalories').innerHTML = target;
document.getElementById('planName').innerHTML = plan;
document.getElementById('greenCount').innerHTML = containers.green;
document.getElementById('purpleCount').innerHTML = containers.purple;
document.getElementById('redCount').innerHTML = containers.red;
document.getElementById('yellowCount').innerHTML = containers.yellow;
document.getElementById('blueCount').innerHTML = containers.blue;
document.getElementById('orangeCount').innerHTML = containers.orange;
document.getElementById('tsCount').innerHTML = containers.tsp;
resultArea.style.display = "block";
}
Understanding Your 21 Day Fix Results
The 21 Day Fix is a nutrition program designed to take the guesswork out of weight loss. Instead of counting every single calorie, you count colored containers. Each container corresponds to a specific food group, and your daily allowance depends on your current weight and caloric needs.
How the Calculation Works
Our calculator follows the standard 21 Day Fix formula to determine your "Plan":
Baseline: We multiply your weight in pounds by 11.
Daily Burn: We add 400 calories to account for the daily workout associated with the program.
Deficit: If your goal is weight loss, we subtract 750 calories to create a safe caloric deficit.
Note: If your calculated target is below 1,200 calories, the calculator automatically rounds up to 1,200. Eating fewer than 1,200 calories a day is generally not recommended as it can slow down your metabolism and deprive your body of essential nutrients.
The Container System Explained
Once you know your plan (A, B, C, D, etc.), you are assigned a specific number of containers to eat per day. Here is what each color represents:
Green Container (Vegetables): Spinach, kale, broccoli, carrots, peppers. Ideally, cooked or raw veggies.
To get the most out of this program, try to spread your containers throughout the day. You don't have to eat them all at once! Many people find success by planning their meals the night before. Remember to drink plenty of water and stick to the workout schedule provided by the program.