	program orb6notes
c
c	Program to reformat notes file for web. Header info
c	and links are added to convert output to html file.
c
c       2006 09 26 - modify to accept new WDS notes file
c
	character*1 junk,ref2
	character*7 ref1
	character*10 wds
	character*85 note
	character*130 header
c
c	open(10,file='/home/wih/WDS/wdsnot.memo',
c     $     status='UNKNOWN')
	open(10,file='/data/wds/wds/wds/wdsnot.memo',
     $     status='UNKNOWN')
	open(11,file='orb6notes.header',status='UNKNOWN')
	open(12,file='orb6notes.html',status='UNKNOWN')
	open(13,file='orb6notes.body',status='UNKNOWN')
	open(14,file='orb6notes.txt',status='UNKNOWN')
c
c	read header lines from notes catalog
c
	do 200 n=1,2
  200	read(10,901) junk
  901	format(a1)
c
c       write header for txt file
c
        write(14,915)
  915   format('Sixth Catalog of Orbits of Visual Binary Stars: Notes'/)
c
c	write header lines for orb6notes.body
c
	write(13,902)
  902	format('<html>'/'<target="_top">'/'<body bgcolor="white"',
     $     ' text="black" link="blue" vlink="#0066CC">'/
     $     '<base target="_parent">'/'<h4>'/'<pre>')
c
c	read and write header lines for html file
c
  300	read(11,903,end=500) header
  903	format(a130)
  	write(12,903) header
	go to 300
c
c	read star name, note, and reference. Add links if name or ref isn't blank
c
  500	read(10,904,end=700) wds,note,ref1,ref2
  904	format(a10,a85,a7,a1)
c
c	write line for orb6notes.html (noframes version)
c
        if (ref1 .eq. '.       ') ref1='        '
c
	if ((wds .eq. '          ') .and. (ref1 .eq. '        '))
     $     write(12,905) note
  905	format(12x,a85,'        ')
c
	if ((wds .eq. '          ') .and. (ref1 .ne. '        '))
     $     write(12,906) note,ref1,ref2,ref1,ref2
  906	format(12x,a85,'<a href="wdsref.html#',a7,a1,'">',a7,a1,'</a>')
c
	if ((wds .ne. '          ') .and. (ref1 .eq. '        '))
     $     write(12,907) wds,wds,note
  907	format('<a name = "',a10,'">',a10,'</a>  ',a85,'        ')
c
	if ((wds .ne. '          ') .and. (ref1 .ne. '        '))
     $     write(12,908) wds,wds,note,ref1,ref2,ref1,ref2
  908	format('<a name = "',a10,'">',a10,'</a>  ',a85,
     $     '<a href="wdsref.html#',a7,a1,'">',a7,a1,'</a>')
c
c	write line for orb6notes.body (frames version) and orb6notes.txt
c
	if ((wds .eq. '          ') .and. (ref1 .eq. '        '))
     $     write(13,905) note
	if ((wds .eq. '          ') .and. (ref1 .eq. '        '))
     $     write(14,905) note
c
	if ((wds .eq. '          ') .and. (ref1 .ne. '        ') .and. 
     $     (ref2 .ne. '        '))
     $     write(13,909) note,ref1,ref2,ref1,ref2
  909	format(12x,a85,'<a href="javascript:nref(''',a7,a1,''')">',
     $     a7,a1,'</a>')
	if ((wds .eq. '          ') .and. (ref1 .ne. '        ') .and. 
     $     (ref2 .ne. '        '))
     $     write(14,916) note,ref1,ref2
  916	format(12x,a85,a7,a1)
c
	if ((wds .eq. '          ') .and. (ref1 .ne. '        ') .and. 
     $     (ref2 .eq. '        '))
     $     write(13,910) note,ref1,ref1
  910	format(12x,a85,'<a href="javascript:nref(''',a7,''')">',a7,
     $     ' </a>')
	if ((wds .eq. '          ') .and. (ref1 .ne. '        ') .and. 
     $     (ref2 .eq. '        '))
     $     write(14,917) note,ref1
  917	format(12x,a85,a7,' ')
c
	if ((wds .ne. '          ') .and. (ref1 .eq. '        '))
     $     write(13,907) wds,wds,note
	if ((wds .ne. '          ') .and. (ref1 .eq. '        '))
     $     write(14,918) wds,note
  918   format(a10,2x,a85,'        ')
c
	if ((wds .ne. '          ') .and. (ref1 .ne. '        ') .and. 
     $     (ref2 .ne. '        '))
     $     write(13,911) wds,wds,note,ref1,ref2,ref1,ref2
  911	format('<a name = "',a10,'">',a10,'</a>  ',a85,
     $     '<a href="javascript:nref(''',a7,a1,''')">',a7,a1,'</a>')
	if ((wds .ne. '          ') .and. (ref1 .ne. '        ') .and. 
     $     (ref2 .ne. '        '))
     $     write(14,919) wds,note,ref1,ref2
  919	format(a10,2x,a85,a7,a1)
c
	if ((wds .ne. '          ') .and. (ref1 .ne. '        ') .and. 
     $     (ref2 .eq. '        '))
     $     write(13,912) wds,wds,note,ref1,ref1
  912	format('<a name = "',a10,'">',a10,'</a>  ',a85,
     $     '<a href="javascript:nref(''',a7,''')">',a7,' </a>')
	if ((wds .ne. '          ') .and. (ref1 .ne. '        ') .and. 
     $     (ref2 .eq. '        '))
     $     write(14,920) wds,note,ref1
  920	format(a10,2x,a85,a7,' ')
c
	go to 500
c
  700	write(12,913)
  913	format('</pre>')
     	write(13,914)
  914	format('</pre>'/'</html>')
c
  999	stop
	end
