sub show_registration {
  my $post_data_ref=$_[0];
  my ($leader, $follower, $coup, @registered_dances, $registered_dances_ref,
      $i, $master_ref, %asdf);

  General::log("show_registration");

  ($leader, $follower)=Competitor::assemble_competitors($post_data_ref);

  $coup=Couple->new($leader, $follower);

  $registered_dances_ref=Database::getDancesByCouple($coup);

  print "<HEAD><TITLE>\nOpenImpetus ".Constants::get(HTML_MSG1).
    "\n</TITLE></HEAD>";
  print Constants::get(BODY_TAG);

  print "<h1 align=center> ".Constants::get(HTML_MSG1)." </h1>";
  print Constants::get(HTML_MSG2);

  print "<form method=post blahblah>\n";

  print "<center>\n";
  
  print "<table width=100%>\n";
  print "<tr><th colspan=2> ".Constants::get(HTML_MSG3)." </th>\n";
  print "<th colspan=2> ".Constants::get(HTML_MSG4)." </th>\n";
  print "<tr><td align=right> ".Constants::get(HTML_MSG5)." </td>\n";
  print "<td> ".$leader->getName()." </td>\n";
  print "<td align=right> ".Constants::get(HTML_MSG5)." </td>\n";
  print "<td> ".$follower->getName()." </td></tr>\n";
  print "<tr><td align=right> ".Constants::get(HTML_MSG6)." </td>\n";
  if ($leader->doesEmailExist()) {
    print "<td> ".$leader->getEmail()." </td>\n\n";
  } else {
    print "<td> ".Constants::get(HTML_MSG18)." </td>\n\n";
  }
  print "<td align=right> ".Constants::get(HTML_MSG6)." </td>\n";
  if ($follower->doesEmailExist()) {
    print "<td> ".$follower->getEmail()." </td></tr>\n\n";
  } else {
    print "<td> ".Constants::get(HTML_MSG18)." </td>\n\n";
  }
  print "<tr><td align=right> ".Constants::get(HTML_MSG7)." </td>\n";
#  print "<td> ".$leader->getSchool()." </td>\n\n";
  $_=$leader->getSchool();
  if ($_==-1) {
    print "<td> <i>".Constants::get(HTML_MSG29)."</i> </td>\n\n";
  } else {
    print "<td> $_ </td>\n\n";
  }
  print "<td align=right> ".Constants::get(HTML_MSG7)." </td>\n";
#   print "<td> ".$follower->getSchool()." </td></tr>\n\n";
  $_=$follower->getSchool();
  if ($_==-1) {
    print "<td> <i>".Constants::get(HTML_MSG29)."</i> </td>\n\n";
  } else {
    print "<td> $_ </td>\n\n";
  }
  print "</table>\n";
  
  print "</center><p><hr><p>\n";
  
  print "<input type=\"hidden\" name=\"openimpetus_major_dispatch\" ";
  print "value=\"registration\">";
  print "<input type=\"hidden\" name=\"openimpetus_minor_dispatch\" ";
  print "value=\"process_change_registration\">";
  print "<input type=\"hidden\" name=\"compname\" value=\"";
  print Constants::get(COMPFILE)."\">\n";

  print "<input type=\"hidden\" name=\"leader_fname\" value=\"".
    $leader->getFName()."\">\n";
  print "<input type=\"hidden\" name=\"leader_lname\" value=\"".
    $leader->getLName()."\">\n";
  print "<input type=\"hidden\" name=\"leader_email\" value=\"".
    $leader->getEmail()."\">\n";
  print "<input type=\"hidden\" name=\"leader_email_exists\" value=\"".
    $leader->doesEmailExist2()."\">\n";
  print "<input type=\"hidden\" name=\"leader_school\" value=\"".
    $leader->getSchool()."\">\n";
  print "<input type=\"hidden\" name=\"leaderTBA\" value=\"".
    $leader->getTBA()."\">\n";
  print "<input type=\"hidden\" name=\"follower_fname\" value=\"".
    $follower->getFName()."\">\n";
  print "<input type=\"hidden\" name=\"follower_lname\" value=\"".
    $follower->getLName()."\">\n";
  print "<input type=\"hidden\" name=\"follower_email\" value=\"".
    $follower->getEmail()."\">\n";
  print "<input type=\"hidden\" name=\"follower_email_exists\" value=\"".
    $follower->doesEmailExist2()."\">\n";
  print "<input type=\"hidden\" name=\"follower_school\" value=\"".
    $follower->getSchool()."\">\n";
  print "<input type=\"hidden\" name=\"followerTBA\" value=\"".
    $follower->getTBA()."\">\n";

  print "<input type=\"checkbox\" name=\"removeCouple\" value=\"1\">\n";
  print Constants::get(HTML_MSG49)."<p>\n";

#  print "<table width=100%>\n";
  print "<table align=center>\n";

  $master_ref=Constants::get(MASTER);
  $lastdance=$$master_ref[0];

  for ($i=0;$i<=$#$master_ref;$i++) {
    $thisdance=$$master_ref[$i];
    if ($i<$#$master_ref) {
      $nextdance=$$master_ref[$i+1];
    }

    if (($thisdance->getLevel() ne $lastdance->getLevel()) || $i==0) {
      print "<tr></tr><tr></tr><tr></tr>\n";
      print "<tr><th colspan=3> ".Constants::get($thisdance->getLevel())." </th></tr>\n";
      print "<tr><td colspan=3 align=center><i>\n";
      print $thisdance->getLevelExp();
    }

    if ((($thisdance->getStyle() ne $lastdance->getStyle()) ||
	 ($thisdance->getContinent() ne $lastdance->getContinent()))
	&& $i!=0) {
#      print "<tr><td colspan=3 align=center> - </td></tr>\n";
      print "<tr></tr><tr></tr><tr></tr>\n";
    }

    if (($thisdance->getLevel() eq $lastdance->getLevel()) &&
	($thisdance->getContinent() eq $lastdance->getContinent()) &&
	($thisdance->getStyle() eq $lastdance->getStyle()) && $i!=0) {
      print "<tr><td align=right> ".$thisdance->getName()." </td>\n";
    } else {
#      if ($thisdance->getStyle() eq $nextdance->getStyle()) {
#	print "<tr><th> All ".
#	  Constants::get($thisdance->getLevel())." ".
#	    Constants::get($thisdance->getContinent())." ".
#	      $thisdance->getStyle2()." events </th>\n";
#	print "<td> ".Constants::get(YES).": <input type=\"radio\" ";
#	print "name=\"".$thisdance->getLevel()."-".$thisdance->getStyle2().
#	  "value=\"1\"> </td>\n";
#	print "<td> ".Constants::get(NO).": <input type=\"radio\" checked";
#	print "name=\"".$thisdance->getLevel()."-".$thisdance->getStyle2().
#	  "value=\"0\"> </td></tr>\n";
#      }
      print "<tr><td align=right> ".
	Constants::get($thisdance->getLevel())." ".
	  Constants::get($thisdance->getContinent())." ".
	    $thisdance->getName()." </td>\n";
    }

    if ($#$registered_dances_ref != -1) {
      if (Vector::contains($registered_dances_ref, $thisdance)) {
	print "<td> ".Constants::get(YES).": <input type=\"radio\" checked ";
	print "name=\"".$thisdance->getAbbrev()."\" value=\"2\"> </td>\n";
	print "<td> ".Constants::get(CANCEL).": <input type=\"radio\" ";
	print "name=\"".$thisdance->getAbbrev()."\" value=\"-1\"></td></tr>\n";
        $lastdance=$thisdance;
	next;
      }
    }
    print "<td> ".Constants::get(ADD).": <input type=\"radio\" ";
    print "name=\"".$thisdance->getAbbrev()."\" value=\"1\"> </td>\n";
    print "<td> ".Constants::get(NO).": <input type=\"radio\" checked ";
    print "name=\"".$thisdance->getAbbrev()."\" value=\"0\"></td></tr>\n";
    $lastdance=$thisdance;
  } # loop over Master[]

  print "</table><p>\n";

  print "<input type=\"submit\" value=\"".
    Constants::get(HTML_SUBMIT_FORM)."\">\n";
  print "<input type=\"reset\" value=\"".
    Constants::get(HTML_CLEAR_FORM)."\">\n";
  print "</form>\n";

  General::PrintHTMLTail();
}

1;
