function hijackValidator() {
  // loop through all the Forms in the document
  for (i=0; i<document.forms.length; i++) {

/* create a new property of the Form that tracks whether the Form has been submitted*/

   document.forms[i].notSubmittedYet = true;
   if (document.forms[i].onsubmit) {
    var oldHandler = new String(document.forms[i].onsubmit)

/*  oldHandler will be something like this, depending on the browser in use,
*   and the name of the Form:
*
*   "function anonymous() { return FrontPage_Form1_Validator(this); }"
*
*   We need to extract just the "FrontPage_Form1_Validator(this)" part
*/

    //find "Validator"
    var validatorIndex = oldHandler.indexOf("Validator");

    //if "Validator" not found, then abort
    if (validatorIndex<0) return;

    //find space before name of validator function
    var startIndex = oldHandler.lastIndexOf(" ",validatorIndex)

    // if space not found, abort
    if (startIndex<0) return;

    // find final parenthesis
    var endIndex = oldHandler.indexOf(")",validatorIndex);

    //if parenthesis not found, abort
    if (endIndex<0) return;

    // create a String for the name of the validator function,
    // and store it as a new property of the Form
    document.forms[i].oldValidator = new String(oldHandler.slice(startIndex,endIndex+1));

    /* oldValidator is something like this:
    * "FrontPage_Form1_Validator(this);"

    */
   }

   else {  //Form did not have an onSubmit handler previously
   	 document.forms[i].oldValidator = new String("true;");
	}

   //substitute our own onSubmit handler for the one FrontPage created
   document.forms[i].onsubmit = enhancedValidator;

  } //end for

} //end hijackValidator()

function enhancedValidator() {

 /* This is our new validator function.
 * It first calls the FrontPage validator for the Form.
 * If that returns TRUE, it then checks whether the Form
 * has already been submitted.
 * If it has been, we do not submit it again.
 */

 if (eval(this.oldValidator.valueOf())) { // is FrontPage validation successful?

  if (this.notSubmittedYet) {  //did user click Submit already?
   this.notSubmittedYet = false;
   return true; // submit form
  }

  else { // form already submitted; complain to user
   alert("You have already submitted the form.  Please be patient. \nThe Internet has had a busy day and is a little tired, but as soon as it catches its breath, it will deliver your confirmation message.");
   return false;  // don't submit form
  }

 }

 else { // FrontPage validator found error
  return false;  // don't submit form
 }

} // end enhancedValidator()