Revert "(function($) {... changed to $(document).ready(function () {..."

This reverts commit ca59ec5bed0ae896b1e316534ffdc96389588405.