subr lpthumb_entry_cb
 ;displays selected image
 ;;ty, $list_item_position
 i = $list_item_position - 1
 ;construct the path for the thumbnail image
 j = $lp_hour_items(0,i)
 path = $lp_paths(j) + '/images/'
 inx = $lp_hour_items(1,i)
 name = fns('im######.jpg', inx)
 fname = path + name
 win = $current_window
 if dataread(x, fname) eq 1 then {
  if $view_scaletype(win) eq 4 then $view_scaletype(win) = 2
  switch,x,eval('$data'+istring(win, 1))
  ;do we want a despike ?
  if $viewdespikeflag(win) then viewdespike, win
  $view_tai(win) = $lp_hour_times(i)
  $view_data_type(win) = 2
  equate, eval('$view_items_'+string(win)), $lp_hour_items(*,i)
  view, win
  xmtextsetstring, $view_text_widget(win), -
 	wavestring(i, 1,$lp_hour_items,$lp_hour_times)
  } else {
   if filesize(fname) lt 0 then sq = '\nfile doesn''t exist' else sq =''
   errormess, 'La Palma image not found'+sq
  }
 endsubr
 ;========================================================
