/********************************************
 * Author: Toni Zipevski
 * Date Created: 7 October 2003
 * Purpose: Checks multiple choice questions
 ********************************************/

function textCheck(noQues,response)
// checks if a value has been entered in multiple text fields
// pre: noQues = number of questions,
//         response = text to appear in alert window;
// post: if true, return response;
{
	var fieldCount = 0;
	for (i=1; i<=noQues; i++)
	{
		var theForm = eval("document.activity.q"+i);	
		if (theForm.value) fieldCount++;
		if (noQues == fieldCount) return alert(response);
	}
	return alert ("You must attempt the question to receive a response");
}

function textCheckPopUp(noQues,url)
// checks if a value has been entered in multiple text fields
// pre: noQues = number of questions,
//         url = url to appear in new window;
// post: if true, return url;
{
	var fieldCount = 0;
	for (i=1; i<=noQues; i++)
	{
		var theForm = eval("document.activity.q"+i);	
		if (theForm.value) fieldCount++;
		if (noQues == fieldCount) return diaUp(url);
	}
	return alert ("You must attempt the question to receive a response");
}

function mtextCheckPopUp(start,finish,url)
// checks if a value has been entered in multiple text fields
// pre: start = starting question number,
//        finish = starting question number,
//         url = url to appear in new window;
// post: if true, return url;
{
	var fieldCount = start;
	for (i=start; i<=finish; i++)
	{
		var theForm = eval("document.activity.q"+i);	
		if (theForm.value) fieldCount++;
		if (finish == fieldCount) return diaUp(url);
	}
	return alert ("You must attempt the question to receive a response");
}

function fieldCheck(quesNo,response)
// checks if a value has been entered in the text field
// pre: quesNo = question number,
//         response = text to appear in alert window;
// post: if true, return response;
{
	var theForm = eval("document.activity.q"+quesNo);	
	if (theForm.value) return alert(response);
	return alert ("You must attempt the question to receive a response");
}

function fieldCheckPopUp(quesNo,url)
// checks if a value has been entered in the text field
// pre: quesNo = question number,
//         url = url to appear in new window;
// post: if true, return url;
{
	var theForm = eval("document.activity.q"+quesNo);	
	if (theForm.value == "insert topic sentence here..." || theForm.value == "insert your ideas here...") return alert ("You must attempt the question to receive a response");
	if (theForm.value) return diaUp(url);
	return alert ("You must attempt the question to receive a response");
}
