// get browser info

var browser = navigator.Name;
var browserNum = parseInt(navigator.appVersion);
var N4 = false;
var N6 = false;
var IE = false;


rightAnswers = new Array("t", "f", "t", "t", "t", "t", "t", "t", "t", "f", "t", "t", "t", "t", "t", "f", "f", "f", "t", "t", "t", "f");
rightAnswersReason = new Array(
"<b>True.</b>  There's little or no evidence that a pregnant woman's exposure to the chemicals involved in a manicure or pedicure are harmful to the fetus. A pedicure in particular can be a wonderful thing in late pregnancy when you're having trouble reaching your toes even to clip your nails.", 

"<b>False.</b>  The skin of your stomach tightens during pregnancy and can get irritated by the ring.  The ring would have to come off before a C-section (20-25 percent chance of having a ceasarian section in the US.)  You don’t want to risk losing the ring inside you.  You can't have metal in your body in the area where the incision will be made.",

"<b>True.</b>  As long as you don’t place the heat pad on your abdomen (which could be as risky as a hot tub), there shouldn’t be a problem.  A heating pad applied to sore muscles won't harm your baby because moderate heat applied to one area of your body won't raise your overall blood temperature. ", 

"<b>True.</b>   But it may be uncomfortable, hard on your back, and difficult to manage because of your shifting center of gravity.",

"<b>True.  </b>It’s safe for your pregnancy, but puts your back at risk.  As the uterus expands, the abdominal muscles no longer give support to your back muscles so when you're lifting things you have little back support. If you do have to pick something up, make sure to bend your knees.", 

"<b>True.  </b> In your first trimester sit-ups and crunches are okay, but later you’ll find sit-ups are practically impossible.  Additionally, you need to avoid lying on your back because your uterus can compress the blood vessels leading to your heart, potentially depriving your developing baby of oxygen. ", 

"<b>True.  </b> Unless you’re a high-risk pregnancy or have placenta previa, it is generally safe to jog throughout pregnancy.  Of course it becomes more difficult as you carry more weight, and there are cautions about overheating, but jogging poses no danger to the fetus. ", 

"<b>True.  </b> In fact, a chlorinated pool is the only really safe pool to swim in.  Swimming is very kind exercise for pregnant women, especially late term.", 

"<b>True.  </b> A brief vacation won’t affect your pregnancy.  However, pregnancy tends to leave mothers short of breath, which is just aggravated by higher altitude if you’re not used to it.", 

"<b>False.  </b> It’s not necessarily safe to eat raw oysters at any time.  Oysters can carry hepatitis, which can make mothers sick, but should not affect the baby.  The same advice holds for sushi.  Sushi can carry parasites which are not necessarily threats to the baby, but can pose risks to the mother’s health.", 

"<b>True.  </b> But just your morning cup.  A study of women in their first trimester has shown a higher miscarriage rate at 200 mg of caffeine per day. That's about the amount of caffeine you'd get if you drank 2 small cups of coffee or 5 cans of caffeinated soda. (Women who drank 200 mg. of caffeine per day had a miscarriage rate of 30 percent; those who drank 100 mg per day had a miscarriage rate of 15 percent, and those who drank no caffeine had a rate of 12 percent.)", 

"<b>True.  </b> Antacids are excellent and safe to take often. When heartburn's keeping you awake, you can prop yourself up and have a little sip of Mylanta or chew on a Maalox tablet and you'll feel better. Heartburn medications like Pepcid AC are also okay.", 

"<b>False.  </b> Toxoplasmosis is a parasite infection that can be transmitted through infected cat feces or soil where cats have been.  It’s possible to pass this to your child.   If contracted early in pregnancy, toxoplasmosis can cause serious birth defects including eye and brain damage.  Indoor cats, however, are unlikely to carry the disease.  So let someone else clean the kitty litter during your pregnancy.", 

"<b>True, with cautions.</b>   For sneezing and runny nose, it’s okay to use certain medications as long as you check with your Ob/Gyn first.  Generally, however, it’s best to avoid most medications in the first trimester.", 

"<b>True.  </b> Acetaminophen (Tylenol), is safe, but be careful not to take more than the amount recommended on the label. If you take too much, it can cause liver failure, and in a small number of cases, pregnant women who overdosed on acetaminophen had babies with birth defects.", 

"<b>False.  </b> No sleeping pills have been classified by the FDA as risk-free for an unborn baby.  The FDA classified  compounds including Benadryl and Ambien, as Class B medications, which are presumed safe for pregnant women based on animal studies, but no well-controlled human studies are available. Other sleeping pills, including Sonata, Lunesta, and Rozerem, are considered Class C medications whose safety is uncertain. Always check with your physician before taking any OTC or prescription medication during pregnancy.", 

"<b>False.  </b> If you have an immunity to chicken pox, and many adults do, you can’t contract it or pass it on.  If not, you and your child are susceptible, and there are risks of serious complications.  There are remedies, however, so if you are exposed, talk to your doctor immediately.", 

"<b>False.  </b> Your body increases the amount of blood circulating to support the baby and placenta when pregnant.  Consequently, no blood bank would consider drawing blood from a pregnant woman.", 

"<b>True.  </b> Unless facing complication like placenta previa, sex is fine during every stage of pregnancy.", 

"<b>True.  </b> In early pregnancy your uterus is still behind your pubic bone, so it's protected. Later in your pregnancy, sleeping on your stomach will be too uncomfortable.", 

"<b>True and False. </b> Small studies have shown that chronic exposure to carbon monoxide in wood smoke may be harmful to the growth of a developing fetus. However, occasional exposure from campfires and properly ventilated fireplaces or wood-burning stoves is much less likely to have any harmful effects.", 

"<b>False.  </b> The risks posed by improperly sterilized tattoo equipment are real whether you’re pregnant or not.   Also, your skin changes during pregnancy and that may change the way the tattoo looks after you deliver the baby.");

numQuestions = rightAnswers.length;
score = 0;
currentQuestion = 1;
answeredElement = null;
formRef = " ";
qTrackerRef = " ";

if ((browser == "Netscape") && (broswerNum < 5))
{ 
	layerRef= "document.layers['";
	endLayerRef= "']";
	styleRef = " ";
	endFormRef=" ";
	qTrackerRef = "document.layers['qTracker'].";
	N4 = true;

}
else if ((browser == "Netscape") && (browserNum >= 5))
{
	 layerRef = "document.getElementById('";
	 endLayerRef ="')";
	 styleRef=".style";
	 formRef="document.forms['";
	 endFormRef = "']";
	 N6 = true;
 }
 else
 {
 	layerRef = "document.getElementById('";
	 endLayerRef ="')";
	 styleRef=".style";
	 formRef="document.forms['";
	 endFormRef = "']";
	IE = true;
 }
 
 
 
 
 function checkForAnswer(q)
 {
 	if(N4) {
		formRef = "document.layers['" + "q" + q + "'].document.";
		}
	eval("questionObj=" + formRef + "q" + q + "form" + endFormRef);
	numOptions = questionObj.elements.length - 1;
 
 
 	// Get Value of form submission
		for(i=0; i < numOptions; i++)
		{
			if(questionObj.elements[i].checked)
			{
			
				answeredElement = i
				return true
			
			}
		
		}
	  		return false
  }
  
  function checkAnswer(q)
  {
  		if(checkForAnswer(q))
		{
			// check for right answer
			if (N4) {
				formRef="document.layers['" + "q" + q + "'].document.";
				}
			eval("questionObj=" + formRef + "q" + q + "form" + endFormRef);
			answer = questionObj.elements[answeredElement].value;
			//Get the correct answer reason
			showAnswerReason = rightAnswersReason[currentQuestion - 1];
			checkAnswerButton = "checkAnswerButton" + q;
			
			document.getElementById("wrong").innerHTML = showAnswerReason;
			document.getElementById("right").innerHTML = showAnswerReason;
			document.getElementById(checkAnswerButton).style.display = 'none';
			
			//Deterine wheter to show finish quizz button or not
			if(currentQuestion < numQuestions){
					eval(qTrackerRef + layerRef + "nextQuestion" + endLayerRef + styleRef + ".display = 'block'");
				}else{
					eval(qTrackerRef + layerRef + "finishQuiz" + endLayerRef + styleRef + ".display = 'block'");
			}
			
			if(answer == rightAnswers[currentQuestion - 1])
			{
				score = score + 1;				
				eval(qTrackerRef + layerRef + "answerArea" + endLayerRef + styleRef + ".display = 'none'");
				eval(qTrackerRef + layerRef + "wrong" + endLayerRef + styleRef + ".display = 'none'");
				eval(qTrackerRef + layerRef + "right" + endLayerRef + styleRef + ".display = 'block'");			
				//updateQtracker('right' ,currentQuestion)
							
			}
			else
			{

				eval(qTrackerRef + layerRef + "answerArea" + endLayerRef + styleRef + ".display = 'none'");
				eval(qTrackerRef + layerRef + "wrong" + endLayerRef + styleRef + ".display = 'block'");
				eval(qTrackerRef + layerRef + "right" + endLayerRef + styleRef + ".display = 'none'");
				//updateQtracker('wrong' ,currentQuestion)
			
			}
	
	
		


}		
else	
	{
		// an answer was not chosen
		alert("Please Select one of the following options");
	
	}	
		
}





function nextQuestion(oldQ,newQ)
{
	// hide old layer or question
	
	eval(layerRef + "q" + oldQ + endLayerRef + styleRef + ".display = 'none'");
	eval(layerRef + "q" + newQ + endLayerRef + styleRef + ".display = 'block'");
	//updateQtracker('current',newQ)



}

// Move on to next Question from button click
function onToNextQuestion(){
	if(currentQuestion < numQuestions)
	{
	
		oldQuestion = currentQuestion;
		currentQuestion = currentQuestion + 1;
		nextQuestion(oldQuestion,currentQuestion);
		eval(qTrackerRef + layerRef + "nextQuestion" + endLayerRef + styleRef + ".display = 'none'");
		eval(qTrackerRef + layerRef + "finishQuiz" + endLayerRef + styleRef + ".display = 'none'");
		eval(qTrackerRef + layerRef + "wrong" + endLayerRef + styleRef + ".display = 'none'");
		eval(qTrackerRef + layerRef + "right" + endLayerRef + styleRef + ".display = 'none'");
	}
	else
	{
		eval(qTrackerRef + layerRef + "nextQuestion" + endLayerRef + styleRef + ".display = 'none'");
		eval(qTrackerRef + layerRef + "finishQuiz" + endLayerRef + styleRef + ".display = 'none'");
		eval(qTrackerRef + layerRef + "wrong" + endLayerRef + styleRef + ".display = 'none'");
		eval(qTrackerRef + layerRef + "right" + endLayerRef + styleRef + ".display = 'none'");
		quizFinished();
	
	}
}


function quizFinished()
{
eval(layerRef + "q" + currentQuestion + endLayerRef + styleRef + ".display = 'none'");
eval(layerRef + "thanksForm" + endLayerRef + styleRef + ".display = 'block'");

//eval(qTrackerRef + layerRef + "answerArea" + endLayerRef + styleRef + ".display = 'block'");
//eval(qTrackerRef + layerRef + "wrong" + endLayerRef + styleRef + ".display = 'none'");
//eval(qTrackerRef + layerRef + "right" + endLayerRef + styleRef + ".display = 'none'");
// display score
if (N4) {
	formObj= document.layers['thanksForm'].document.forms['thanksForm2'];
	}
else 
	{
	//formObj = document.forms['thanksForm2'].endScore.value = score;
	document.getElementById("quizResult").innerHTML = score + "/" + numQuestions;
	
	}
}
