﻿
        $(document).ready(function() {

            for (var i = 16; i <= 130; i++) {
                document.getElementById(i.toString()).style.display = "none";
            }

            var top_post = 1;
            var bottom_post = 15;
            var next_post = 15;
            var post_length = $(".side-post").length;
            $("#timer_handle").everyTime(3000, function() {
                //next_post = (bottom_post % post_length)+1;    
                if (next_post < 130) next_post++;
                else next_post = 1;
                $("#" + top_post).queue(function() {
                    $(this).hide("slow");
                    $("#" + next_post).show("slow");
                    $(this).dequeue();
                });
                $("#" + top_post).queue(function() {
                    $("#recent-posts").append($(this))
                    $(this).dequeue();
                });
                if (top_post < 130) top_post++;
                else top_post = 1;
                //top_post = bottom_post;
                bottom_post = next_post;
            });
        });
                
        function ShowUserPopUp()
        {
            var tBox = $("div[id$=divUser]").attr("id");
            var t = "";
            var a = "#TB_inline?height=520&width=520&inlineId=" + tBox;
            var g = false;

            tb_show(t, a, g);                
        }        
        function HideUserPopUp()
        {
            tb_remove();
        }

        function ShowCommentPopUp() {
            var tBox = $("div[id$=divComment]").attr("id");
            var t = "";
            var a = "#TB_inline?height=200&width=500&inlineId=" + tBox;
            var g = false;

            tb_show(t, a, g);
        }

        function HideCommentPopUp() {
            tb_remove();
        }
        
        function ShowNewUserWhy() {
            var tBox = $("div[id$=divNewUserWhy]").attr("id");
            var t = "";
            var a = "#TB_inline?height=140&width=500&inlineId=" + tBox;
            var g = false;

            tb_show(t, a, g);
        }

        function HideNewUserWhy() {
            tb_remove();
        }

        function onCommentChange(ctl) {            
            var hid = jQuery(":hidden[id$=hdComment]");
            hid[0].value = jQuery(ctl).attr("value");       
        }
