$(function() {
    if ($.support.pjax) {
        $.pjax.defaults.maxCacheLength = 0;
        var container = $('#comment');
        $(document).on('click', '#pagination li a', function(event) {
            $.pjax.click(event, {
                container: container,
                timeout: 6000,
                fragment: '#comment',
                show: 'fade',
                cache: false,
                storage: true
            });
        });
        $(document).on('submit','form.tjform,button.tjbtn',function(event) {
            $.pjax.submit(event,{
                container: container,
                timeout: 6000,
                fragment: '#comment',
                show: 'fade',
                cache: false,
                storage: true,
                scrollTo: false
            });
        });

        $(document).on('pjax:start', function() {
            $( document ).trigger( "pjaxStart" );
        });
        // fix js
        $(document).on('pjax:end', function(event) {
            $( document ).trigger( "pjaxEnd" );
            $("img.img-responsive").lazyload({
                effect : "fadeIn",
                threshold : 200
            });
        });
    }
});