You're talking about images in the post showing as thumbnails in the Latest Posts? I've not seen that behavior from a search widget. I thought you were talking about the avatars. As far as I know, the search widget isn't designed to show thumbs.
As far as where to add the javascript, you should create a new product and add it there. Here is a tutorial on the subject.
http://www.vbulletin.com/forum/blogs/joe-d/3932614-
Also, I should have asked, if you are on the VB Cloud, you can't create and install mods or edit templates.