break;
     default:
         handle_error_no_exit('top_level_categories: unknown category ID');
 }
 if (!is_array($topCategories)) {
     $error_message = get_error_message();
     $smarty->assign("ErrorMessage", $error_message);
     $smarty->display('error_page.tpl');
     $smarty->display('footer.tpl');
     mysql_close($dbh);
     exit;
 } else {
     $smarty->assign("CategoryName", $categoryName);
     for ($i = 0; $i < count($topCategories) && $i < 3; $i++) {
         $limit = 10;
         $events = GetTopEventsSubordinateToCategoryID($topCategories[$i]['id'], $limit);
         if (!is_array($events)) {
             $error_message = get_error_message();
             $smarty->assign("ErrorMessage", $error_message);
             $smarty->display('error_page.tpl');
             $smarty->display('footer.tpl');
             mysql_close($dbh);
             exit;
         } elseif (count($events) > 0) {
             $top_event_name = $events[0]['name'];
             $top_event_url = $events[0]['url'];
             $category_name = $topCategories[$i]['name'];
             $category_id = $topCategories[$i]['id'];
             $url_category = make_category_url($category_name, $category_id);
             $num_events = count($events);
             if ($num_events > 0) {
$descr = COMPANY_NAME . ", the best place to find concert, theater, and sports tickets.";
$smarty->assign("MetaDescr", $descr);
$breadcrumb_string = "<a href=\"{$root_url}/\">Home</a>";
$smarty->assign("Breadcrumbs", $breadcrumb_string);
$keywords = "concert tickets, theater tickets, sports tickets, mlb tickets, nba tickets, nfl tickets, football tickets";
$smarty->assign("SeoKeywords", $keywords);
$additional_text_content = "";
if ($dbh = mysql_connect($host_name, $db_username, $db_password)) {
    mysql_select_db($db_name);
    $smarty->display('main.tpl');
    $topThreeArray = GetMainCategories();
    $categories = array();
    $text_content = "Enjoy the best seats in the house, from the latest concert, theater, or sports events live at your nearest venue.  Choose from ";
    for ($i = 0; $i < count($topThreeArray); $i++) {
        $limit = 10;
        $events = GetTopEventsSubordinateToCategoryID($topThreeArray[$i]['id'], $limit);
        if (!is_array($events)) {
            $error_message = get_error_message();
            $smarty->assign("ErrorMessage", $error_message);
            $smarty->display('error_page.tpl');
            $smarty->display('footer.tpl');
            mysql_close($dbh);
            exit;
        } elseif (count($events) > 0) {
            $top_event_name = $events[0]['name'];
            $top_event_url = $events[0]['url'];
            $category_name = $topThreeArray[$i]['name'];
            $url_category_name = make_category_url($category_name);
            $category_id = $topThreeArray[$i]['id'];
            $num_events = count($events);
            if ($num_events > 0) {