// Check if passed variable is blank?
function isBlank(s) {
  if ((s == null) || (s == "")) return true;
  return false;
}

// Set focus on screen to first blank input area
function blankFocus() {
  ff = -1;
  if (document.forms.length > 0) {
    field = document.forms[0];
    for (i=0; i<field.length; i++) {
      elt = field.elements[i];
      if ( (elt.type == "text") || 
           (elt.type == "password") ||
           (elt.type == "file") ||
           (elt.type == "select-one") ) {
        if (elt.name != "dummy") {
          if (ff == -1) ff = i;
          if (isBlank(elt.value)) {
            elt.focus();
            return;
          }
        }
      }
    }
    // If no blanks, set to first field!
    if (ff > -1) field.elements[ff].focus();
  }
}

// 
function placeFocus() {
// Very crude way to place focus on the first editable field, needs expanding if 
// other types of input fields are required.
  if (document.forms.length > 0) {
    field = document.forms[0];
    for (i=0; i<field.length; i++) {
      elements = field.elements[i];
      if ( (elements.type == "text") || 
           (elements.type == "password") ||
           (elements.type == "file") ||
           (elements.type == "select-one") ) {
        if (elements.name != "dummy") {
          elements.focus();
          break;
        }
      }
    }
  }
}

function helpMenu(href) {
  window.open(href, '', 'resizable=yes,status=yes,scrollbars=yes,width=550,height=550');
}

function loadpage(pageURL){
    location.href = pageURL.options[pageURL.selectedIndex].value;
}
