pro cursor_4x6hr,time,x,y,hours=hours,string=string

bell = string(byte(7))
ring_bell = 0

;       use cursor to get the position 
again:
cursor,x,y,/down,/normal
;print,x,y

;   scale x and y for just plot window
x = (x - !x.window(0))/(!x.window(1) - !x.window(0))
;;y = (y - !y.window(0))/(!y.window(1) - !y.window(0))

;       if outside allowed limits, then ring bell
ring_bell = 1
if   (x lt 0.00  or x gt 1.00) $            ;left and right limits
  or (y lt 0.03  or y gt 0.98) $            ;top and bottom
  or (y gt 0.23 and y lt 0.28) $            ;gap strip 4 - 3
  or (y gt 0.48 and y lt 0.53) $            ;gap strip 3 - 2
  or (y gt 0.73 and y lt 0.78) then ring_bell = 0   ;gap strip 2 - 1

if ring_bell then print,bell,format='(a,$)' $
else goto, again


time = long((x*6.+ fix((1.0-y)/0.25)*6.)*3600)
;;print,'Time = ',time

hh = fix(time/3600L)
mm = (time - hh*3600L)/60L
ss = time - hh*3600L - mm*60L
tstring = string(hh,mm,ss,format='(i2.2,1h:,i2.2,1h:,i2.2)')

;   HOURS keyword converts to hours
if keyword_set(hours) then time = time/3600.

;   STRING keyword gives a string of format hh:mm:ss
if keyword_set(string) then time = tstring

print,'Selected time:  ',tstring
;;print,'Time = ',time

return
end