}
    if ($start >= $numPerPage) {
        echo "<div style='margin: 10px 0;'><a id='top_comment_first_page_link'>" . translate("Return to first page", "Trở về trang nhất") . "</a></div>\n\t<script type='text/javascript'> \$('#top_comment_first_page_link').click(function(){ load_comment_page('{$post->id}',0); }); </script>";
    }
    echo "</div>";
    $minWidth = 100;
    // in percentage
    $maxWidth = 100;
    // in percentage
    $widthIncrement = ($maxWidth - $minWidth) / $comment_count;
    $commentWidth = $comment_sort == "ASC" ? $maxWidth : $minWidth;
    // in percentage
    while ($row = mysql_fetch_object($result)) {
        $comment = new QuickDiscussion();
        $comment->load($row->id);
        $comment->mark_read();
        ?>
		<table cellspacing="5" cellpadding="0" border="0" style="width: <?php 
        echo $commentWidth;
        ?>
%; margin: 10px 0;"><tr><td valign="top">
			<?php 
        echo $comment->qd_author->display_user_post_image();
        ?>
			</td><td class="wrap">
				<?php 
        $vid_query = mysql_query("SELECT * FROM `videos_general` WHERE `attachedto` = 'quick_discussions:{$comment->id}'");
        $image_query = mysql_query("SELECT * FROM `images_general` WHERE `attachedto` = 'quick_discussions:{$comment->id}'");
        $music_query = mysql_query("SELECT * FROM `music_general` WHERE `attachedto` = 'quick_discussions:{$comment->id}'");
        $file_query = mysql_query("SELECT * FROM `files_general` WHERE `attachedto` = 'quick_discussions:{$comment->id}'");
        if (mysql_num_rows($vid_query) > 0) {
    $queries = $_SERVER["QUERY_STRING"];
}
if (!isset($_SESSION["root_path"]) or !isset($_SESSION["in"]) or !isset($_SESSION["user"]) or !isset($_REQUEST["id"])) {
    header("Location: /index.php" . (isset($queries) ? "?{$queries}" : ""), true);
    die;
}
require_once "{$_SESSION["root_path"]}/inc.php";
require_once "{$_SESSION["root_path"]}/scripts_each_page.php";
$user = new User($_SESSION["user"]);
$user->set_last_seen("view_discussion:{$_REQUEST["id"]}");
$post = new QuickDiscussion();
$post->load($_REQUEST["id"]);
if (!$post->id) {
    die;
}
$post->mark_read();
require_once "{$_SESSION["root_path"]}/page_top.php";
// add a column to the quick_discussion_read_status table if doesn't exist
mysql_add_column("quick_discussions_read_status", $user->username, "DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00'");
?>
<div style="text-align: center; margin: 10px 0;">
	<span style="display: inline-block; vertical-align: middle;"><?php 
if ($post->parent_id > 0) {
    ?>
<img src="files/site_images/layout/discussion-16.png" style="vertical-align: middle;"/><span style="vertical-align: middle;">&nbsp;<a onClick="load_page('view_single_discussion.php?id=<?php 
    echo $post->parent_id;
    ?>
');"><?php 
    echo translate("Return to main discussion", "Trở về thảo luận chính");
    ?>
</a></span><?php