Clean up javascript for search page