javascript should be wrapped in document#ready