<!--

//***********************************************************************************
//***********************************************************************************
// This script contains the code that creates the Show Contents / Hide Contents
// button that appears at the top of each generated HTML page.
//***********************************************************************************
//***********************************************************************************


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";
   }

if (isPagePosition == null)
   {
   var isPagePosition;
   }


fileURL="../" + isFileDirectoryName + "/" + htmlFileName;
frameURL="../framesets/" + htmlFrameName;


function frameLoad()
 {
 if (window.parent.BODY == null)
    {
    window.parent.location.href = frameURL;
    }
 else
    {
    window.parent.location.href = fileURL;
    }
 }


// Use this button code if this document is in a frameset

if (window.parent.BODY != null)
   {
   if (isPagePosition == "top")
      {
      isShowHide = "<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>" ;
      }
   else if (isPagePosition == "bottom")
      {
      isShowHide = "<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>" ;      
      }
   else
      {
      isShowHide = "<a href='" +
                "javascript:frameLoad()" +
                "' onMouseOver= " +
                "'document.images.show3.src=imageShow4.src' " +
                "onMouseOut= " +
                "'document.images.show3.src=imageShow3.src'>" +
                "<img src='../support/hidecontents.gif' " +
                "border='0' name='show3'></a>" ;      
      }
   }

// Use this button code if this document is NOT in a frameset

else {

   if (isPagePosition == "top")
      {
      isShowHide = "<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>" ;
      }
   else if (isPagePosition == "bottom")
      {
      isShowHide = "<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>" ;
      }
   else
      {
      isShowHide = "<a href='" +
                frameURL +
                "' onMouseOver= " +
                "'document.images.show6.src=imageShow2.src' " +
                "onMouseOut= " +
                "'document.images.show6.src=imageShow1.src'>" +
                "<img src='../support/showcontents.gif' " +
                "border='0' name='show6'></a>" ;
      }
   }

document.write(isShowHide);

//-->
