/*****************************************************************************
* 
* File:        toc2.js
*
* Date:        12/30/02 02:25 PM  
*
* Title:       Table of Contents Class
*
* Description: Page selection bar which changes state on mouseover and sets
*              a specific state on page select.  Designed to operate within
*              a multi-frame display.  This class is loaded into the frameset
*              page, the selection bar is loaded into one page and the page
*              selected is loaded into the remaining page.
*
* Example:     ------------------------------------
*              | Page0image Page1image Page2image |
*              |----------------------------------|
*              |             Selected             |        
*              |               Page               |
*              |              Window              |
*              ------------------------------------
*
*              Pageximage is a link image specifying the Selected Page Window
*              as the TARGET.  Each page indicator image consists of three
*              state images.  The default image which is displayed on page
*              load and ONMOUSEOUT, the ONMOUSEOVER image, and the Page 
*              Selected image.
*
*              Page indicator images have the following name construction:
*
*                <Name><PageID><Suffix>.<Extension>
*
*              where:
*
*                Name      = Selection Bar Name
*                PageID    = Page Selection Identifier
*                Suffix    = Default/MouseOver/Selected Suffix
*                Extension = Image File Extension (gif,jpg,etc)
*
* Properties:  Name     - Name Prefix of all Images and IMG Tags
*              Document - Document Object Containing Selection Bar
*              TOCItem  - TOC Item Images Object List
*              PageID   - Selected Page ID (Default = 0)
*
* Public:      TOC           - Constructor, Called by Frameset Page
*              TOC_Setup     - Initialization, Called by Selection Bar Page
*              TOC_MouseOver - Display MouseOver Image for Selection
*              TOC_MouseOut  - Display Default Image for Selection
*              TOC_Click     - Display Default Image for Current Page
*              TOC_Select    - Display Selected Image for Selection
*
* Synopsis:    Frameset Page --
*
*                <HEAD><TITLE>...</TITLE>
*                <SCRIPT SRC="toc.js"></SCRIPT>
*                <SCRIPT>
*                Object = new TOC();
*                </SCRIPT>
*                </HEAD>
*                <FRAMESET ...>
*                <FRAME NAME="<SelBarWinName>" ...>
*                <FRAME NAME="<PageWinName>" ...>
*                </FRAMESET>
*                
*              Selection Bar Page --
*
*                <HEAD><TITLE>...</TITLE>
*                <SCRIPT LANGUAGE="javascript">
*                parent.Object.Setup(<Document>,<Path>,<Name>,<Extension>,
*                                    <Selections>,
*                                    <DefaultSuffix>,
*                                    <MouseOverSuffix>,
*                                    <SelectedSuffix>);
*                </SCRIPT>
*                <BODY>
*                <A        HREF="<Page0HREF>" 
*                        TARGET="<PageWinName>"
*                   ONMOUSEOVER="parent.Object.MouseOver(0)"
*                    ONMOUSEOUT="parent.Object.MouseOut(0)"
*                       ONCLICK="parent.Object.Click(0)">
*                <IMG NAME="<Name>0" 
*                      SRC="<Name>0<DefaultSuffix>.<Extension>">
*                </A>
*                <A        HREF="<Page1HREF>" 
*                        TARGET="<PageWinName>"
*                   ONMOUSEOVER="parent.Object.MouseOver(1)"
*                    ONMOUSEOUT="parent.Object.MouseOut(1)"
*                       ONCLICK="parent.Object.Click(1)">
*                <IMG NAME="<Name>1" 
*                      SRC="<Name>1<DefaultSuffix>.<Extension>">
*                </A>
*                :
*                </BODY>
*
*              Seleted Pages --
*
*                <HEAD><TITLE>...</TITLE></HEAD>
*                <BODY ONLOAD="parent.Object.Select(<PageID>)">
*                :
*                </BODY>
*
*    where:    SelBarWinName   - Selection Bar Window Name
*              PageWinName     - Page Window Name
*              Document        - Document Object of Selection Bar
*              Path            - Image File Path
*              Name            - TOC Images Name Prefix
*              Selections      - Number of Selections in Selection Bar
*              DefaultSuffix   - Default/MouseOut Image Name Suffix
*              MouseOverSuffix - MouseOver Image Name Suffix
*              SelectedSuffix  - Selected Page Image Suffix
*              PagexHREF       - Select Page HREF
*              Extension       - Image File Suffix (gif,jpg,etc)
*
* Developers:  SMT  Steve Thames
*
* History:     12/06/98  SMT  Created.
*
*****************************************************************************/

/*****************************************************************************
* Class:       TOC
*
* Description: Create instance of TOC object.  Called from Frameset page.
*****************************************************************************/
function TOC()
  {
  this.Items = new Array();
  }

/*****************************************************************************
* Method:      TOC.Setup
*
* Parameters:  Document    - Document Containing TOC
*              Default     - Default Class Name
*              Selected    - Selected Class Name
*              arguments[] - TOC Page Element IDs
*
* Description: Initialize document object of TOC instance and load images.
*              Called by Selection Bar page.
*****************************************************************************/
TOC.prototype.Setup = function(Document,Default,Selected)
  {
  this.document      = Document;
  this.defaultClass  = Default;
  this.selectedClass = Selected;

  for (i=3; i<arguments.length; i++)
    {
    this.Items.push(arguments[i]);
    }
  }

/*****************************************************************************
* Method:      TOC.Select
*
* Parameters:  PageID - Page Selection ID
*
* Description: Sets the current page ID to PageID and displays the Selected
*              image for the current page.  Called by ONLOAD event of page
*              selected.
*****************************************************************************/
TOC.prototype.Select = function(PageID)
  {
  this.SelectedPage = PageID;

  if (!this.document)
    return;

  if (this.SelectedItem)
    this.SelectedItem.className = this.defaultClass;

  this.SelectedItem = this.document.getElementById(this.Items[PageID]);

  this.SelectedItem.className = this.selectedClass;
  }

/*****************************************************************************
* Method:      TOC.SetCurrent
*
* Parameters:  none
*
* Description: Displays the selected page image for the current page ID in 
*              page selection bar.  Called by the ONLOAD event in the page
*              selection bar page to set the appropriate image on a back or 
*              forward operation.
*****************************************************************************/
TOC.prototype.SetCurrent = function()
  {
  if (this.SelectedPage != undefined)
    this.Select(this.SelectedPage);
  }


