function initCommentWindow() {
    $('.comment_class:gt(2)').css('display', 'none');
    //$('.comment_class').appendTo($('.content_comments .comment_container'));

    $('.content_comments .comment_container').append($('.comment_class').clone());

    $('.show_comments').click(function() {
       $('.content_comments').css('display', 'inline-block');
       $('.content_comments .comment_container').css('display', 'block');
       $('.content_comments .comment_container .comment_class').css('display', 'block');

       $('.close_comments').click(function() {
            $('.content_comments').css('display', 'none');
       });
    });

    document.getElementById('text').onkeyup = function()
    {
        var limitField = document.getElementById('text');
        var limitNum = 1000;
        var limitCount = document.getElementById('chars_left');

        if (limitField.value.length > limitNum) {
            limitField.value = limitField.value.substring(0, limitNum);
	}
        else {
            limitCount.innerHTML = limitNum - limitField.value.length;
	}
    }
};

$(document).ready(function() {
    var s = getSize();

    if (s[1] > 570) {
        initCommentWindow();
    }
    else {
        $('.show_comments').css('display', 'none');
    }
});

