document.write("");
function daysInMonth(month,year) {
return new Date(year, month, 0).getDate();
}
function generateDays() {
var currentyear = window.document.getElementById('DOBY').value;
var currentmonth = window.document.getElementById('DOBM').value;
var daysinthismonth = daysInMonth(currentmonth,currentyear);
var generateddays = "";
for (var i=1;i<=daysinthismonth;i++) {
generateddays += " ";
}
window.document.getElementById('DOBD').innerHTML = generateddays;
}
function estimateBodyFat(){
//gender coefficient (males = 1, females = 0)
//Adult Body Fat % = (1.20 x BMI) + (0.23 x Age) - (10.8 x gender) - 5.4
heightcm = window.document.getElementById('heightcm').value;
weightkg = window.document.getElementById('weightkg').value;
heightM = heightcm/100;
var BMI = weightkg/(heightM*heightM);
BMI = BMI.toFixed(2);
window.document.getElementById('BMI').innerHTML=BMI;
age = 30;
year = window.document.getElementById('DOBY').value;
month = window.document.getElementById('DOBM').value;
day = window.document.getElementById('DOBD').value;
var today=new Date();
var age=today.getFullYear()-year;
if(today.getMonth() < month || (today.getMonth()==month && today.getDate() < day)){age--;}
var bodyfatestimate = (1.2 * BMI) + (0.23 * age) - (10.8) - 5.4;
bodyfatestimate = bodyfatestimate.toFixed(0);
window.document.getElementById('bodyfatestimate').innerHTML=bodyfatestimate+"%";
}
function calculateBMR(){
var BMR = 0;
heightcm = window.document.getElementById('heightcm').value;
weightkg = window.document.getElementById('weightkg').value;
// gender = window.document.getElementById('gender').value;
age = 30;
year = window.document.getElementById('DOBY').value;
month = window.document.getElementById('DOBM').value;
day = window.document.getElementById('DOBD').value;
var today=new Date();
var age=today.getFullYear()-year;
if(today.getMonth() < month || (today.getMonth()==month && today.getDate() < day)){age--;}
//Mifflin - St Jeor Formula
//Men
//10 x weight (kg) + 6.25 x height (cm) - 5 x age (y) + 5
//Women
//10 x weight (kg) + 6.25 x height (cm) - 5 x age (y) - 161.
//if (gender=='Male'){
// BMR = 10 * weightkg + 6.25 * heightcm - 5 * age + 5;
//} else {
BMR = 10 * weightkg + 6.25 * heightcm - 5 * age - 161;
//}
exercise_multiplier = 1.2 //default to little
var radios = document.getElementsByName('dailyactivity');
for (var i = 0, length = radios.length; i < length; i++) {
if (radios[i].checked) {
dailyactivity = radios[i].value;
break;
}
}
if (dailyactivity==""){
exercise_multiplier = 1.2;
}
else if (dailyactivity=="lightactive"){
exercise_multiplier = 1.375;
}
else if (dailyactivity=="moderatelyactive"){
exercise_multiplier = 1.55;
}
else if (dailyactivity=="veryactive"){
exercise_multiplier = 1.725;
}
else if (dailyactivity=="extremelyactive"){
exercise_multiplier = 1.9;
}
TDEE = BMR * exercise_multiplier;
window.document.getElementById('TDEE').innerHTML=TDEE;
window.document.getElementById('BMR').innerHTML=BMR;
var targetcaloriesdisplay = TDEE-500;
window.document.getElementById('targetcaloriesdisplay').innerHTML=targetcaloriesdisplay;
var carbcals = 0;
var proteincals = 0;
var target_fat_cals = 0;
//carbsintake = targetcaloriesdisplay*0.1; //10%
carbsintake = targetcaloriesdisplay*0.075; //7.5%
//1 gram of carbohydrate is 4 calories
carbsintake = carbsintake/4;
carbsintake = carbsintake.toFixed(2);
if (carbsintake<20) carbsintake = 20;
if (carbsintake>45) carbsintake = 45;
window.document.getElementById('carbsintake').innerHTML=carbsintake+" grams";
carbcals = carbsintake;
//protein intake should be around should be around .6-.8g/ # of lean body mass - don't use ratios!
//proteintake = targetcaloriesdisplay*0.45; //45%
//proteintake = targetcaloriesdisplay*0.225; //22.5%
estimateBodyFat();
var BFE = window.document.getElementById('bodyfatestimate').innerHTML;
BFE = BFE.substr(0,BFE.length-1);
BFE = parseFloat(BFE);
bodyfatweight = weightkg*(BFE/100);
weightlbs = weightkg * 2.20462;
var leanbodymass_estimate = weightlbs-bodyfatweight;
//alert(leanbodymass_estimate);
proteintake = 0.8*leanbodymass_estimate;
proteintake = proteintake.toFixed(2);
//1 gram of protein is 4 calories
//proteintake = proteintake/4;
// proteintake = proteintake.toFixed(2);
window.document.getElementById('proteintake').innerHTML=proteintake+" grams";
proteincals = proteintake; //*4;
var nonfatcarbs = parseFloat(carbcals*4)+parseFloat(proteincals*4);
//alert(nonfatcarbs);
target_fat_cals = parseFloat(targetcaloriesdisplay) - parseFloat(nonfatcarbs);
//alert(target_fat_cals);
//fatintake = targetcaloriesdisplay*0.45; //45%
//fatintake = targetcaloriesdisplay*0.725; //72.5%
fatintake = target_fat_cals;
//1 gram of fat is 9 calories
fatintake = fatintake/9;
fatintake = fatintake.toFixed(2);
window.document.getElementById('fatintake').innerHTML=fatintake+" grams";
estimateBodyFat();
// document.getElementById('showresults').style.display='';
}
function recalcWeight(unittype){
//convert KG to lbs or vice versa
if (unittype=="KG"){
weightkg = window.document.getElementById('weightkg').value;
weightkg = parseInt(weightkg);
weightlbs = weightkg * 2.20462;
weightlbs = weightlbs.toFixed(2)
window.document.getElementById('weightlbs').value = weightlbs;
}
else if (unittype=="LBS"){
weightlbs = window.document.getElementById('weightlbs').value;
weightlbs = parseInt(weightlbs);
weightkg = weightlbs / 2.20462;
weightkg = weightkg.toFixed(2);
window.document.getElementById('weightkg').value = weightkg;
}
//2. update lbs input
calculateBMR();
}
function recalcHeight(unittype){
//convert feet/cm
if (unittype=="CM"){
heightcm = window.document.getElementById('heightcm').value;
heightcm = parseInt(heightcm);
heightinchestotal = heightcm * 0.393701;
heightfeet = heightinchestotal * 0.083;
heightinches = heightinchestotal-(heightfeet/0.083);
heightfeet = parseInt(heightfeet);
heightinches = heightinchestotal - (heightfeet*12);
heightinches = heightinches.toFixed(0);
if (heightinches<1) heightinches = 0;
if (heightinches==12){
heightinches = 0;
heightfeet = heightfeet +1;
}
window.document.getElementById('heightfeet').value = heightfeet;
window.document.getElementById('heightinches').value = heightinches;
}
else if (unittype=="FEET"){
heightinches = window.document.getElementById('heightinches').value;
heightfeet = window.document.getElementById('heightfeet').value;
heightfeet = parseInt(heightfeet);
heightinches = parseInt(heightinches);
totalinches = (heightfeet*12)+heightinches;
heightcm = totalinches * 2.54
heightcm = parseInt(heightcm);
window.document.getElementById('heightcm').value = heightcm;
}
//2. update lbs input
calculateBMR();
}
document.write("
If you have PCOS, losing weight can be a challenge. This Ketogenic PCOS diet calculator determines your optimal food intake so you can achieve your personal weight loss goals.
"); //document.write("Test 1
"); document.write(""); document.write(""); document.write("Healthy body fat percentages vary greatly depending on your age and body type.
"); document.write("Carbs: (?)
"); document.write("Fat: (?)"); document.write("
Protein: (?)"); //document.write("Recommended to have between 10% and 35% of proteins in your diet, so aiming for the middle at 22.5%
"); //document.write("22.5% of 1840 is 103.5 grams of protein"); //document.write("1 gram of fat is 9 calories, so you need 148 grams of fat per day."); document.write("In a ketogenic diet, one typically aims for 20 to 30g from carbs. (Although it can be as high as 50g)
"); document.write("Protein should be around 0.6 to 0.8g of lean body mass. An upper end all the way up to about 1.2g/# is acceptable depending on activity level
"); document.write("The rest of your calories come from fat.
"); document.write(""); document.write("A healthy and achievable weight loss goal is to lose 1/2 to 2 pounds (0.23 to 0.9kg) each week. We default to the middle of about 1 pound per week. Losing 1 pound (0.45kg) will mean reducing 500 calories a day.
"); document.write("Keep in mind that everybody has different needs, you'll also have to adjust your plan as you lose weight since your needs will change.
"); document.write("If you want to lose fat, a useful guideline for lowering your calorie intake is to reduce your calories by at least 500, but not more than 1000 below your maintenance level. For people with only a small amount of weight to lose, 1000 calories will be too much of a deficit.
"); document.write("Today's PCOS friendly recipe: Ketogenic Cinnamon Pancakes.
This calculator is powered by Fertility Chef in partnership with PCOSAA.
"); document.write("