extracted document.ready in page.js