
function glosser(strTurm,iPop)
{
	// need extra ../ if we were called from a popup dir (true as 2nd arg)
	// need no ../ if we were called from a menu (-1 as 2nd arg)

var strAnchor  = "glossary.htm#" + strTurm;
var strGlossDesc = "width=800,height=600,resizable=1,location=yes,scrollbars=yes,toolbar=yes,menubar=yes,status=yes";
if (iPop == true)	// called from popup
	{
	strAnchor = "../" + strAnchor;
	}
else if (iPop == -1)	// called from menu!
	{
	var strAnchor  = "glossary.htm#" + strTurm;
	}

if (!top.glossWin)
	{
	//alert("looks like first glossary call");
	top.glossWin = window.open(strAnchor,"glossRef",strGlossDesc);
	}
else if (top.glossWin.closed)
	{
	//alert("looks like it was closed, reopen it");
	top.glossWin = window.open(strAnchor,"glossRef",strGlossDesc);
	}
else
	{
	//alert("gloss window is open, set href and give focus");
	top.glossWin.location.href = strAnchor;
	top.glossWin.focus();
	}
}

function showCorrect(att)

{
  //alert("hullo from showCorrect " + att);

  // make sure "chosen" is in a form that the asp script can parse 
  // and that we can display in "you selected..."
  str = ""
  j = document.form1.elements.length;
  for (i = 0; i<j; i++)
    {
    obj = document.form1.elements[i];
    if ((obj.type == "checkbox") || (obj.type == "radio")) 
      {
      if (obj.checked)
      	{
		  str += obj.value + ", " ;
      	}
      //msg = msg + obj.type + "," +obj.name + ";";
      }
    }
	// get rid of trailing ", "
	j = str.lastIndexOf(", ");
	if (j != -1)
		{
		str = str.substring(0,j);
		}
  document.form1.chosen.value = str;


  // if attempt is max attempt, show the correct answers in the form.

  if (att == maxAttempt) 
    {
    // unset everything
    clearForm();
    // loop through answers, set those that should be set
	// answerMap must be defined!
//	j = answerMap.length;
//    for (i = 0; i<j; i++)
//      {
//      //alert("at " + i + " answerMap: " + answerMap[i]);
//      if (answerMap[i])
//         {
//         //alert("checking " + i);
//         document.form1.elements[i+1].checked = true;
//         }
//      }
    }
  return;
}

function clearForm()
{
  //alert("hullo from clearform()");
  //msg = ""
  // loop through all checkboxes and radio buttons; uncheck
  j = document.form1.elements.length;
  for (i = 0; i<j; i++)
    {
    obj = document.form1.elements[i];
    if ((obj.type == "checkbox") || (obj.type == "radio")) 
      {
      obj.checked = 0;
      //msg = msg + obj.type + "," +obj.name + ";";
      }
    }
    //alert (msg);
}

