function Querygsc, target, dis,magrange = magrange, HOURS = hours, $
   VERBOSE=verbose, BOX = box

  compile_opt idl2
  if N_params() LT 2 then begin
       print,'Syntax - info = QueryGSC(targetname_or_coord, dis,'
       print,'                        [/Hours, /Box, /VERBOSE} )'
       print,'   RA (degrees), Dec (degrees) -- search coordinates of center)'
       print,'  dis -- search radius in arcminutes'
       if N_elements(info) GT 0 then return,info else return, -1
  endif
  if N_elements(dis) EQ 0 then dis = 5
    if N_elements(target) EQ 2 then begin
      ra = float(target[0])
      dec = float(target[1])
  endif else begin
       QuerySimbad, target, ra,dec, Found = Found
       if found EQ 0 then message,'Target name ' + target + $
                 ' could not be translated by SIMBAD'
  endelse  
  radius = keyword_set(box)? 'Box' : 'Radius'
  
   radec,ra,dec,hr,mn,sc,deg,dmn,dsc,hours=keyword_set(hours)
   deg = string(deg,'(i3.2)')
   dsn = strmid(deg,0,1)
   deg = strmid(deg,1,2)
   if (dmn lt 0 || dsc lt 0) then begin
       dmn = abs(dmn)
       dsc = abs(dsc)
       dsn = '-'
   endif
   sc = round(sc)
   dsc = round(dsc)
   if dsn EQ ' ' then dsn = '%2B'
  ;;
  QueryURL = "http://gsss.stsci.edu/webservices/vo/CatalogSearch.aspx?" + $
   'RA=' + strtrim(ra,2)  + '&Dec=' + strtrim(dec,2) + $
    '&SR=' + strtrim(dis/60.,2) + $
    '&FORMAT=CSV&CAT=GSC23'

    
  if keyword_set(verbose) then print,queryurl
  ;;  
  Result = webget(QueryURL)
 ;
  t = result.text

  nstar = N_elements(t) -2
  if strmid(t[0],0,5) NE 'Usage' and nstar GT 0 THEN BEGIN
  headers = strsplit(t[1],',',/extract)
  
  info = create_struct(Name='gsc',headers, 0LL,'','','', $
   0.0d,0.0d, 0.0,0.0,0.0, $
     0.0, 0.0, 0, $   ;Fpgmag,Err,code
   0.0, 0.0, 0, $   ;Jpgmag,Err,code
    0.0, 0.0, 0, $   ;Vmag,Err,code
       0.0, 0.0, 0, $   ;Nmag,Err,code 
  0.0, 0.0, 0, $   ;Umag,Err,code
    0.0, 0.0, 0, $   ;Bmag,Err,code
  0.0, 0.0, 0, $   ;Rmag,Err,code
    0.0, 0.0, 0, $   ;Imag,Err,code
  0.0, 0.0, 0, $   ;Jmag,Err,code
   0.0, 0.0, 0, $   ;Hmag,Err,code
   0.0, 0.0, 0, $   ;Kmag,Err,code
   0,  $   ;Classification 
   0.,  $   ;Size
   0., 0., 0LL, $   eccentricity, positionangle, objectflags
   0, 0 , $ ;variable, Multiple flag
   0LL, '' )
 


  info = replicate(info,nstar)

  for i=0,nstar-1 do begin
      temp = strtrim(strsplit(t[i+2],',',/extract),2)
       for j=0,N_elements(temp)-1 do begin 
       info[i].(j) = temp[j]      
       endfor
  endfor
   ENDIF ELSE BEGIN 
      message, 'No objects returned by server. The server answered:', /info
      print, Result.Text
      if N_elements(info) GT 0 then return, info else return, -1
  ENDELSE 
  if keyword_set(hours) then info.ra = info.ra/15.0d 
 return,info
END