//  trailer.js - puts a standard "footer" on my web pages, consisting of links
//  to my link library, to my home page, and for sending me e-mail; also the
//  URL of the page and when it was last modified.
//
////////////////////////////////////////////////////////////////////////////////

rootdir = "/chapman/"
icondir = rootdir+"pix/btn/"

function icon(src,alt)	// wrap an icon in an <IMG> tag along w/ alternate text
  {
    return '<IMG SRC="'+icondir+src+'" ALIGN=MIDDLE ALT="'+alt+'">'
  }
function address(string)	// Wrap a string in <ADDRESS> tags
  {
    return "<ADDRESS>"+string+"</ADDRESS>"
  }
with (document)
  {
    var ref = icon("lib.gif","Go to")+" Ralph's link library"
    writeln(ref.link(rootdir+"links.html"))

    writeln("\n<BR>\n")

    ref = icon("home.gif","Go to")+" Ralph's home page"
    writeln(ref.link(rootdir+"index.html"))

    writeln("\n<BR>\n")

    ref = icon("mail.gif","Send mail to") + " Chapman (at) SVS.Com"
    ref = address(ref)
    writeln("<A HREF=\"mailto:*?subject="+document.URL+"\" onclick=\"mailToMe(this)\">")
    writeln(ref)
    writeln("</A>")

    writeln("\n<BR>\n")

    writeln(address(URL))

    //  Add the modification date, if available

    var c = Date.parse(new Date())
    var m = Date.parse(lastModified)

    // If m==0, the lastModified date was not transmitted by the server.
    // If m>=c, the browser has set lastModified to the current date/time.

    if (m != 0 && m < c)
	writeln(("Last modified "+lastModified).small())
  }
function mailToMe(link)
  {
    var i = link.href.indexOf('*')
    if( i>0 )
      {
	var at = "@"
	link.href = link.href.substring(0,i)+
	    "Chapman"+at+"SVS.Com"+
	    link.href.substring(i+1)
      }
    return true
  }

////////////////////////////////////////////////////////////////////////////////
