diff --git a/node_images.module b/node_images.module
index b664f20..1a92e5a 100644
--- a/node_images.module
+++ b/node_images.module
@@ -573,9 +573,10 @@ function theme_node_images_view($node, $teaser, $page, $format = NULL) {
       $height = 315;
     }
 
+    $pars = array('width' => $width, 'height' => $height, 'thumb' => $thumb, 'desc' => $description);
+
     if ($format == 'thumbs') {
-      $output .= '<a href="javascript:void(0);" title="'.$description.'" onclick="window.open(\''.
-        file_create_url($image->filepath).'\', \'\', \'height='.$height.',width='.$width.'\');">'.$thumb.'</a> ';
+      $output .= theme('node_images_thumb', $node, $image, $pars);
     }
     else {
       $output .= $fullsize.' ';
@@ -585,6 +586,11 @@ function theme_node_images_view($node, $teaser, $page, $format = NULL) {
   return $output;
 }
 
+function theme_node_images_thumb(&$node, &$image, &$pars) {
+  return '<a href="javascript:void(0);" title="'. $pars['desc'] .
+    '" onclick="window.open(\''. file_create_url($image->filepath) .'\', \'\', \'height='.
+    $pars['height'] .',width='. $pars['width'] .'\');">'. $pars['thumb'] .'</a> ';
+}
 
 /************************************************************
  * Gallery functions
@@ -883,4 +889,4 @@ function node_images_views_tables() {
  */
 function node_images_views_pre_query() {
   require_once './'. drupal_get_path('module', 'node_images') .'/node_images.views.inc';
-}
\ No newline at end of file
+}
