// questions.js

var rQuestionVar1 = new Array (
"Pain",
"Life Style",
"Eating Habits",
"Urination",
"Bowel Habits/Stool",
"Sleep",
"Sexual Activity/Reproductive Years",
"Skin Symptoms",
"Other Symptoms"
);

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 ("Are you under a lot of stress right now?", "Do you exercise regularly?", "How would you describe your diet?", "Does physical activity cause pain?", "How much alcohol do you consume each week?", "Do you smoke?", "Have you noticed any odd changes in your mood?", "How are your energy levels?"),
new Array ("Is your appetite OK?", "Would you say you eat a balanced diet?", "Fruits and veggies?", "Pain after eating?", "Vomiting/spitting up?", "Weight gain or loss?"),
new Array ("How much fluids do you drink each day?", "Do you need to urinate frequently?", "What color is your urine?", "Do you have any difficulty urinating?", "Have you lost or gained any weight recently?", "Do you notice any swelling?"),
new Array ("Constipation", "Diarrhea", "Rectal bleeding", "Stool consistency", "Stool color", "Odor"),
new Array ("Do you fall asleep easily?", "How much sleep do you get?", "Do you snore?", "Do you nap during the day?", "Do you fall asleep reading or watching TV?"),
new Array ("Are you pregnant?", "Are your periods regular?", "Are you taking birth control pills?", "How many times have you been pregnant?", "How many partners have you been with in the past 15 years?"),
new Array ("Have you been experiencing any fevers or hot flashes?", "Do you have night sweats", "Do you bruise easily?", "Have you been having any trouble with acne?", "Are you experiencing any unusual hair growth?", "Has your skill started flushing or turning red anywhere?", "Have you noticed other lumps or bumps in your skin?", "Have you noticed any changes in pigmentation?"),
new Array ("Nausea", "Vomiting", "Numbness or tingling?", "Cough", "SOB", "Palpitations", "Fever", "Night sweats", "Swollen glands")
);

var rAnswers = new Array (
new Array ("It's funny you should ask.  Last month I got some terrible chest pains - almost like a knife going in.  The doctor said I had pleurisy.  Eventually it went away, but it's been coming back again.", "I get headaches sometimes, but they go away if I take Tylenol.", "No.", "No.", "No.","My fingers and hands ache.  If I wasn't too young, you'd think I had arthritis.", "No.", "No.", "Yes - a lot of pain in my finger joints.", "Yes, I get these funny muscle aches, almost like I've got the flu.", "Just the opposite.  I'm stiff and sore in the morning, but it gets better once I take a shower and get moving."),
new Array ("And how!  My roommate and I are moving to a new place at the worst possible time!  I'm teaching an overload of classes AND I'm going crazy trying to finish writing a textbook on time.", "I do a lot of walking around campus.", "Overall, it's pretty healthy.  I'm a vegetarian, so the only problem I have is getting enough protein when I don't have time to cook.", "Just the opposite.  I'm stiff and sore in the morning, but it gets better once I take a shower and get moving.", "Just a glass of wine if I go out for dinner.", "No.", "No.", "I'm tired all the time, and it's getting really frustrating."),
new Array ("I haven't been very hungry lately.", "I'd say so.", "Oh, yes!  I've been a vegetarian since 1989.", "No.", "No.", "I'm always trying to lose weight, but it now it's getting easier since I'm not very hungry."),
new Array ("A lot of coffee, and about 6-8 glasses of water or soda, I guess.", "No, not really.", "Pale yellow.", "No.", "I'm always trying to lose weight, but now I've lost about ten pounds 'cause I haven't felt like eating.", "Just in my finger joints. I haven't been able to get my rings over them."),
new Array ("No.", "No.", "No.", "Normal.", "Normal.", "Normal."),
new Array ("Pretty much so.  I usually read in bed for a half hour or so until I feed sleepy.", "Between 6-7 hours a night.", "No.", "No.", "No."),
new Array ("No.", "Yes.", "Yes.  I take them because otherwise I get really bad cramps.", "Just once, but I had a miscarriage early on.", "Hmm… I haven't dated for a long time, but (she does a quick finger count).   No more than 3 or 4.  And I insist on using a condom."),
new Array ("No.", "No.", "No.", "No.", "I think I'm losing some hair because a lot comes out after I comb or shampoo my hair.", "Yes!  I get this funny rash over my nose when I spend too much time in the sun.", "No.", "Just a reddish rash over my nose and cheeks after I've been in the sun."),
new Array ("No.", "No.", "No.", "No.", "No.", "No.", "No.", "No.", "No.")
);

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);
}

