<!--
var QuizState = 0;
var QuizPage = 1;
var QuizResult = 0;

function QuizInit() {
	
	quiz = new Array(5);
	for (i = 1; i <= 13; i++) {
	   quiz[i] = new Array(5)
	   for (j = 1; j <= 13; j++) {
	      quiz[i][j] = "["+i+","+j+"]"
	   }
	} 
	
	quiz[1][0] = "What is a calorie?";
	quiz[1][1] = "A measure of fat content in a food";
	quiz[1][2] = "A measure of glucose or sugar in a food";
	quiz[1][3] = "A unit of energy";
	quiz[1][4] = "A unit of food";
	quiz[1][5] = '3';

	quiz[2][0] = "The information on a nutrition label includes:";
	quiz[2][1] = "Recommended levels of vitamins and minerals";
	quiz[2][2] = "Fat content, calories and salt content";
	quiz[2][3] = "Serving size and number of servings per container";
	quiz[2][4] = "All of the above";
	quiz[2][5] = '4';

	quiz[3][0] = "The food pyramid was recently updated to:";
	quiz[3][1] = "Decrease the level of recommended carbohydrates";
	quiz[3][2] = "Adjust dietary recommendations to age, gender and physical activity levels";
	quiz[3][3] = "Include vitamin supplements";
	quiz[3][4] = "Eliminate sugar";
	quiz[3][5] = '2';

	quiz[4][0] = "What is the recommended daily allowance of calcium for adults?";
	quiz[4][1] = "1,000 milligrams a day; 1200 milligrams  if you are over 50";
	quiz[4][2] = "50 to 100 milligrams";
	quiz[4][3] = "The equivalent of drinking one glass of milk";
	quiz[4][4] = "Unless you are at risk for osteoporosis, about 500 mg per day";
	quiz[4][5] = '1';

	quiz[5][0] = "Carbohydrates are found in which of the following foods:";
	quiz[5][1] = "Pastries and baked goods";
	quiz[5][2] = "Fruits and vegetables";
	quiz[5][3] = "Pasta and noodles";
	quiz[5][4] = "All of the above";
	quiz[5][5] = '4';

	quiz[6][0] = "Which of the following is NOT a fatty acid found in food?";
	quiz[6][1] = "Saturated";
	quiz[6][2] = "Semi Saturated";
	quiz[6][3] = "Unsaturated";
	quiz[6][4] = "Trans Fats";
	quiz[6][5] = '2';

	quiz[7][0] = "Which of the following may help you reduce your cholesterol?";
	quiz[7][1] = "Choose foods high in complex carbohydrates (starch and fiber)";
	quiz[7][2] = "Drink one additional glass of water per day";
	quiz[7][3] = "Substitute trans fats for saturated fats";
	quiz[7][4] = "Eat fruits instead of vegetables";
	quiz[7][5] = '1';

	quiz[8][0] = "A \"portion\" size of meat, fish or poultry is…";
	quiz[8][1] = "About 3 to 4 ounces";
	quiz[8][2] = "Roughly the size of a deck of cards";
	quiz[8][3] = "About the size of the palm of a woman's hand";
	quiz[8][4] = "All of the above";
	quiz[8][5] = '4';

	quiz[9][0] = "A good way to control overeating at a restaurant would be:";
	quiz[9][1] = "Order something you don't like";
	quiz[9][2] = "Ask for a take home container and take half your meal home";
	quiz[9][3] = "Tell the waiter it is improperly prepared and refuse to eat it";
	quiz[9][4] = "Just get a salad";
	quiz[9][5] = '2';

	quiz[10][0] = "We've all heard about the importance of exercise in staying healthy.  Why is it important?";
	quiz[10][1] = "Reduces dress size in 5 months";
	quiz[10][2] = "Prevents onset of menopause";
	quiz[10][3] = "Increases your heart rate and reduces the risk for several diseases such as high blood pressure and osteoporosis";
	quiz[10][4] = "Reduces likelihood of adult asthma";
	quiz[10][5] = '3';

	quiz[11][0] = "Why is adding fiber to your diet important?";
	quiz[11][1] = "Gives you healthy, glowing skin";
	quiz[11][2] = "May help prevent heart disease, diabetes and certain types of cancer";
	quiz[11][3] = "Fiber is a vegetarian source of protein";
	quiz[11][4] = "Fiber contains calcium for strong bones";
	quiz[11][5] = '2';

	quiz[12][0] = "What are some ways to reduce sodium in your diet?";
	quiz[12][1] = "Limit your consumption of processed foods";
	quiz[12][2] = "Substitute spices or herbs for salt";
	quiz[12][3] = "Cook rice, pasta, and hot cereals without salt";
	quiz[12][4] = "All of the above";
	quiz[12][5] = '4';

	quiz[13][0] = 'Not bad. Since you are interested in good nutrition and a healthy lifestyle, <a href="lbcoHealthyTips.cfm">click here</a> for more information and some easy tips.';
	quiz[13][1] = 'You know the basics, and are always eager to learn more about good nutrition. <a href="lbcoHealthyTips.cfm">Click here</a> for simple ways to keep up your healthy lifestyle.';
	quiz[13][2] = 'Wow! You are a dietary diva. <a href="lbcoHealthyTips.cfm">Click here</a> for more nutritional know-how to enhance your already healthy lifestyle.';

	displayQuizPage(QuizPage);
}

function QuizFormSubmit()
{
	if (QuizState == 1) {
		QuizState = 0;
		document.QuizForm.SumbitButton.value = "Submit";
		if (QuizPage == (quiz.length-1)) {
			QuizState = 2;
			showQuizResult();
			return false;
		} else displayQuizPage(QuizPage);
	}

	if (QuizState == 2) {
		QuizState = 0;
		QuizPage = 1;
		QuizResult = 0;
		changeStyle('qq', 'quiz_question');
		document.QuizForm.style.display = '';
		document.QuizForm.SumbitButton.value = "Submit";
		displayQuizPage(QuizPage);
	}
	
	bstate = false;
	for (i = 0; i <= 3; i++) {
		bstate = bstate | document.QuizForm.Answer[i].checked;
	}
	if (bstate == 0) return false;

	if (document.QuizForm.Answer[(quiz[QuizPage][5]-1)].checked == true) {
		document.getElementById('qq').style.display = 'none';
		document.getElementById('q_correct').style.display = '';

		highlightQuizAnswer(QuizPage, true);
		QuizResult++;
	} else {
		document.getElementById('qq').style.display = 'none';
		document.getElementById('q_incorrect').style.display = '';

		highlightQuizAnswer(QuizPage, false);
	}

	QuizState = 1;
	QuizPage++;
	if (QuizPage == 2) document.getElementById('q_header').style.display = 'none';
	document.QuizForm.SumbitButton.value = "Next";
	
	return false;
}

function displayQuizPage(n) {
	document.getElementById('q_correct').style.display = 'none';
	document.getElementById('q_incorrect').style.display = 'none'; 
	display('qq', n + '. ' + quiz[n][0] + "<br><br>");
	document.getElementById('qq').style.display = ''; 

	for (i = 0; i <= 3; i++) {
		obj = document.getElementById('qa'+i)
		obj.innerHTML = quiz[n][i+1];
		if (quiz[n][i+1] == '') {
			document.getElementById('s'+obj.id).style.display = 'none';
			document.getElementById('b'+obj.id).style.display = 'none';
		} else {
			document.QuizForm.Answer[i].disabled = false;
			document.getElementById('s'+obj.id).style.display = '';
			document.getElementById('b'+obj.id).style.display = '';
			obj.className = 'quiz_answer';
			obj.style.display = '';
		}
		document.QuizForm.Answer[i].checked = false;
	}
}

function highlightQuizAnswer(qp, qf) {
	for (i = 0; i <= 3; i++) {
		document.QuizForm.Answer[i].disabled = true;
		if (i != (quiz[qp][5]-1)) changeStyle('qa'+i, 'quiz_answerdisabled')
		else {
			if (qf == true)
				changeStyle('qa'+i, 'quiz_answerrhighlight');
			else
				changeStyle('qa'+i, 'quiz_answerwhighlight');
		}
	}
}

function showQuizResult() {
	document.getElementById('q_correct').style.display='none';
	document.getElementById('q_incorrect').style.display='none';
	
	if (QuizResult < 5) n = 0
	else if (QuizResult < 9) n = 1
	else n = 2;

	display('qq', '<b><font class="quiz_rquestion">Your Score: ' + QuizResult + "</font><br><br>" + quiz[QuizPage][n] + '</b><br><br><br><center><a href="javascript:void()" class="nicebutton" onMouseOver="Status(\'Take the Quiz again\');return true" onMouseOut="Status();return true" onClick="return QuizFormSubmit()">Take the Quiz again</a></center><br>');
	changeStyle('qq', 'normal');
	document.getElementById('qq').style.display=''; 
	document.QuizForm.style.display = 'none';
}

function display(id ,str) {
	document.getElementById(id).innerHTML = str;
}

function changeStyle(id, newClass) {
	document.getElementById(id).className = newClass;
}
// -->
