var browserType;

// detect browser type
if(document.layers){
    browserType = "layers";
}
if(document.all){
    browserType = "all";
}
if(!document.all && document.getElementById){
    browserType = "getElementById";
}

// detect if IE
ua = navigator.userAgent;
if (ua.indexOf("MSIE") >= 0) {
  isIE = true;
} else {
  isIE = false;
}

function openWindow(URL, name, width, height, toolbar, location, directories, scrollbars, status, menubar, resizable) {
        newWindow = window.open(URL, name, 'toolbar=' + toolbar + ',location=' + location + ',directories=' + directories + ',scrollbars=' + scrollbars + ',status=' + status + ',menubar=' + menubar + ',resizable=' + resizable + ',width=' + width + ',height=' + height );
        newWindow.focus();
}

/*
  function checkFieldLength

  Parameters:
    formName  - the name of the form
    fieldName - the name of the field to check
    maxLength - the length against which to check the field

  Modifies:
    checks that the value of field 'fieldName' in form
    'formName' is less than 'maxLength'. If it isn't,
    displays a dialog.
*/
function checkFieldLength(theForm, fieldName, maxLength) {
  // check the length of the field
  if (theForm[fieldName].value.length > maxLength) {
    alert("The maximum length for " + fieldName + " is " + maxLength + ". Your entry is " + theForm[fieldName].value.length + " characters.");
    return false;
  } else {
    return true;
  }
}
