$html .= '</td>';
                 $html .= '</tr>';
             }
         }
         $html .= '</table>';
     }
     $html = iconv('UTF-8', 'windows-1252', $html);
     $pdf->WriteHTML($html);
     $pdf->Output($filename, 'D');
 }
 // ------------------------------------------------------------------------------------------------------
 # BJCP XML Output
 // ------------------------------------------------------------------------------------------------------
 // BJCP XML Specification: http://www.bjcp.org/it/docs/BJCP%20Database%20XML%20Interface%20Spec%202.1.pdf
 if ($view == "xml") {
     $total_days = total_days();
     do {
         $j[] = $row_judges['uid'];
     } while ($row_judges = mysql_fetch_assoc($judges));
     do {
         $s[] = $row_stewards['uid'];
     } while ($row_stewards = mysql_fetch_assoc($stewards));
     do {
         $st[] = $row_staff['uid'];
     } while ($row_staff = mysql_fetch_assoc($staff));
     do {
         $o[] = $row_organizer['uid'];
     } while ($row_organizer = mysql_fetch_assoc($organizer));
     $filename = str_replace(" ", "_", $_SESSION['contestName']) . "_BJCP_Points_Report.xml";
     $output = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
     $output .= "<OrgReport>\n";
function steward_points($uid)
{
    /*
    include(CONFIG.'config.php');
    mysql_select_db($database, $brewing);
    require(INCLUDES.'db_tables.inc.php');
    require(DB.'judging_locations.db.php');
    
    // *minimum* of 0.5 points per day	
    // *maximum* of 1.0 points per competition
    // Participants may not earn both Judge and Steward points in a single competition.
    // A program participant may earn both Steward and Staff points.
    
    do { $a[] = $row_judging['id']; } while ($row_judging = mysql_fetch_assoc($judging));
    foreach (array_unique($a) as $location) {
    	$query_assignments = sprintf("SELECT COUNT(*) as 'count' FROM %s WHERE bid='%s' AND assignLocation='%s' AND assignment='S'", $prefix."judging_assignments", $uid, $location);
    	$assignments = mysql_query($query_assignments, $brewing) or die(mysql_error());
    	$row_assignments = mysql_fetch_assoc($assignments);
    	if ($row_assignments['count'] > 1) $b[] = 0.5; 
    	else $b[] = $row_assignments['count'] * 0.5;
    }
    
    $points = array_sum($b);
    */
    $days = number_format(total_days(), 1);
    $points = $days * 0.5;
    // Cannot exceed more than 1.0 points per competition
    if ($points >= 1.0) {
        $points = 1.0;
    } else {
        $points = $points;
    }
    return number_format($points, 1);
}
        ?>
 BJCP Points Report</h1>
        </div>
    </div>
    <p>The points in this report are derived from the official BJCP Sanctioned Competition Requirements, available at <a href="http://www.bjcp.org/rules.php" target="_blank">http://www.bjcp.org/rules.php</a>.</p>
    <p><strong>BJCP Competition ID:</strong> <?php 
        echo $_SESSION['contestID'];
        ?>
</p>
    <p>
    <strong>Total Entries:</strong> <?php 
        echo $total_entries;
        ?>
<br />
    <strong>Total Days:</strong> <?php 
        echo total_days();
        ?>
<br />
    <strong>Total Sessions:</strong> <?php 
        echo total_sessions();
        ?>
<br />
    <strong>Total Flights:</strong> <?php 
        echo total_flights();
        ?>
 (includes Best of Show)<br />
    </p>
    <?php 
        if (!empty($output_organizer)) {
            ?>
    <h2>Organizer</h2>