pro drawgrid,image,spacing,COLOR=color
;
; Draws a grid on a window
;
; INPUTS
; image		ARR	Array for drawing grid on (already in window)
; spacing	INT	The space (pixels) between grid lines
;
; KEYWORDS
; COLOR		Set to the color number. Default is 200
;
;-

sz=SIZE(image)
nx1=sz(1)
nx2=sz(2)

ngr1=nx1/spacing 
ngr2=nx2/spacing
IF keyword_set(COLOR) THEN clr = color ELSE clr = 200
IF clr LT 0 THEN clr=0

FOR i=1,ngr2 DO plots,[0,nx1],[i*spacing,i*spacing],color=clr,/device

FOR i=1,ngr1 DO plots,[i*spacing,i*spacing],[0,nx2],color=clr,/device

end
