/**
  * @description Given two input elements, highlights and sets the HTML5 
  *             validity message of the second input if they are not equal.
  * @param firstInputElement the first input to compare
  * @param secondInputElement the second input to compare
  * @param invalidMessage the string to place inside the HTML5 validity message popup
  */
function validateMatchingInputs(firstInputElement, secondInputElement, invalidMessage) {
  if (firstInputElement.val() != secondInputElement.val()) {
    secondInputElement.css('border-color', '#f00');
    secondInputElement.each(function() {
        this.setCustomValidity(invalidMessage);
    });
  } else {
    secondInputElement.css('border-color', '');
    secondInputElement.each(function() {
        this.setCustomValidity('');
    });
  }
}