<body><?php 
    #--- Get all competition infos.
    $competition = getFullCompetitionInfos($chosenCompetitionId);
    #--- Show form (or display error if competition not found).
    if ($competition) {
        if ($chosenList) {
            if ($competition['showPreregList']) {
                showPreregList();
            } else {
                showPreregForm();
            }
        } else {
            if ($competition['showPreregForm']) {
                showPreregForm();
            } else {
                showPreregList();
            }
        }
    } else {
        noticeBox(false, "Unknown competition ID \"{$chosenCompetitionId}\"");
    }
    ?>
</body></html><?php 
}
#----------------------------------------------------------------------
function showPreregForm()
{
    #----------------------------------------------------------------------
    global $chosenCompetitionId, $competition, $persons;
    $chosenCountry = $competition['countryId'];
    if (getBooleanParam('search')) {
<link rel="stylesheet" type="text/css" href="<?= pathToRoot() ?>style/tables.css" />
</head>
<body><?php

  #--- Get all competition infos.
  $competition = getFullCompetitionInfos( $chosenCompetitionId );

  #--- Show form (or display error if competition not found).
  if( $competition ){
    if( $chosenList ){
      if( $competition['showPreregList'] ) showPreregList();
      else showPreregForm();
    }
    else {
      if( $competition['showPreregForm'] ) showPreregForm();
      else showPreregList();
    }
  }
  else {
    noticeBox( false, "Unknown competition ID \"$chosenCompetitionId\"" );
  }
  ?></body></html><?php
}

#----------------------------------------------------------------------
function showPreregForm () {
#----------------------------------------------------------------------
  global $chosenCompetitionId, $competition, $persons;

  $chosenCountry = $competition['countryId'];