
  var comments = new function() {

    /* Setup comments */
    this.init = function() {

      var submitButton = $('ccFormSubmit');
      Event.observe(submitButton, 'click', handleSubmit);
    }

    function validateForm() {

      if($('ccName').value == "") {
        alert('You must enter your name.');
        $('ccName').focus();
        return false;
      }

      if($('ccEmail').value == "") {
        alert('You must enter your email address.\nNote: This information will not be shown or shared.');
        $('ccEmail').focus();
        return false;
      }

      var re = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
      if(!re.test($('ccEmail').value)) {
        alert('You must enter a valid email address.\nNote: This information will not be shown or shared.');
        $('ccEmail').focus();
        return false;
      }

      if($('ccMessage').value == "") {
        alert('You must enter your message.');
        $('ccMessage').focus();
        return false;
      }

      if($('recaptcha_response_field').value == "") {
        alert('You must type the text that is displayed in the security image.');
        $('recaptcha_response_field').focus();
        return false;
      }

      return true;
    }

    function handleSubmit(e) {

      if(!validateForm()) {
        e.preventDefault();
        return false;
      }
    }
  }

  Event.observe(document, 'dom:loaded', comments.init);
