parses query results and generates html in colorbox