comming soon
(function(){
/* ---------- QUESTIONS ----------
s = section: body, dig (digestive system), mind
w = weight: 3 = most important, 2 = important, 1 = supporting
v = Vata answer, p = Pitta answer, k = Kapha answer
*/
var Q = [
/* ---- BODY ---- */
{s:"body",w:3,q:"Gaining and losing weight", v:"I usually don't gain weight very easily.", p:"When I gain weight, I can easily lose it.", k:"I gain weight easily and lose it slowly."},
{s:"body",w:3,q:"Your body", v:"I was thin most of my life (before bearing children, etc.).", p:"I am generally muscular or athletic.", k:"I am heavy, full-bodied, or overweight."},
{s:"body",w:2,q:"Your frame", v:"I am very tall or very short, with a narrow frame.", p:"I am medium height with a medium frame.", k:"I have a broad, large, sturdy frame."},
{s:"body",w:2,q:"Your joints and bones", v:"My bones are thin and prominent, and my joints crack or pop.", p:"My bones are medium and my joints are flexible.", k:"My bones and joints are large, well padded, and sturdy."},
{s:"body",w:3,q:"Your body temperature", v:"I can get cold easily and prefer warm weather.", p:"I can get warm and even hot easily.", k:"My body is not clearly cold or warm by nature compared to other people."},
{s:"body",w:2,q:"How much you sweat", v:"I sweat very little, even when active.", p:"I sweat a lot and easily, often with a strong odor.", k:"I sweat a moderate amount, steady once I get going."},
{s:"body",w:2,q:"Foods and drinks you naturally prefer", v:"I prefer warm, moist, cooked foods and warm drinks.", p:"I prefer cool or cold foods and cold drinks.", k:"I prefer light, spicy, stimulating foods and warm drinks."},
{s:"body",w:3,q:"Your skin", v:"My skin tends to be dry.", p:"My skin tends to get red easily.", k:"My skin tends to be oily."},
{s:"body",w:3,q:"Your hair", v:"My hair tends to be dry, frizzy, or brittle.", p:"My hair is fine, and I tend toward early graying or thinning.", k:"My hair is thick, wavy, and oily or shiny."},
{s:"body",w:3,q:"Your sleep", v:"It can be difficult for me to get to sleep.", p:"I tend to get to sleep easily, but can wake up in the night.", k:"I tend to sleep deeply and often have difficulty getting up in the morning."},
{s:"body",w:2,q:"Your energy and stamina", v:"My energy comes in bursts, then I tire out quickly.", p:"My energy is moderate and driven, strongest when I'm focused on a goal.", k:"My energy is steady and strong, with great endurance."},
{s:"body",w:2,q:"How you move and act", v:"I am quick and restless, and it's hard for me to sit still.", p:"I am purposeful and intense, and I move with a goal.", k:"I am slow, steady, and relaxed."},
/* ---- DIGESTIVE SYSTEM ---- */
{s:"dig",w:3,q:"Your appetite", v:"My hunger level is variable and I can often forget to eat.", p:"I have a strong appetite and I don't like to miss meals.", k:"I like to eat, but I can go without eating or skip meals without discomfort."},
{s:"dig",w:2,q:"When you miss a meal", v:"If I miss a meal, I often get light-headed, anxious, or spacey.", p:"If I miss a meal, I often get irritable or even angry easily.", k:"If I miss a meal, it does not really bother me."},
{s:"dig",w:2,q:"How you like to eat", v:"I prefer to eat frequent meals with no set time.", p:"I prefer to eat 3 meals a day at the same time and don't usually skip meals.", k:"I do fine with 1 or 2 meals a day and can go without eating easily."},
{s:"dig",w:3,q:"What happens to you most easily from food", v:"I easily get gas or bloating from foods like beans, cabbage, broccoli, salads, wheat, or milk.", p:"I easily get acidity, heartburn, or GERD from foods like hot spices, garlic, citrus, vinegar, fried foods, or tomatoes.", k:"I easily feel heavy, sleepy, or congested from foods like milk, wheat, bread, cheese, yogurt, or oily foods."},
{s:"dig",w:3,q:"Your bowel movements", v:"I can easily be constipated.", p:"I tend to have 2 or more bowel movements per day.", k:"I generally have just 1 well-formed bowel movement per day."},
{s:"dig",w:2,q:"Your thirst", v:"My thirst changes from day to day.", p:"I have strong thirst and am often thirsty.", k:"I have low thirst and rarely feel very thirsty."},
/* ---- MIND ---- */
{s:"mind",w:3,q:"In stressful situations or under pressure", v:"I tend to get anxious, worried, or nervous.", p:"I tend to get irritable or angry.", k:"I remain calm most of the time."},
{s:"mind",w:3,q:"The emotions you tend toward", v:"Worry, fear, and nervousness.", p:"Frustration, impatience, and being critical.", k:"Sadness, attachment, and holding on to things."},
{s:"mind",w:2,q:"Your mind", v:"My mind is quick, creative, and always changing.", p:"My mind is sharp, focused, and analytical.", k:"My mind is calm, steady, and methodical."},
{s:"mind",w:2,q:"Your focus", v:"My focus jumps around and I get distracted easily.", p:"My focus is intense and I can get very absorbed in a task.", k:"My focus is slow to start, but once I'm on something I stay with it."},
{s:"mind",w:1,q:"Your memory", v:"I learn quickly and forget quickly.", p:"I learn well and remember clearly.", k:"I learn slowly, but I never forget."},
{s:"mind",w:1,q:"Making decisions", v:"I change my mind often and it's hard for me to decide.", p:"I am quick and decisive.", k:"I am slow and careful, and once I decide, I stick with it."},
{s:"mind",w:1,q:"Your daily routine", v:"My routine is irregular. Every day is different.", p:"I am organized and like a schedule.", k:"I like routine and don't like change."}
];
var SECTION_NAMES = {body:"Body", dig:"Digestive System", mind:"Mind"};
var NAMES = {v:"Vata", p:"Pitta", k:"Kapha"};
var COLORS = {v:"var(--hmd-vata)", p:"var(--hmd-pitta)", k:"var(--hmd-kapha)"};
/* Results text for each section */
var TEXT = {
body:{
v:"Your body is Vata by nature. Vata is made of air and space, with dry, light, cold, rough, and mobile qualities. You tend to be thin and light, with dry skin and hair, cold hands and feet, lighter sleep, and energy that comes in bursts.",
p:"Your body is Pitta by nature. Pitta is made of fire and water, with hot, sharp, light, and oily qualities. You tend to be medium and muscular, warm, with sensitive skin that reddens easily, strong energy, and drive.",
k:"Your body is Kapha by nature. Kapha is made of water and earth, with heavy, slow, cool, oily, and stable qualities. You tend to be solid and strong, with thick, oily skin and hair, deep sleep, and great endurance."
},
dig:{
v:"Your digestion is Vata type (variable digestion). The colon is Vata's main seat. Your appetite tends to be irregular, and you are prone to gas, bloating, dryness, and constipation.",
p:"Your digestion is Pitta type (sharp digestion). The small intestine is Pitta's main seat. You have a strong appetite and fast digestion, and you are prone to acidity, heartburn, and loose stools.",
k:"Your digestion is Kapha type (slow digestion). The stomach is one of Kapha's main seats. Your appetite is steady but low, and you are prone to heaviness, sleepiness after meals, mucus, and congestion."
},
mind:{
v:"Your mind is Vata type. You are quick, creative, and changeable. Under stress or pressure you tend toward anxiety, worry, fear, and an overactive mind.",
p:"Your mind is Pitta type. You are sharp, focused, and driven. Under stress or pressure you tend toward irritability, frustration, impatience, and anger.",
k:"Your mind is Kapha type. You are calm, steady, and loyal. Under stress you tend to stay calm, but you can become withdrawn, stuck, or hold on to things too long."
}
};
var answers = new Array(Q.length).fill(null);
var order = []; // shuffled answer order per question so people can't pattern-pick
var i = 0;
var app = document.getElementById("hmd-app");
var el = document.getElementById("hmd-screen");
function shuffle(a){for(var j=a.length-1;j>0;j--){var r=Math.floor(Math.random()*(j+1));var t=a[j];a[j]=a[r];a[r]=t;}return a;}
function esc(s){return String(s).replace(/[&"]/g,function(c){return{"&":"&","":">",'"':"""}[c];});}
/* Scroll up to the top of the quiz only if it is above the screen */
function toTop(){
var top = app.getBoundingClientRect().top;
if(top < 0){ window.scrollTo({top: window.pageYOffset + top - 100, behavior:"smooth"}); }
}
function intro(){
el.innerHTML =
'';
}).join("");
var product="";
if(key==="dig"){
product = (sc.top!==body.top)
? 'Your digestion is '+NAMES[sc.top]+' type, even though your body is '+NAMES[body.top]+' type. Choose your digestive products based on your '+NAMES[sc.top]+' digestion, not your body type.'
: 'Your digestion matches your body type. Choose your digestive products for '+NAMES[sc.top]+' digestion.';
}
if(key==="mind"){
product = (sc.top!==body.top)
? 'Your mind is '+NAMES[sc.top]+' type, even though your body is '+NAMES[body.top]+' type. Choose your products for the mind and emotions based on your '+NAMES[sc.top]+' mind, not your body type.'
: 'Your mind matches your body type. Choose your products for the mind and emotions for a '+NAMES[sc.top]+' mind.';
}
return '
Original Since Birth Body Type – Prakriti
'+ 'Your prakriti is your natural constitution, the balance of Vata, Pitta, and Kapha you were born with.
'+ 'Answer based on your whole adult life, not just recently. Think about your natural tendencies, not how you feel now. If you are unsure, go with what has been true for you the longest.
'+
'Pick the one answer that fits you best for each question. There are '+Q.length+' questions in three parts: Body, Digestive System, and Mind.
'+ ''; document.getElementById("hmd-start").onclick=function(){ order = Q.map(function(){return shuffle(["v","p","k"]);}); answers = new Array(Q.length).fill(null); i=0; question(); }; } function question(){ var item=Q[i], pct=Math.round(i/Q.length*100); var part=["body","dig","mind"].indexOf(item.s)+1; var opts=order[i].map(function(d){ return ''; }).join(""); el.innerHTML = ''+
'
Part '+part+' of 3: '+SECTION_NAMES[item.s]+'Question '+(i+1)+' of '+Q.length+'
'+
''+esc(item.q)+'
'+ ''+opts+'
'+
''+
''+
''+
'
';
var next=document.getElementById("hmd-next");
/* selecting an answer only highlights it — the page does not move */
Array.prototype.forEach.call(el.querySelectorAll(".hmd-opt"),function(b){
b.onclick=function(){
answers[i]=b.getAttribute("data-d");
Array.prototype.forEach.call(el.querySelectorAll(".hmd-opt"),function(o){o.classList.remove("hmd-sel");});
b.classList.add("hmd-sel");
next.disabled=false;
};
});
document.getElementById("hmd-back").onclick=function(){if(i>0){i--;question();toTop();}};
next.onclick=function(){
if(!answers[i])return;
if(i<Q.length-1){i++;question();}else{results();}
toTop();
};
}
function score(section){
var s={v:0,p:0,k:0}, total=0;
Q.forEach(function(item,n){ if(item.s===section){ s[answers[n]]+=item.w; total+=item.w; } });
var pct={v:Math.round(s.v/total*100),p:Math.round(s.p/total*100),k:Math.round(s.k/total*100)};
var r=["v","p","k"].sort(function(a,b){return s[b]-s[a];});
var name;
if(pct[r[0]]-pct[r[1]]<=10 && pct[r[1]]-pct[r[2]]<=10) name="Tridoshic (Vata-Pitta-Kapha)";
else if(pct[r[0]]-pct[r[1]]<=12) name=NAMES[r[0]]+"-"+NAMES[r[1]];
else name=NAMES[r[0]];
return {pct:pct, rank:r, name:name, top:r[0]};
}
function sectionHTML(key, title, sc, body){
var bars=["v","p","k"].map(function(d){
return ''+NAMES[d]+''+sc.pct[d]+'%
'+
''+
'
';
}
function results(){
var body=score("body"), dig=score("dig"), mind=score("mind");
el.innerHTML =
''+title+'
'+ ''+sc.name+'
'+
'Dominant: '+NAMES[sc.rank[0]]+' · Secondary: '+NAMES[sc.rank[1]]+'
'+
bars+
''+TEXT[key][sc.top]+'
'+ (product?''+product+'
':'')+
'Your Original Body Type – Prakriti
'+ ''+
'
'+
sectionHTML("body","1. Overall Body Constitution",body,body)+
sectionHTML("dig","2. Digestive System",dig,body)+
sectionHTML("mind","3. Mind and Emotions",mind,body)+
'';
document.getElementById("hmd-redo").onclick=function(){intro();toTop();};
}
intro();
})();
Body: '+body.name+'
'+
'Digestive System: '+dig.name+'
'+
'Mind: '+mind.name+'
'+
'