Try this:
Code:
{* $Id: product_images.tpl,v 1.10 2003/08/11 10:45:10 svowl Exp $ *}
{if $images ne ""}
{section name=image loop=$images}
{if $images[image].avail eq "Y"}
{if $images[image].tmbn_url}
[img]{$images[image].tmbn_url}[/img]
{else}
[img]{$xcart_web_dir}/product_image.php?imageid={$images[image].imageid}[/img]
{/if}
{/if}
{/section}
{/if}
The part about the {capture} and dialog.tpl is what is drawing the extra box.