basepage: backtrack up the DOM from the first image to insert ajax results

The previous approach was to use a series of table cell offsets, which results in undefined
behaviour depending on the implementation of the DOM.  Instead, search for the first <img>
tag that is contained by a <div> and then backtrack upwards to the <div> in order to find the
proper insertion point.

Tested-on: IE 6, IE 10, Chrome, Firefox, Opera 12.
Signed-off-by: William Pitcock <kaniini@dereferenced.org>.
Merge pull request #1 from kaniini/ajax-hook-robustness-fix

basepage: backtrack up the DOM from the first image to insert ajax results

What browsers were you having issues with? or is this a best practice type thing?

if you can't tell, I'm not a UI dev :)