﻿var answers = new Array();
var titles = new Array();
var questions = new Array();
var today = new Date(); today = today.getDay();
var lcv;

answers.push(
  'Yes',
  'No'
);

for (lcv = 0; lcv < 7; lcv++) {
  questions[lcv] = new Array();
}

// Sunday
titles[0] = 'How Good is Your Gut-Brain-Fat Cell Communication?';
questions[0].push(
  'Have I gained weight around my belly?',
  'Do I crave sugar or carbohydrates?',
  'Do I feel tired after eating a meal?',
  'Do I eat less than 5 servings of fruits and vegetables a day?',
  'Do I eat less than 30 grams of fiber a day (the average American diet has about 8 grams) from beans, nuts, seeds, vegetables, and fruit?',
  'Do I skip breakfast?',
  'Do I eat within 3 hours of going to bed?',
  'Do I sleep less than 8 hours a night?',
  'Do I combine protein, fat and carbohydrates at every meal?',
  'Do I eat high fructose corn syrup (found in all processed foods and drinks)?',
  'Do I eat less than 3 times a day?',
  'Do I feel stressed on a regular basis?'
);
// Monday 
titles[1] = 'How is the Stress Response Affecting You?';
questions[1].push(
  'Do you have low blood pressure?',
  'Do you get dizzy when you stand up?',
  'Have you been diagnosed with hypoglycemia?',
  'Do you have cravings for salt or sweets?',
  'Do you have dark circles under your eyes?',
  'Do you have trouble falling asleep and/or staying asleep?',
  'Do you feel groggy and not refreshed when you wake up?',
  'Do you experience mental fogginess or trouble concentrating?',
  'Do you get headaches?',
  'Do you get frequent infections (catching cold easily)?',
  'Do you tire easily with any exercise or feel very fatigued after exercise?',
  'Do you often feel stressed?',
  'Are you simultaneously tired and wired?',
  'Do you have water retention?',
  'Do you have panic attacks or startle easily?',
  'Do you experience heart palpitations?',
  'Do you need to start the day with caffeine?',
  'Do you have poor tolerance for alcohol, caffeine, and other drugs?',
  'Do you often feel weak and/or shaky?',
  'Do you get sweaty palms and feet when you’re nervous?',
  'Do you often experience fatigue?',
  'Do you often experience weak muscles?'
);
// Tuesday
titles[2] = 'How Inflamed are You?';
questions[2].push(
  'Do you have seasonal or environmental allergies?',
  'Do you have food allergies or do you feel poorly after eating (sluggishness, headaches congestion, confusion)?',
  'Do you work in an environment with poor lighting, chemicals, and poor ventilation?',
  'Are you exposed to pesticides, toxic chemicals, loud noise, heavy metals, and toxic bosses and co-workers?',
  'Do you get frequent colds and infections?',
  'Do you have a history of chronic infections such as hepatitis, skin infections, canker sores, and cold sores?',
  'Do you have sinusitis and allergies?',
  'Do you have bronchitis or asthma?',
  'Do you have dermatitis (eczema, acne, rashes)?',
  'Do you suffer from arthritis (osteoarthritis/degenerative wear and tear)?',
  'Do you have an autoimmune disease (rheumatoid arthritis, lupus)?',
  'Do you have colitis or inflammatory bowel disease?',
  'Do you have irritable Bowel Syndrome (spastic colon)?',
  'Do you have problems such as ADHD, Autism, mood and behavior problems (actually part of a family of problems called neuritis)?',
  'Do you have heart disease or have you had a heart attack?',
  'Do you have diabetes or are you overweight (BMI greater than 25)?',
  'Do you have Parkinson’s or have a family history of Parkinson’s or Alzheimer’s disease? ',
  'Do you have a significant amount of stress in your life?',
  'Do you drink more than 3 glasses of alcohol a week?',
  'Do you exercise less than 30 minutes 3 times a week?'
);
// Wednesday
titles[3] = 'Are you Rusting?';
questions[3].push(
  'Are you fatigued on a regular basis?',
  'Do you find yourself sensitive to perfume, smoke or other chemicals or fumes?',
  'Do you regularly experience deep muscle or joint pain?',
  'Are you exposed to a significant level of environmental pollutants or chemicals at home or at work?',
  'Do you use tobacco products?',
  'Are you exposed to second hand smoke?',
  'Do you drink more than 3 alcoholic beverages a week?',
  'Are you exposed to sunlight or ultraviolet light (tanning booths) more than 1 hour a week?',
  'Do you exercise less than ½ an hour 3 times a week?',
  'Do you take prescription, over the counter and/or recreational drugs?',
  'Would you describe your daily stress level as high?',
  'Do you eat fried foods, margarine, or high-fat foods?',  
  'Do you eat less than 5-9 servings (1/2 cup) of deeply colored vegetables and fruits a day?'  
);
// Thursday
titles[4] = 'How Powerful is Your Metabolic Engine?';
questions[4].push(
  'Do you experience chronic or prolonged fatigue?',
  'Do you have muscle-aching pain or discomfort?',
  'Do you have trouble falling asleep, staying asleep, or waking up early?',
  'Do you experience muscle weakness?',
  'Do you wake up tired, despite a normal amount of sleep?',
  'Do you have poor exercise tolerance with severe fatigue afterward?',
  'Do you have trouble concentrating or memory problems?',
  'Are you often irritable and/or moody?',
  'Does fatigue prevent you from doing things you would like to do?',
  'Does fatigue interfere with your work, family or social life?',
  'Have you been under prolonged stress?',
  'Did your symptoms of fatigue start after a severe stress of some sort, infection or trauma?',
  'Have you been diagnosed with chronic fatigue syndrome or fibromyalgia?',
  'Do you have a history of chronic infections?',
  'Do you frequently overeat?',
  'Are you frequently exposed to environmental chemicals (pesticides, unfiltered water, food that is not organic)?',
  'Have you been diagnosed with Gulf war syndrome?',
  'Have you been diagnosed with neurologic diseases such as Alzheimer’s, Parkinson’s, or ALS?'
);
// Friday
titles[5] = 'Are Thyroid Problems Contributing to Your Struggle with Weight?';
questions[5].push(
  'Are your skin and fingernails thick?',
  'Do you have dry skin?',
  'Do you have a hoarse voice?',
  'Do you have thinning hair, hair loss, or coarse hair?',
  'Are you sensitive to cold?',
  'Do you have colds hands and feet?',
  'Is your basal body temperature is < 97.8 first thing in the morning (underarm basal body thermometers are available at most drug stores)?',
  'Do you have muscle fatigue, pain or weakness?',
  'Do you have heavy menstrual bleeding, worsening of premenstrual syndrome, other menstrual problems, and/or infertility?',
  'Have you experienced a loss of sex drive (decreased libido)?',
  'Do you have severe menopausal symptoms (such as hot flashes and mood swings)?',
  'Have you experienced fluid retention (swelling of hands and feet)?',
  'Do you experience fatigue?',
  'Do you have low blood pressure and heart rate?',
  'Do you have elevated cholesterol?',
  'Do you have trouble with memory and concentration or brain fog?',
  'Do you wake up tired and have trouble getting out of bed in the morning?',
  'Do you have a loss of or thinning of the outer third of your eyebrow?',
  'Do you have trouble losing weight or have you experienced recent weight gain?',
  'Do you experience depression and apathy or anxiety?',
  'Do you experience constipation?',
  'Have you been diagnosed with autoimmune disease (e.g. celiac disease, rheumatoid arthritis, multiple sclerosis, lupus, allergies, yeast overgrowth –all of which can affect thyroid function)?',
  'Are you or have you been exposed to radiation treatments?',
  'Are you or have you been exposed to environmental toxins?',
  'Do you have a family history of thyroid problems?',
  'Do you drink chlorinated or fluoridated water?'
);
// Saturday
titles[6] = 'How Is Your Detox System Working?';
questions[6].push(
  'Are you constipated and only go to the bathroom every other day or less often?',
  'Do you urinate small amounts of dark, strong smelling urine only a few times a day?',
  'Do you rarely break into a real sweat?',
  'Do you have one or more of the following symptoms: fatigue, muscle aches, headaches, concentration or memory problems?',
  'Do you have Fibromyalgia or Chronic Fatigue Syndrome?',
  'Do you drink tap or well water?',
  'Do you dry clean your clothes?',
  'Do you work or live in a &quot;tight&quot; building with poor ventilation or windows that don’t open?',
  'Do you live in a large urban or industrial area?',
  'Do you use household or lawn garden chemicals or get your house or apartment treated for bugs by an exterminator?',
  'Do you have more than 1-2 mercury amalgams (silver fillings)?',
  'Do you eat large fish (swordfish, tuna, shark, tilefish) more than once a week?',
  'Are you bothered by one or more of the following: gasoline or diesel fumes, perfumes, new car smells, fabric stores, dry cleaning, hair spray or other strong odors, soaps, detergents, tobacco smoke, or chlorinated water?',
  'Do you have a negative reaction when you consume foods containing garlic or onions, MSG, sulfites (wine, salad bars, dried fruit), sodium benzoate (a preservative), red wine, cheese, bananas, chocolate, or even a small amount of alcohol?',
  'When you drink coffee or other substances containing caffeine do you feel wired, have increased aches in muscles and joints, or have hypoglycemic symptoms (anxiety, palpitations, sweating, and dizziness)?',
  'Do you regularly consume any of the following substances or medications: acetaminophen (Tylenol), acid blocking drugs (Tagamet, Zantac, Pepcid, Prilosec, Prevacid), hormone modulating medications in pills, patches or creams (the birth control pill, estrogen, progesterone, prostate medication), ibuprofen or naproxen, medications for colitis or Crohn\'s disease, medications for recurrent headaches, allergy symptoms, nausea, diarrhea or indigestion?',
  'Have you had jaundice (turning yellow) or have you been told you have Gilbert’s syndrome (an elevation of a liver test for bilirubin)?',
  'Do you have a history of any of the following conditions: breast cancer, smoking induced lung cancer or other types of cancer, prostate problems, food allergies, sensitivities or intolerances?',
  'Do you have a family history of Parkinson’s, Alzheimer’s, ALS (amyotrophic lateral sclerosis) or other motor neuron diseases, or multiple sclerosis?'
);

function quiz(offset, descending) {
  var q;
  var a;
  var ret;

  ret = '<h2>' + titles[today] + '</h2><br>';
  ret += '<table border="0" cellpadding="5" cellspacing="0"><form name="quiz">';
  lcv = 0;
  for (q = 0; q < questions[today].length; q++) {
    ret += '<tr>'
         + '<td align="left" valign="top" class="fbxLeftTxt"><b>' + (q + 1) + ')</b>&nbsp;' + '</td>'
         + '<td align="left" valign="top" class="fbxLeftTxt">' + questions[today][q] + '</td>'
         + '<td valign="bottom" align="left" class="fbxLeftTxt"><nobr>';

    for (a = 0; a < answers.length; a++) {
      ret += '<input class="quiz" name="question' + (q + 1) + '" type="radio" value="';
      if (descending) {
        ret += (answers.length - 1 - a + offset);
      } else {
        ret += (a + offset);
      }
      ret += '">&nbsp;' + answers[a] + '<br>';
    }
          
    ret += '</nobr>'
         + '</td>'
         + '</tr>';
  }
  ret += '</form></table>';

  return ret;
}

function quiz_validate() {
  var q;
  var a;
  var test;
  var ret = 1;

  for (q = 1; q <= questions[today].length; q++) {
    test = 0;
    for (a = 0; a < answers.length; a++) {
      if (eval('document.quiz.question' + q + '[' + a + '].checked')) {
        test = 1;
      }
    }
    if (!test) { ret = 0; }
  }

  if (!ret) { alert('Please ensure all questions have been answered.'); }

  return ret;
}

function quiz_score() {
  var q;
  var a;
  var ret = 0;
  for (q = 1; q <= questions[today].length; q++) {
    for (a = 0; a < answers.length; a++) {
      if (eval('document.quiz.question' + q + '[' + a + '].checked')) {
        ret += eval('(+(document.quiz.question' + q + '[' + a + '].value))');
      }
    }
  }

  return ret;
}





    var levels = new Array('Low', 'Moderate', 'High');
    var interpretations = new Array(
        'Do the basic UltraMetabolism Prescription.',
        'Follow the steps in each chapter to overcome the metabolic problems associated with that key and optimize the UltraMetabolism Prescription for your needs.',
        'Do the UltraMetabolism Prescription; customize it using the specific recommendations in the chapter. If you score high (7 and above) you would benefit from taking the additional tests noted in the last step. In addition to further testing, I strongly recommend that you seek professional medical assistance.'
    );
    var interpretations_2 = new Array(
        'Good news:  you have a low inflammation score.  That means you should be fine doing the basic program outlined in UltraMetabolism.',
        'You have a moderate inflammation problem and shoud pay extra attention to this metabolic key.  Please carefully review the chapter on inflammation in UltraMetabolism to discover exactly what steps you can take right now.',
        'You have a relatively high inflammation problem that requires your immediate attention.  Do the basic UltraMetabolism program, but customize it using the specific recommendations in the chapter on inflammation. If you score high (7 and above) you would benefit from taking the additional tests noted in that chapter. In addition to further testing, I strongly recommend that you seek professional medical assistance.'
    );
    
    function show_score() {
      if (quiz_validate()) {
        var score = quiz_score();
        var level;

        if (score <= 3) {
          level = 0;
        } else if ((score >=4) && (score <= 6)) {
          level = 1;
        } else {
          level = 2;
        }

        document.getElementById('divScore').innerHTML = '<div class="feature"><div class="wrap1"><div class="wrap2"><h2>Your Score: ' + score + ' (' + levels[level] + ')</h2><p>' + interpretations_2[level] + '</p></div></div></div>';
      }
    }