if (pain == "Medium") { if (bodyweight >= 241) { document.getElementById("dosage").innerHTML = "You should consume 30 mg of CBD."; var dosage = 30; } else if (bodyweight >= 151) { document.getElementById("dosage").innerHTML = "You should consume 22.5 mg of CBD."; var dosage = 22.5; } else if (bodyweight >= 86) { document.getElementById("dosage").innerHTML = "You should consume 15 mg of CBD."; var dosage = 15; } else if (bodyweight >= 46) { document.getElementById("dosage").innerHTML = "You should consume 12 mg of CBD."; var dosage = 12; } else if (bodyweight >= 26) { document.getElementById("dosage").innerHTML = "You should consume 9 mg of CBD."; var dosage = 9; } else { document.getElementById("dosage").innerHTML = "You should consume 6 mg of CBD."; var dosage = 6; } }
if (pain == "Severe") { if (bodyweight >= 241) { document.getElementById("dosage").innerHTML = "You should consume 45 mg of CBD."; var dosage = 45; } else if (bodyweight >= 151) { document.getElementById("dosage").innerHTML = "You should consume 27 mg of CBD."; var dosage = 27; } else if (bodyweight >= 86) { document.getElementById("dosage").innerHTML = "You should consume 18 mg of CBD."; var dosage = 18; } else if (bodyweight >= 46) { document.getElementById("dosage").innerHTML = "You should consume 15 mg of CBD."; var dosage = 15; } else if (bodyweight >= 26) { document.getElementById("dosage").innerHTML = "You should consume 12 mg of CBD."; var dosage = 12; } else { document.getElementById("dosage").innerHTML = "You should consume 9 mg of CBD."; var dosage = 9; } }
if(concentrationNumber > 0){ //run step 2 if(conctype == "milligrams"){ if(concmethod == "pills"){ var pillAmount = (dosage/concentrationNumber); console.log(pillAmount); var output = "That means you should consume "+ pillAmount.toString() + " pills."; console.log(output); document.getElementById("dosageAmount").innerHTML = output; } else if(concmethod== "drops"){ var tinctureVolume = document.getElementById("oilDropVolume").value; console.log("tincture volume:", tinctureVolume); var amountPerMl = (concentrationNumber/tinctureVolume); console.log("amount per drop: ", amountPerMl); var amountPerDrop = (amountPerMl/20); var dropAmount = (dosage/amountPerDrop); console.log("drop amount ",dropAmount); var output = "That means you should consume"+ (Math.round(dropAmount)).toString() + " drops."; console.log(output); document.getElementById("dosageAmount").innerHTML = output; } } else if(conctype == "percentage"){ if(concmethod == "drops"){ var tinctureVolume = (document.getElementById("oilDropVolume").value); console.log("tincture volume:", tinctureVolume); var amountOfDropsInTincture = tinctureVolume*20; console.log("amountOfDropsInTincture:", amountOfDropsInTincture); var amountOfCBDinMg = ((tinctureVolume*1000)*(concentrationNumber/100)); console.log("amount of cbd in tincture in mg:", amountOfCBDinMg); var CBDperDrop = (amountOfCBDinMg/amountOfDropsInTincture); console.log("CBD per drop:", CBDperDrop); var dropAmount = dosage/ CBDperDrop; console.log("drop amount", dropAmount); var output = "That means you should consume: "+ (Math.round(dropAmount)).toString() + " drops."; console.log(output); document.getElementById("dosageAmount").innerHTML = output; } else if(concmethod == "pills"){ document.getElementById("dosageAmount").innerHTML = "Sorry Pills. + Percentage not supported yet. use milligrams + pills instead."; } } }
}