if (implode("", $cb_id) == "") {
    echo "<p>This conversation is empty.<br>&nbsp;</p>";
} else {
    foreach ($orderedCommentIds as $ocIds) {
        $ocIds = explode(":", trim(str_replace("::", ":", $ocIds), ":"));
        // clean up and explode threading results
        foreach ($ocIds as $ocId) {
            $selfkey = array_search($ocId, $cb_id);
            //find array key
            $irt = $cb_inReplyTo[$selfkey];
            //find parent comment id
            if (empty($topnewid) && strlen($cb_isnew[$selfkey])) {
                $topnewid = $cb_id[$selfkey];
                $topnewparentCandidate = $irt;
            }
            $indent = $cb_commentDepth[$selfkey] * 26;
            if ($indent == 0 || $hideallexcept > 0) {
                $indent = "";
            } else {
                $indent = "padding-left: " . $indent . "px;";
            }
            $commhtml = $cb_commentHTML[$selfkey];
            if ($cb_commentDepth[$selfkey] > 0) {
                $commhtml = str_replace("<XXXYYYZZZYYYXXX>", "<a href=\"javascript://\" onclick=\"jumpToAnchor('" . getCommentAnchor($irt) . "');\" title=\"Jump to parent comment\"><img src=\"gfx/up.gif\" border=1 width=6 height=6 hspace=7 vspace=1></a>", $commhtml);
            }
            echo "<div class=\"commentContainer\" style=\"{$indent}\" >";
            echo "<table border=0 cellpadding=3 cellspacing=0 style=\"table-layout:fixed; max-width: 850px;\">{$commhtml}</table>";
            echo "</div>";
        }
    }
}
                echo "</table></form>";
            }
        }
    }
    ?>
</td></tr></table>

<?php 
    //scripts to run after page loads
    if (FALSE && DEBUG) {
        // change if I need nonminified code
        $rand = floor(rand() * 100);
        $jquery_source = "scripts/conv_jquery.js?dev={$rand}";
        $classes = "scripts/classes.js?dev={$rand}";
    }
    if (wantNewPosts($topnewid)) {
        $jumpto = getCommentAnchor($topnewid);
        echo "<script type=\"text/javascript\">\n\t\t\twindow.onload=function(){ \n\t\t\tconsole.log('We want to only show new posts, starting with {$topnewid}');\n\t\t\tvar promise = autoHideOldComments();\n            console.time(\"time from hiding to promise resolving\");\n            ";
        if (!empty($topnewparentid)) {
            echo "var com = new kcom.Comment({$topnewparentid});\n                console.log('we are trying to display parent post ' + com.getId());\n                com.show();";
        }
        echo "\$.when(promise).then(function() { \n                jumpToAnchor('{$jumpto}');\n                console.timeEnd(\"time from hiding to promise resolving\");\n            } );\n\t\t}";
        echo "</script>";
    } else {
        echo "<script type=\"text/javascript\">\n\t\t\twindow.onload=function(){ \n                var comments = kcom.conv.getComments();\n                for (var i = 0; i < comments.length; i++) {\n                    comments[i].show();\n                }\n            }</script>";
    }
}
?>
</body>
</html>