<!--

//***********************************************************************************
//***********************************************************************************
// This script contains the code that creates the Show Contents / Hide Contents
// button that appears at the top of each generated HTML page.
// 
// This script also creates the HTML code for the first para in the document, which 
// correctly identifies the starting point for the running text to make room for the 
// branding info (if the document file is being displayed standalone).
//***********************************************************************************
//***********************************************************************************


var htmlFileName;
var htmlFrameName;
var fileURL;
var frameURL;
var isShowHide;

imageShow1 = new Image();
imageShow2 = new Image();
imageShow1.src = "../support/showcontents.gif";
imageShow2.src = "../support/showcontents.glow.gif";

imageShow3 = new Image();
imageShow4 = new Image();
imageShow3.src = "../support/hidecontents.gif";
imageShow4.src = "../support/hidecontents.glow.gif";

htmlFileName = window.location.pathname.match(/[\w-]+.htm[l]?$/);
htmlFrameName = htmlFileName.toString().replace(/(\.)/,"\.fs\.");

// The variable isFileDirectoryName can be set by a separate script in the HTML file itself.
// This allows for non-generated HTML files that are not installed to the books directory
// to use this script. 

if (isFileDirectoryName == null)
   {
   var isFileDirectoryName;
   isFileDirectoryName = "books";
   }


fileURL="../" + isFileDirectoryName + "/" + htmlFileName;
frameURL="../framesets/" + htmlFrameName;


function frameLoad()
 {
 if (window.parent.BODY == null)
    {
    window.parent.location.href = frameURL;
    }
 else
    {
    window.parent.location.href = fileURL;
    }
 }


// This button code is for use when this document is in a frameset

if (window.parent.BODY != null)
   {
      isShowHideButtonTop = "<a href='" +
                "javascript:frameLoad()" +
                "' onMouseOver= " +
                "'document.images.show1.src=imageShow4.src' " +
                "onMouseOut= " +
                "'document.images.show1.src=imageShow3.src'>" +
                "<img src='../support/hidecontents.gif' " +
                "border='0' name='show1'></a>" ;

      isShowHideButtonBottom = "<a href='" +
                "javascript:frameLoad()" +
                "' onMouseOver= " +
                "'document.images.show2.src=imageShow4.src' " +
                "onMouseOut= " +
                "'document.images.show2.src=imageShow3.src'>" +
                "<img src='../support/hidecontents.gif' " +
                "border='0' name='show2'></a>" ;      
   }

// This button code is for use when this document is NOT in a frameset

else 
   {
      isShowHideButtonTop = "<a href='" +
                frameURL +
                "' onMouseOver= " +
                "'document.images.show4.src=imageShow2.src' " +
                "onMouseOut= " +
                "'document.images.show4.src=imageShow1.src'>" +
                "<img src='../support/showcontents.gif' " +
                "border='0' name='show4'></a>" ;

      isShowHideButtonBottom = "<a href='" +
                frameURL +
                "' onMouseOver= " +
                "'document.images.show5.src=imageShow2.src' " +
                "onMouseOut= " +
                "'document.images.show5.src=imageShow1.src'>" +
                "<img src='../support/showcontents.gif' " +
                "border='0' name='show5'></a>" ;
   }



// This first para code is for use when this document is in a frameset

if (window.parent.BODY != null)
   {
      isShowHideFirstParaInDocument =
                "<p class='startcontentinframeset'>&nbsp;</p>";
   }

// This first para code is for use when this document is NOT in a frameset

else 
   {
      isShowHideFirstParaInDocument =
                "<p class='startcontentstandalone'>&nbsp;</p>";
   }


//-->
