var timer = 0;
$(function () {
    var $main = $("#main");
    function SetBox()
    {
            var mainHeight = $main.height();
            var winHeight = $(window).height();
            if (mainHeight < winHeight) {
                var height = Math.floor((winHeight - mainHeight) / 2);
                $main.css("padding-top", height + "px")
                //$main.animate({ paddingTop: height + "px" }, 200);
            }
            else
            {
                $main.css("padding-top", "0px");
                //$main.animate({ paddingTop:"0px" },200);
            }
    }
    SetBox();
    $main.css("visibility","unset")
    $(window).resize(function () {
        if (timer) {
            clearTimeout(timer);
            timer = 0;
        }
        timer = setTimeout(function () {
            SetBox();
        }, 100);
    });
});


