//this is where it starts
var Attempt = 1;
var Progress = 1;

function Clicked()
{
	if (document.forms[0].checkme.value == "")
		{alert("\nYou need to answer the question to continue.")}
	else
		{
			if (Progress == 1)
				{
				  if (document.forms[0].checkme.value == CorrectAnswer) 
					{DisplayFeedback('Correct',FeedbackCorrect); Attempt = 2}
					
				  if (document.forms[0].checkme.value != CorrectAnswer && Attempt == 1)
			  		{DisplayFeedback('Incorrect',FeedbackWrong1)}	
					
				  if (document.forms[0].checkme.value != CorrectAnswer && Attempt == 2)
			  		{DisplayFeedback('Incorrect',FeedbackWrong2)}	
				 }
			if (Progress == 2)
			{location = NextPage}
			if (Progress == 3)
			{}
		}	
}

function SwapMe()
{
	if (Attempt == 2)
	{
		if (LastPage == "yes")
			{parent.parent.skip(NextPage)}
		else		
			{location = NextPage}
	}	
	if (Attempt == 1){Attempt = 2;}
}


function DisplayFeedback(Response,Feedback)
{
	if(Response == "Correct") {Answer = "<img src='images/correct.gif' width='122' height='36' border='0' alt='Correct'>"};
	if(Response == "Incorrect") {Answer = "<img src='images/correctNot.gif' width='138' height='33' border='0' alt='Incorrect'>"};
	

		FBtxt = "";
		//FBtxt = FBtxt +"<html><head><title>Feedback &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</title>";
		//FBtxt = FBtxt +"</head>";
		//FBtxt = FBtxt +"<body bgcolor='white' onload='self.focus()' onblur='self.focus()'>";
		//FBtxt = FBtxt +"<font face='Arial,Helvetica' size='-1'>";
		FBtxt = FBtxt +"<table width='550' border='2' cellspacing='0' cellpadding='5' bordercolor='184367' bgcolor='White'><tr><td><p class=feedback>";
		FBtxt = FBtxt + Answer;
		FBtxt = FBtxt +"<br><br><span style='line-height: 13pt; font-family: Arial, Helvetica, sans-serif; font-size: 100%;'>";
		FBtxt = FBtxt + Feedback;
		FBtxt = FBtxt +"</span><p><CENTER><A HREF='javascript:SwapMe();hideObject(over)'><IMG SRC='images/continue.gif' WIDTH='103' HEIGHT='23' BORDER='0' ALT='Click here to close this window'></A></CENTER></td></tr></table>";


		//alert(FBtxt)

		//FBwin.document.write(FBtxt);
		//FBwin.document.close();
		layerWrite(FBtxt);
		dir = 1;
		offsetx = 100;
		offsety = 30;
		
		disp();
		//moveTo(over,'200','200')
}
