// *********************************************************************
        //  HandleDatabindingForPostDetails
        //
        /// <summary>
        /// Handle data binding for the details about the most recent post
        /// </summary>
        ///
        // ********************************************************************/
        private void HandleDatabindingForPostDetails(Object sender, EventArgs e)
        {
            PlaceHolder  postDetails = (PlaceHolder)sender;
            DataListItem container   = (DataListItem)postDetails.NamingContainer;
            DateTime     postDateTime;
            Label        postDate = new Label();
            HyperLink    newPost  = new HyperLink();
            HyperLink    author   = new HyperLink();
            String       dateFormat;


            // Set the style of the lablel
            postDate.CssClass = "normalTextSmaller";

            // Do we have a signed in user?
            if (user != null)
            {
                dateFormat = user.DateFormat;
            }
            else
            {
                dateFormat = Globals.DateFormat;
            }

            // Get the post
            Thread thread = (Thread)container.DataItem;

            // Get the post date
            postDateTime = thread.ThreadDate;

            // Is a user logged in?
            if (user != null)
            {
                postDateTime = Users.AdjustForTimezone(postDateTime, user);
            }

            // Did the post occur today?
            if (thread.IsAnnouncement)
            {
                postDate.Text = "<b>Announcement</b><br>by ";
            }
            else if (thread.IsPinned)
            {
                postDate.Text = "<b>Pinned Post</b><br>by ";
            }
            else if ((postDateTime.DayOfYear == DateTime.Now.DayOfYear) && (postDateTime.Year == DateTime.Now.Year))
            {
                postDate.Text = "<b>Today @ " + postDateTime.ToString(Globals.TimeFormat) + "</b><br>by ";
            }
            else
            {
                postDate.Text = postDateTime.ToString(dateFormat + " " + Globals.TimeFormat) + "<br>by ";
            }

            // Add the post
            postDetails.Controls.Add(postDate);

            // Add the post author
            author.Text        = thread.MostRecentPostAuthor;
            author.CssClass    = "linkSmall";
            author.NavigateUrl = Globals.UrlUserProfile + thread.MostRecentPostAuthor;
            postDetails.Controls.Add(author);

            // Link to new post - we need to figure out what page the post is on
            newPost.Text = "<img border=\"0\" src=\"" + Globals.ApplicationVRoot + "/Skins/" + skinName + "/images/icon_mini_topic.gif\">";
            if (((thread.Replies + 1) > Globals.PageSize) && ((user != null) && (!user.ShowPostsAscending)))
            {
                int totalPages = Paging.CalculateTotalPages(thread.Replies + 1, Globals.PageSize);

                // Newest post will be on the last page
                newPost.NavigateUrl = Globals.UrlShowPost + thread.PostID + "&PageIndex=" + totalPages + "#" + thread.MostRecentPostID;
            }
            else
            {
                newPost.NavigateUrl = Globals.UrlShowPost + thread.PostID + "#" + thread.MostRecentPostID;
            }
            postDetails.Controls.Add(newPost);
        }
        // *********************************************************************
        //  HandleDatabindingForPostSubject
        //
        /// <summary>
        /// Handle data binding for the post subject
        /// </summary>
        ///
        // ********************************************************************/
        private void HandleDatabindingForPostSubject(Object sender, EventArgs e)
        {
            HyperLink    forumTitle = new HyperLink();
            Label        label;
            String       subject;
            bool         subjectTooLong = false;
            PlaceHolder  placeHolder    = (PlaceHolder)sender;
            DataListItem container      = (DataListItem)placeHolder.NamingContainer;

            Thread thread = (Thread)container.DataItem;

            if (thread.IsAnnouncement)
            {
                label          = new Label();
                label.CssClass = "normalTextSmallBold";
                label.Text     = "Announcement: ";
                placeHolder.Controls.Add(label);
            }

            // Get the subject
            subject = thread.Subject;

            // If the subject is > 30 cut it down and there is not whitespace
            if ((subject.Length > 30) && (subject.IndexOf(" ") == -1))
            {
                subject        = subject.Substring(0, 30);
                subjectTooLong = true;
            }
            else if (subject.Length > 60)
            {
                // We have whitespace, but the string is still exceptionally long
                if (subject.Substring(30, 30).IndexOf(" ") == -1)
                {
                    subject        = subject.Substring(0, 30);
                    subjectTooLong = true;
                }
            }

            forumTitle.Text        = subject;
            forumTitle.NavigateUrl = Globals.UrlShowPost + thread.PostID;
            forumTitle.CssClass    = "linkSmallBold";
            placeHolder.Controls.Add(forumTitle);

            // Add elipses
            if (subjectTooLong)
            {
                label          = new Label();
                label.CssClass = "normalTextSmallBold";
                label.Text     = " ...";
                placeHolder.Controls.Add(label);
            }

            // Do we have more than
            if (thread.Replies >= Globals.PageSize)
            {
                HyperLink link;

                // Add the opening paren
                label          = new Label();
                label.CssClass = "normalTextSmall";
                label.Text     = " (Page: ";
                placeHolder.Controls.Add(label);

                // Get the total number of pages available
                int totalPages = Paging.CalculateTotalPages((thread.Replies + 1), Globals.PageSize);

                // Display the first 3
                if (totalPages < 4)
                {
                    for (int i = 0; i < totalPages; i++)
                    {
                        link             = new HyperLink();
                        link.CssClass    = "linkSmall";
                        link.Text        = (i + 1).ToString();
                        link.NavigateUrl = Globals.UrlShowPost + thread.PostID + "&PageIndex=" + (i + 1).ToString();
                        placeHolder.Controls.Add(link);

                        if ((i + 1) != totalPages)
                        {
                            label          = new Label();
                            label.CssClass = "normalTextSmall";
                            label.Text     = ", ";
                            placeHolder.Controls.Add(label);
                        }
                    }
                }

                // Do we need elipses?
                if (totalPages >= 4)
                {
                    if (totalPages < 6)
                    {
                        for (int i = 0; i < totalPages; i++)
                        {
                            link             = new HyperLink();
                            link.CssClass    = "linkSmall";
                            link.Text        = (i + 1).ToString();
                            link.NavigateUrl = Globals.UrlShowPost + thread.PostID + "&PageIndex=" + (i + 1).ToString();
                            placeHolder.Controls.Add(link);

                            if ((i + 1) != totalPages)
                            {
                                label          = new Label();
                                label.CssClass = "normalTextSmall";
                                label.Text     = ", ";
                                placeHolder.Controls.Add(label);
                            }
                        }
                    }
                    else
                    {
                        for (int i = 0; i < 3; i++)
                        {
                            link             = new HyperLink();
                            link.CssClass    = "linkSmall";
                            link.Text        = (i + 1).ToString();
                            link.NavigateUrl = Globals.UrlShowPost + thread.PostID + "&PageIndex=" + (i + 1).ToString();
                            placeHolder.Controls.Add(link);

                            if ((i + 1) < 3)
                            {
                                label          = new Label();
                                label.CssClass = "normalTextSmall";
                                label.Text     = ", ";
                                placeHolder.Controls.Add(label);
                            }
                        }

                        label          = new Label();
                        label.CssClass = "normalTextSmall";
                        label.Text     = " ... ";
                        placeHolder.Controls.Add(label);

                        for (int i = totalPages - 2; i < totalPages; i++)
                        {
                            link             = new HyperLink();
                            link.CssClass    = "linkSmall";
                            link.Text        = (i + 1).ToString();
                            link.NavigateUrl = Globals.UrlShowPost + thread.PostID + "&PageIndex=" + (i + 1).ToString();
                            placeHolder.Controls.Add(link);

                            if ((i + 1) != totalPages)
                            {
                                label          = new Label();
                                label.CssClass = "normalTextSmall";
                                label.Text     = ", ";
                                placeHolder.Controls.Add(label);
                            }
                        }
                    }
                }

                // Add the closing paren
                label          = new Label();
                label.CssClass = "normalTextSmall";
                label.Text     = ")";
                placeHolder.Controls.Add(label);
            }
        }