outsourced the javascript for the search