//  Function to open a window
function windowOpen(window_url) {
  firsthalf='toolbar=yes,status=no,scrollbars=yes,menubar=yes,resizable=yes'
  secondhalf=',directories=no,location=no,width=550,height=400'
  whole = firsthalf + secondhalf
  helpWin = window.open(window_url,'',whole);
  if (document.images) { 
     if (helpWin) helpWin.focus()
  }
}

//  Function to disable the submit button after it is clicked.
function onesubmit() {
  document.forms[0].submitbutton.value = "Processing";
  document.forms[0].submitbutton.disabled = true;
  return true;
}

// Function to validate the information in the Comments field
function validComnt(Comntentry) {
invalidChars = "|^~%{};'=&*"
// does it contain any invalid characters?
  for (i=0; i<invalidChars.length; i++) {
  badChar = invalidChars.charAt(i)
  if (Comntentry.indexOf(badChar,0) > -1) {
     return false
  }
 }
return true
}
// Function to check the number of characters entered in the Comments field
function validComntlen(Comntlen) {
var maxchars = 180
if (Comntlen > maxchars) {
   return false
   } else {
     return true
   }
}
// Function that executes validComnt and validComntlen which check to see
// if the Comments field has any invalid characters or goes over the
// maximum characters allowed for this field.
// If successful, invoke oneSubmit function.                           
function checkForm(InpForm) {
  if (!validComnt(InpForm.Comnt.value)) {
  msgfirsthalf = "You have entered one of the following characters in the"
  msgsecondhalf = " Comment field: | ^ ~ % { } ; ' = & *"
  wholemsg = msgfirsthalf + msgsecondhalf
  alert(wholemsg)
  InpForm.Comnt.focus()
  InpForm.Comnt.select()
  return false
  }
/* If the number of characters entered in the Comments field is more than
the maximum allowed, issue an alert.
*/
  if (!validComntlen(InpForm.Comnt.value.length)) {
  alert("You have entered " + InpForm.Comnt.value.length + " characters." +
        "This exceeds the maximum number allowed.")
  InpForm.Comnt.focus()
  InpForm.Comnt.select()
  return false
  }
// If we made it to here, everything's valid, so return true
  onesubmit();
}
//  End script hiding
