function VerifyRadio(form) {
  for (var i = 0; i < form.answer.length; i++ ) {
    if (form.answer[i].checked) {
      return true;
    }
  }

  return false;
}

// This is a variant on the verify function
// 	It will decide if all the radio buttons on a page have
//  been checked.  It will ignore the submit and reset buttons
//  plus any number of other fields (hidden) that are specified

function verify1(form, numchoices, numtoignore) {

numtoignore = numtoignore + 2; // 2 is added to account for the submit and reset buttons

numquestions = (form.length - numtoignore)/numchoices;

var  questions_ok = new Array(numquestions);


start = -1;
for (var i = 0; i < numquestions; i++ ) {
     questions_ok[i] = 0;
     for (j = (start+1); j < (start+numchoices+1); j++) {
                if (form.elements[j].checked) {
                  questions_ok[i] = 1;
               }
     }
     start = start + numchoices;
}
 
string = "You didn't answer:\n";
all_ok = 0;
for (k = 0; k < numquestions;k++) {
        if (questions_ok[k] == 0) {
                all_ok = 1;
                string = string + "Question  " + (k+1) +"\n";
        }
}
 
if (all_ok == 1) {
        string = string + "Please answer all the questions and resubmit.";
        alert(string);
        return(false);
}
return(true);
}

///////////////////////////////////////////////////
// function to ensure that each radio button choice
// has been answered.
// Note: Will only work when there are NO OTHER 
// form fields in the page (except for the submit and reset buttons)
// AND if all the radio choices have the same number of options.
// parameters: the form (this) and numchoices (the number of radio buttons per choice)
//
// Author: Sheila G. Winett
// Date: Jun 2, 2005
// Modifications:
//
//////////////////////////////////////////////////
function verify(form, numchoices) {

numquestions = (form.length - 2)/numchoices;

var  questions_ok = new Array(numquestions);


start = -1;
for (var i = 0; i < numquestions; i++ ) {
     questions_ok[i] = 0;
     for (j = (start+1); j < (start+numchoices+1); j++) {
                if (form.elements[j].checked) {
                  questions_ok[i] = 1;
               }
     }
     start = start + numchoices;
}
 
string = "You didn't answer:\n";
all_ok = 0;
for (k = 0; k < numquestions;k++) {
        if (questions_ok[k] == 0) {
                all_ok = 1;
                string = string + "Question  " + (k+1) +"\n";
        }
}
 
if (all_ok == 1) {
        string = string + "Please answer all the questions and resubmit.";
        alert(string);
        return(false);
}
return(true);
}

//---------------------------------------------
//
// Special check for radio buttons on hb8_02
// Assumes parameter 'catagories' is 2
//
//---------------------------------------------
function verifyCatagories(form, numchoices, catagories) {

numquestions = (form.length - 2)/numchoices;

var  questions_ok = new Array(numquestions);


start = -1;
for (var i = 0; i < numquestions; i++ ) {
     questions_ok[i] = 0;
     for (j = (start+1); j < (start+numchoices+1); j++) {
                if (form.elements[j].checked) {
                  questions_ok[i] = 1;
               }
     }
     start = start + numchoices;
}
 
string = "You didn't answer:\n";
all_ok = 0;
for (k = 0; k < numquestions; k = k+catagories ) {
        if (questions_ok[k] == 0) {
           all_ok = 1;
	   if(questions_ok[k+1] == 0)
	   {
               	string = string + "Question  " + (k/catagories +1);
		string = string + ": You did not answer either part - " +
			 "Agree or Matter - of this question.\n";
	   }
	   else
	   {
               	string = string + "Question  " + (k/catagories +1);
		string = string + ": You did not answer how much you agree\n";
           }			
        }
	else if(questions_ok[k+1] == 0) {
	   all_ok = 1;
	   string = string + "Question  " + (k/catagories +1);
	   string = string + ": You did not answer how much it would matter\n";
	}
}
 
if (all_ok == 1) {
        string = string + "Please answer all the questions and resubmit.";
        alert(string);
        return(false);
}
return(true);
}
