// questions.js

var rQuestionVar1 = new Array (
"Pain.",
"Daily activity.",
"Eating habits.",
"Urination",
"Bowel habits/stool.",
"Sleep."
);

var rQuestionVar2 = new Array (
new Array ("Chest?", "Head?", "Abdomen?", "Gastric?", "Lower extremity?", "Upper extremity?", "Back?", "Feet?", "Joints?", "Muscle", "Does physical activity cause pain?"),
new Array ("Is Bernie under any stress?", "Is he walking? Crawling?", "Does he like to play?", "Does physical activity cause pain?", "How is his mood?", "Does he seem interested in activity around him?", "Energy levels?" ),
new Array ("How is his appetite?", "Does he eat a balanced diet?", "Fruits and veggies?", "Pain after eating?", "Have you noticed any changes in his eating habits?", "Vomitting/spitting up?", "Weight gain or loss?"),
new Array ("How much fluids does he drink eat day?", "How many wet diapers a day?", "What color is his urine?", "Does his urine have any strange odors?", "Do you notice any swelling?"),
new Array ("Is he constipated?", "Does he have diarrhea?", "Any rectal bleeding?", "Stool consistency?", "Stool color?", "Odor?"),
new Array ("Do you have trouble getting him to sleep?", "Does he sleep well?", "How much sleep does he get?", "Does he wake often?", "Does he nap during the day?")
);

var rAnswers = new Array (
new Array ("No.", "No.", "No.", "He seems to have a lot of tummy aches.", "No.", "No.", "No.", "No.", "No.", "No.", "No."),
new Array ("No.", "Uh, no.  He's starting to get up on all fours, and then he'll roll on the floor to get places.", "Yes, for short periods.  Then he seems to get tired.", "No, it doesn't seem to.", "Pretty good.  He's usually a very happy baby.", "I'd say yes.  His eyes follow everyone and he smiles a lot.", "He's not very energetic."),
new Array ("He eats everything we offer him, but he does eat very slowly.", "I think so...", "Oh, yes, he just loves them!", "No.", "No.", "No, only when he had the flu last month.", "He hasn't lost any weight, but he does seem to be growing very slowly."),
new Array ("Hmm, he likes his milk from a bottle, and he has about 3 of those a day.  He's just started taking juice from a cup, and he'll drink two or so of those.", "Four or five.", "I really haven't noticed, because it soaks into the diaper.", "No.", "No."),
new Array ("Yes!  He's very constipated.  Sometimes he even bleeds.", "Oh, no.  Actually, it's the opposite.", "Sometimes, when he's had a particularly hard BM.", "Very hard!", "Brown.", "Nothing unusual."),
new Array ("No. Once he goes to bed, he's usually fast asleep.", "Yes, but he sleeps in a funny position with his head back and his mouth open.", "About 7 hours.", "Well, not really.  He snores a lot and it's loud enough to wake him up sometimes.", "Yes, he takes a morning nap and another one in the afternoon.")
);

function popQuestions (inForm) {
	var theSelect = inForm.questionval1;
	
	for (x = 0; x < theSelect.options.length; x++)
		theSelect.options[x] = null;
	
	for (x = 0; x < rQuestionVar1.length; x++) {
		theSelect.options [x] = new Option (rQuestionVar1 [x], x, (x == 0 ? true : false));
	}
	
	theSelect.options [0].selected = true;
	
	popQuestion2 (inForm, 0);
}

function popQuestion2 (inForm, inWhich) {

	var theArray = rQuestionVar2 [inWhich];
	var theSelect = inForm.questionval2;
	
	for (x = 0; x < theSelect.options.length; x++)
		theSelect.options[x] = null;
	
	for (x = 0; x < theArray.length; x++) {
		theSelect.options [x] = new Option (theArray [x], x, (x == 0 ? true : false));
	}
	
	theSelect.options [0].selected = true;

}

function patientAnswer (inForm) {
	
	var theAnswer = rAnswers [inForm.questionval1.selectedIndex];
	theAnswer = theAnswer [inForm.questionval2.selectedIndex];
	
	alert (theAnswer);
}

