(function($){
    "use strict";

    if(window.iFrameResize)
    {
        var $iframe = $('iframe#awesome_live_chat_frame');
        var iframeWidth = $iframe.width();
        $iframe.css('visibility', 'hidden').iFrameResize({
            sizeWidth: true,
            resizedCallback : function (data){
                if(data.type == 'init') return false;
                if(data.height > 100) return false;
                $iframe.css('width', iframeWidth + 32);
            }
        });

        $iframe.on('load', function(){
            $iframe.css('visibility', 'visible');
        });
    }

})(jQuery);