/*===============================================================
MANUAL
-----------------------------------------------------------------
NAME
@(#) mrhs59_utils.js - old utility functions for MRHS59 Web site

SYNOPSIS
     Place this code at the top of the BODY section  of  the  Web
     page on  which  you   want   to   make   use   of   any   of 
     the  functions contained in this file:

          <SCRIPT TYPE="text/javascript"
                   SRC="[path/]mrhs59_utils.js">
          </SCRIPT>

     Invoke the desired function as follows:

          <SCRIPT>function(args)</SCRIPT>

     Any output from  the  function  will  replace  the  function 
     invocation on the HTML page.

NOTE ON THE SRC ATTRIBUTE
     When the SRC attribute is  used with the <SCRIPT> tag, it is
     exactly as  if the contents  of the file specified  with the
     SRC  attribute  had been  placed  between  the <SCRIPT>  and
     </SCRIPT>  tags. Any code  actually appearing  between these
     two tags will be ignored.

     This means, specifically, that  it is NOT possible to invoke
     a function between these two tags.

DESCRIPTION    
     This  file contains  utility functions  for the  Mount Royal
     High School Class of 59  Web site. Each function has its own
     self-contained documentation.

     ************************************************************
     * This  is the  original utility  file of  the  MRHS59 web *
     * site.  It has been retained for backwards compatibility. *
     * There are  a number  of HTML files  in the  Classes sub- *
     * directory  which call  the  function 'set_title()',  and *
     * 'crash_course.html'   uses   both   that  function   and *
     * 'get_browser()'.  The email functions have been moved to *
     * 'spoofutils.js', where they belong.                      *
     *                                                          *
     * THERE IS NOTHING IN  'mrhs59_utils.js' WHICH IS NOT ALSO *
     * AVAILABLE  IN THE  NEW UTILITIES  FILE, 'mrhs59utils.js' *
     * (without the underscore).                               *
     *                                                          *
     * The long-term aim is to  phase this file out.  But there *
     * is no hurry.   Everything works as is.  It's  just a bit *
     * messy having  two files with almost the  same name doing *
     * the same job.  See  the 'mrhs59utils.js' MANUAL for more *
     * information.                                             *
     ************************************************************

AUTHOR
     Donald MacLean          IGdonaldNOatREmacCAleansPIdotTAnetLS
                                      (Do what the capitals say.)
VERSION
@(#)  mrhs59_utils.js  vers 3.0.1  2006 04 13

End MANUAL
===============================================================*/


/*=============================================================*/
function set_title(str)
/*---------------------------------------------------------------
NAME
     set_title() - put "(LOCAL)", etc in title of disk file

DESCRIPTION
     When we are viewing a  local (disk) version of an HTML file,
     this function will  prepend "(C:)", etc, to the  title if it
     can  figure out  the name  of  the disk.  Otherwise it  will
     default to  "(LOCAL)".  Nothing will be prepended  if we are
     viewing the file over the Web.

     This is so that if we have a remote and a local version open
     at  the same time,  we can  distinguish easily  between them
     especially when they are iconized (or "minimized").

     In addition,  the intrusive browser  name will be  pushed to
     the right on the Title Bar.
---------------------------------------------------------------*/
{
  var title = str;

  if ( /http:\/\/.*/.test(window.location.href) ) {
    /*-------------------
    Web file. Do nothing.
    -------------------*/
    ;
  } else if ( /file:\/\/\/.*/.test(window.location.href) ) {
    /* 
     *  Local file. Prepend disk name to Title
     */
    title = "("   + window.location.href.substring(8,10) 
          + ") "  + title;
  } else  {
    /*-------------------------
    Can't figure out disk name.
    -------------------------*/ 
    title = "(LOCAL) " + title;
  }
  /*---------------------------------------
  Push intrusive browser name to the right.
  ---------------------------------------*/
  title +=
    "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
  + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
  + "(&nbsp;-&nbsp;:&nbsp;)";

  document.write("<TITLE>" + title + "</TITLE>");
}
/* End function 'set_title()' */
/*=============================================================*/


/*=============================================================*/
function get_browser()
/*---------------------------------------------------------------
NAME
     get_browser() - return name of user's browser

DESCRIPTION
     This function will replace it's invocation with the name  of
     the browser that the user is reading the invoking page with.
---------------------------------------------------------------*/
{
  var browser = new Object();
  browser.name = navigator.appName;
  if (browser.name.substring(0,9) == "Microsoft") {
    browser.name = browser.name.substring(10,100);
  }
  document.write(browser.name);
}

/* End function 'get_browser()' */
/*=============================================================*/


/*==================
Local Variables:
indent-tabs-mode:nil
fill-column:65
fill-prefix:"     "
End:
==================*/

