changed the javascript to load only on logged in pages