function swap_required_input(e, this_id) {
  var keynum;
  var keychar;
  var numcheck;

  if(window.event) { // IE
    keynum = e.keyCode;
  } else if(e.which) { // Netscape/Firefox/Opera
    keynum = e.which;
  }
  keychar = String.fromCharCode(keynum);

  this_el = document.getElementById(this_id);
  if (this_el.value=='') {
    if (keychar=='') {
      this_el.className = 'required';
    } else {
      this_el.className = 'optional';
    }
  } else {
    this_el.className = 'optional';
  }
}

function exit_required_field(this_id) {
  this_el = document.getElementById(this_id);
  if (this_el.value=='') {
    this_el.className = 'required';
  }
}

function check_before_submit() {
  var errors = 'There were errors:\n\n';
  status = false;

  if (document.getElementById('reg_email').value=='') {
    errors = errors + 'You must enter an Email Address\n';
    status = true;
  }

  if (status) {
    alert(errors);
  } else {
    document.registration_form.submit();
  }
}