//
// move cursor to first entry field of the form (if one exists)
//
function moveCursor() 
{
  if (document.forms.length > 0) 
  {
    var field = document.forms[0];
    for (i = 0; i < field.length; i++) 
    {
      if ((field.elements[i].type == "text") || (field.elements[i].type == "password") || (field.elements[i].type == "textarea") || (field.elements[i].type.toString().charAt(0) == "s")) 
      {
        document.forms[0].elements[i].focus();
        break;
      }
    }
  }
}
//
// generic pop-up window
//
function popup(srcstr, winwidth, winheight)
{
  if (! window.focus)return true;
  winprops='height='+winheight+',width='+winwidth+',scrollbars=yes,resizable=yes';
  var newWdw=window.open(srcstr, 'PicWin', winprops);
  newWdw.focus();
  return false;
}
//
// generic form submission
//
function submitForm(formName) 
{
  var aForm = document.getElementById(formName);  
  aForm.submit();
}
//
// Print the current page
//
function printPage()
{
  if (window.print) window.print()
}

function checkAll(formID) 
{
// checks all checkboxes in the passed form (form specified by Id)
var targetForm = document.getElementById(formID);
i=0;
while (targetForm[i].type == 'checkbox') 
   {
   targetForm[i].checked = 1
   i++;
   }
}

function clearAll(formID) 
{
// clears all checkboxes in the passed form (form specified by Id)
var targetForm = document.getElementById(formID);
i=0;
while (targetForm[i].type == 'checkbox') 
   {
   targetForm[i].checked = 0
   i++;
   }
}
