Changes in main.js

Changed $(document).ready to $(document).on('pageinit', function()