fixing a bug in the thumbnail js for firefox and IE