var correct = 0;
var tries = 0;

function q1()
{
	window.open("q1.htm", "q_win", "width=500,height=250");
}
function qp1()
{
	ok = 1;
	while (ok)
	{
		reply = prompt("Question #1: What does the D in DNA stand for?", "");
		if (reply == "" || reply == null)//null is result of pushing cancel button
		{
//			alert("Break: \"" + reply + "\"");
			break; // same as cancel
		}
//		alert("Process: " + reply);

		tries++;

		s = delspaces(reply);
//		alert(s);

		s = s.toLowerCase();
//		alert(s);

		if (s == "deoxyribose" || s == "desoxyribose")
		{
			alert("That is correct!");
			ok = 0;
			correct++;
		}
		else
		{
			ok = confirm("Sorry, \"" +
				reply +
				"\" is not correct.\nDo you wish to try again?");
			if (ok)
			{
				if (confirm("Want a hint?"))
				{
					alert("What atom of ribose is missing in the sugar in DNA?");
				}
			}
		}
	}
	score();
}
function delspaces(s)
{
//	alert("delspaces(" + s + ")");
	while(-1 != (found = s.indexOf(" ")))
	{
//		alert("Found space at " + found);
		s = s.substring(0, found) + s.substring(found + 1);
//		if (!confirm(s))
//		{
//			break;
//		}
	}
//	alert("Found no more spaces");
	return(s);
}
function score()
{
	if (tries)
	{
		alert("Your score is " + correct +
			" correct\nout of " +
			tries + " tries." +
			((tries == correct) ?
			" Congratulations!" : ""));
	}
	else
	{
		alert("How about answering\nat least one question, first?");
	}
}

