/***********************************************************************
*                                                                      *
*               Confidentiality Information:                           *
*                                                                      *
* This module is the confidential and proprietary information of       *
* PeopleSoft, Inc.; it is not to be copied, reproduced, or transmitted *
* in any form, by any means, in whole or in part, nor is it to be used *
* for any purpose other than that for which it is expressly provided   *
* without the written permission of PeopleSoft.                        *
*                                                                      *
* Copyright (c) 1988-2001 PeopleSoft, Inc.  All Rights Reserved.       *
*                                                                      *
************************************************************************/

/* Version 8.4 */

top.name = "HelpWindow";
var chapterlist = new Array(0);


/*****************************************
*          Browser Detection
*****************************************/

var strAgent            = navigator.userAgent.toLowerCase();
var strVersion          = navigator.appVersion.toLowerCase();

var gnVerMajor          = parseInt(strVersion);
var gnVerMinor          = parseFloat(strVersion);

var gbNS                = ((strAgent.indexOf("mozilla") != -1) && ((strAgent.indexOf('spoofer') == -1)
                            && (strAgent.indexOf('compatible') == -1))
                            && gnVerMinor >= 4.7 && gnVerMinor < 5);

var gbNS6               = ((strAgent.indexOf("mozilla") != -1) && ((strAgent.indexOf('spoofer') == -1)
                            && (strAgent.indexOf('compatible') == -1))
                            && gnVerMajor==5);

var gbIE                = (strAgent.indexOf("msie") != -1);

var strBrowser          = "";
var strBorderWidth      = "";
var strFS               = ""; //framespacing
var strNavHeight        = ""; //height of top navigation frame

var synchHref       = "";
var tempSynch = false;

if ( gbNS ) {
        strBrowser      = "ns47";
        strBorderWidth  = " border=3";
        strFS           = "";
        strNavHeight    = "118";
} else if ( gbNS6 ) {
        strBrowser      = "ns6";
        strBorderWidth  = " border=3";
        strFS           = "";
        strNavHeight    = "105";
} else if ( gbIE ) {
        strBrowser      = "ie";
        strBorderWidth  = "";
        strFS           = " framespacing=0";
        strNavHeight    = "105";
}

/****************************************
*          Global Variables
****************************************/

//   layerRef and styleRef should be used for the layer objects for both browser NS and IE.
//  e.g. eval("document" + layerRef + "['xxxx']" + styleRef + ".visibility = 'visible'");

var layerRef = "";
var styleRef = "";

if ( gbNS ) {
        layerRef        = ".layers";
        styleRef        = "";
} else if ( gbIE || gbNS6 ) {
        layerRef        = ".all";
        styleRef        = ".style";
}

var origWidth = 0;
var origHeight = 0;

if ( gbNS ) {
        origWidth = self.innerWidth;
        origHeight = self.innerHeight;
}

var chapterlist = new Array(0);

var strTopHref          = top.location.href.toLowerCase();
strTopHref              = strTopHref.substring(0, strTopHref.indexOf(".htm") + 4);
var strFrameset         = strTopHref.substring(strTopHref.lastIndexOf("/") + 1, strTopHref.length).toLowerCase();
var strThisHref         = this.location.href.toLowerCase();
strThisHref             = strThisHref.substring(0, strThisHref.indexOf(".htm") + 4);
if ( top.location.href.indexOf(".htm") == -1 ) {
    strTopHref = top.location.href.toLowerCase();
    if ( strTopHref.substr(strTopHref.length - 1, 1) != "/" ) {
        strTopHref = strTopHref + "/index.htm";
    }
    strFrameset = "index.htm";
}
if ( this.location.href.indexOf(".htm") == -1 ) {
    strThisHref = this.location.href.toLowerCase();
    if ( strThisHref.substr(strThisHref.length - 1, 1) != "/" ) {
        strThisHref = strThisHref + "/index.htm";
    }
    strFrameset = "index.htm";
}
var strThisFileName     = strThisHref.substring(strThisHref.lastIndexOf("/") + 1, strThisHref.length).toLowerCase();
var strThisFolderPath   = strThisHref.substring(0, strThisHref.lastIndexOf("/")).toLowerCase();
var strThisFolder       = strThisFolderPath.substring(strThisFolderPath.lastIndexOf("/") + 1, strThisFolderPath.length);
var strLangPath         = strThisHref;
var strLang             = "";


var bHelp               = (strThisFileName.toLowerCase() == "f1search.htm");
var bLibrary            = (strThisFileName.toLowerCase() == "index.htm");
var bSearch     = (strThisFileName.toLowerCase() == "advsrch.htm");
var bBookLevel          = (strThisFileName.toLowerCase() == "book.htm" || strThisFileName.toLowerCase() == "chapter.htm");
var bTOC                        = (strThisFileName.toLowerCase() == "tocdata.htm");
var bFileLevel          = (strThisHref.indexOf("/htm/") != -1 );
var bGlobalLevel        = false;
var bLanguageLevel      = false;
var bDocTypeLevel       = false;
var strDocTypeFolder    = "";
var strGblRelPath       = "";
var strLangRelPath      = "";

if ( bHelp ) bGlobalLevel = true;

if ( bLibrary ) {
    if ( strRelPathToRoot == "" ) bGlobalLevel = true;
        if ( strRelPathToRoot == "../" ) bLanguageLevel = true;
        if ( strRelPathToRoot == "../../" ) bDocTypeLevel = true;
}

if ( bDocTypeLevel ) strDocTypeFolder = strThisFolder;
if ( bBookLevel ) {
  if (!gbNS) {
  	var synchMode = true;
  } else {
	var synchMode = false;
  }
  strDocTypeFolder = strThisFolderPath.substring(0, strThisFolderPath.lastIndexOf("/"));
  strDocTypeFolder = strDocTypeFolder.substring(strDocTypeFolder.lastIndexOf("/") + 1, strDocTypeFolder.length);
}

var level;
for ( level = 1; level <= 4  ; level++ ) {

  if ( bGlobalLevel ) break;
  strLangPath = strLangPath.substring(0, strLangPath.lastIndexOf("/")).toLowerCase();
  strGblRelPath = strLangRelPath + "../";
  if ( bLanguageLevel ) break;
  if ( bDocTypeLevel && level == 2 ) break;
  if ( bBookLevel && level == 3 ) break;
  if ( bFileLevel && level == 4 ) break;
  strLangRelPath += "../";

}

strLang = strLangPath.substring(strLangPath.lastIndexOf("/") + 1, strLangPath.length);
//var strCodesetFolder = "iso-8859-1/";
var strCodesetFolder = "utf-8/";
var strUtf = "";
var strIndexCodesetFolder = "";

//if ( strDocType == "la" ) strCodesetFolder = "utf-8/";
//if ( bSearch ) strCodesetFolder = "utf-8/";
//if ( strCodesetFolder == "utf8/" ) strUtf = "_utf8";



/**********************************************
*          PeopleBooks Variables
**********************************************/

var bPrinting           = false;
var oldSetting          = "";
var strPopup            = "";
var strFrameProd        = "";

var bBook               = (strFrameset.toLowerCase() == "book.htm");
var bChapter            = (strFrameset.toLowerCase() == "chapter.htm");
var bThisIsDocFrame     = (bFileLevel && self.location.search=="");
if ( bFileLevel ) {
  //alert("setting tocFlag");
  top.tocFlag = self.location.href;
}
if (bBook || bChapter) {
    var strDocType    = "pb";
        strFrameProd    = strTopHref.substr(0, strTopHref.lastIndexOf("/"));
        strFrameProd    = strFrameProd.substring(strFrameProd.lastIndexOf("/") + 1, strFrameProd.length);
} else if ( bFileLevel ) {
        var strDocType  = "pb";
        strFrameProd    = strTopHref.substr(0, strTopHref.lastIndexOf("/"));
        strFrameProd    = strFrameProd.substring(strFrameProd.lastIndexOf("/") + 1, strFrameProd.length);
        strFrameProd    = strFrameProd.substring(strFrameProd.lastIndexOf("/") + 1, strFrameProd.length);
}


var strTopSearch        = top.location.search;
var strSearchFilePath   = strTopSearch.substring(strTopSearch.indexOf("File=") + 5,  strTopSearch.length);
var strSearchLang       = strSearchFilePath.substr(0, 3).toLowerCase();
var strSearchProd       = strSearchFilePath.substr(4, 2).toLowerCase();

var booknames           = new Array();
var strIdxdFl           = "idxdata.htm";
var popupWindow;
var testWindow;


if (bThisIsDocFrame && top.frames.length > 0 && top.frames[0].location.pathname.indexOf("blank.htm") != -1) {
        if (top.frames[0].givePopup) top.frames[0].givePopup();
        top.frames[0].location.replace(strGblRelPath + "htm/" + strCodesetFolder + "buttons.htm");
} else if (top.length > 0 && bThisIsDocFrame) {
        //alert("frames and this is doc");
        if (top.frames[0].document.NavBar
          && (top.frames[0].location.pathname.indexOf("blank.htm") == -1))
                strPopup = top.frames[0].document.NavBar.graphics.value;
        //alert("done");
}


function mouseUpIE(evt) {
  //alert("mouseup");
  if (top.synchMode) {
    var theLink = window.event.srcElement;
    if (theLink.tagName == "IMG") theLink = theLink.parentElement;
    //var srcTag = theLink.tagName;
    // If user clicked a link...
    if (theLink.tagName == 'A') {
      var href = theLink.href;
    //alert("href=" + href);
      var file = href.substring(href.lastIndexOf('/') + 1, href.indexOf('.htm') + 4);
      if (location.href.indexOf(file) > -1) {
        //href = getValidAnchor(href);
        //alert(href);
        if (parent.frames[1].frames[1]) {
          if (parent.frames[1].frames[1].frames[0]) {
            if (bBook && parent.frames[1].frames[1].frames[0].name == 'synch') {
              //alert('calling highlightAnchor');
              top.tab_frame.frames[1].frames[1].highlightAnchor(href);
              }
          }
        }
      }
    }
    theLink = null;
  }
  return false;
}

function mouseUpNS(evt) {
  //alert(top.synchMode);
  if (top.synchMode) {
    //top.tab_frame.Navigation.tocframe.writeToHighlight("<P>hello</P>");
    //alert("done");
    var href = evt.target.toString();
    //alert(href);
    if ( href != "" && href.indexOf("javascript") == -1
        && href.indexOf("/") != -1 ) {
      var file = href.substring(href.lastIndexOf('/') + 1, href.indexOf('.htm') + 4);
      //alert("file=" + file);
      if (location.href.indexOf(file) != -1) {
        href = getValidAnchor(href);
        //alert("Valid href=" + href);
        if ( top.tab_frame ) {
          //alert("has tab_frame");
          if (top.tab_frame.frames[1].frames[0]) {
            //alert("has tab_frame subframes");
            if (bBook && top.tab_frame.frames[1].frames[0].name == 'synch') {
          //href = href.substring
              //alert('calling highlightAnchor(' + href + ')');
              top.tab_frame.frames[1].frames[1].highlightAnchor(href);
            }
          }
        }
      }
    }
  }
  return true;
}


function mouseUpNS6(evt) {
  //alert("mouseUpNS6");
  if (top.synchMode) {
    //alert(top.synchMode);
    //top.tab_frame.Navigation.tocframe.writeToHighlight("<P>hello</P>");
    //alert(evt);
    //alert(evt.target);
    //alert(evt.target.innerHTML);
    //alert(evt.target.parentNode.tagName);
    //alert(evt.target.parentNode.parentNode.innerHTML);
    //var href = evt.target.toString();
    //alert(href.innerHTML);
    if (evt.target.parentNode && evt.target.parentNode.tagName ) {
      //alert(evt.target.href);
    if (evt.target.tagName.toUpperCase()=="A" && evt.target.href.indexOf("script")==-1 ) {
      //alert("yes again");
    var href = evt.target.href;
    //alert(href);
      var file = href.substring(href.lastIndexOf('/') + 1, href.indexOf('.htm') + 4);
      //alert("file=" + file);
      if (location.href.indexOf(file) != -1) {
        //href = getValidAnchor(href);
        //alert("Valid href=" + href);
        if ( top.tab_frame ) {
          //alert("has tab_frame");
          if (top.tab_frame.frames[1].frames[0]) {
            //alert("has tab_frame subframes");
            if (bBook && top.tab_frame.frames[1].frames[0].name == 'synch') {
          //href = href.substring
              //alert('calling highlightAnchor(' + href + ')');
              top.tab_frame.frames[1].frames[1].highlightAnchor(href);
            }
          }
        }
      }
    }
    }
  }
  return true;
}



function initeventtrap() {
        //document.onmouseover=mouseOver;
        //document.onmouseout=mouseOut;
        if ( gbIE ) {
                document.onmouseup=mouseUpIE;
        } else if ( gbNS ) {
                document.captureEvents(Event.MOUSEUP);
                document.onmouseup=mouseUpNS;
        } else if ( gbNS6 ) {
            document.captureEvents(Event.MOUSEUP);
                  document.onmouseup=mouseUpNS6;
      }
}

if (bThisIsDocFrame) {
        //alert("initializing event trap");
        initeventtrap();
}


//////////////////////////////////////
// Global Functions
//////////////////////////////////////


function CheckPrint() {
  //alert("CheckPrint");
  top.tocFlag = top.doc_frame.location.href;
  if ( top.length > 0 ) {
    if ( top.strDocType != "la" ) {
      if (parent.frames[0].document.NavBar) {
        //if (gbNS6)
        //alert("parent.frames[0].document.NavBar");
        //parent.frames[0].location.reload(true);
        //parent.frames[0].location.replace(strCodesetFolder + "buttons.htm");
        parent.frames[0].location.replace(strGblRelPath + "htm/" + strCodesetFolder + "buttons.htm");
        parent.frames[0].document.NavBar.graphics.value=strPopup;
      } else {
        //parent.frames[0].location.reload(true);
        parent.frames[0].location.replace(strGblRelPath + "htm/" + strCodesetFolder + "buttons.htm");
      }
      if (strPopup.substr(0, 5) == "print") {
        strPopup.substring("Popup test=" + strPopup.length - 5, strPopup.length)
        oldSetting = strPopup.substring(strPopup.length - 5, strPopup.length);
        bPrinting = true;
        if (gbIE || gbNS6) {
          parent.frames[0].document.NavBar.graphics.value=oldSetting;
          strPopup = oldSetting;
          parent.doc_frame.focus();
        }
        parent.doc_frame.print();
        if (gbIE || gbNS6) {
          bPrinting = false;
          parent.doc_frame.location.reload(true);
        }  else
          parent.doc_frame.focus();
      }
      if (parent.frames[0].document.NavBar) top.doc_frame.focus();
    }
    if ( top.tab_frame ) {
      //alert("tab_frame exists");
      if (top.tab_frame.frames[1]) {
      if (top.tab_frame.frames[1].frames[0]) {
        if ( ( ( bBook && top.synchMode ) || top.strDocType == "la")
            && top.tab_frame.frames[1].frames[0].name == 'synch' ) {
          //alert("has synch frame");
          //alert( top.doc_frame.document.referrer );
          //if ( top.doc_frame.document.referrer.indexOf('tocdata.htm') == -1 ){
          //alert(top.tab_frame.frames[1].frames[0].confirmLoaded);
          //if (top.tab_frame.frames[1].frames[0].confirmLoaded) {
          if ( top.gbNS && top.tab_frame.frames[1].frames[0].confirmLoaded) {
            if ( top.doc_frame.document.referrer.indexOf("tocdata.htm")==-1
                || top.tab_frame.frames[1].frames[1].document.layers["HILIGHTLYR"].visibility=="hide" ){
              //alert("calling synchTOC");
              top.tab_frame.frames[1].frames[0].synchTOC(top.doc_frame.location.href);
            }
          } else if ( (top.gbIE || top.gbNS6) && top.tab_frame.frames[1].frames[0].confirmLoaded) {
            synchHref=top.doc_frame.location.href;
            if ( top.doc_frame.document.referrer.indexOf("tocdata.htm")==-1
                || top.tab_frame.frames[1].frames[1].document.getElementById("HILIGHTLYR").style.visibility=="hidden" ){
              //alert("calling synchTOC(" + top.doc_frame.location.href + ")");
              top.tab_frame.frames[1].frames[0].synchTOC(top.doc_frame.location.href);
              //alert("done with call");
              synchHref="";
            }
          }
        }
      }
      }
    }
  }
  //alert("done with CheckPrint");
  return true;
}


function AfterPrint() {
  if ((gbNS) && bPrinting) {
        parent.frames[0].document.NavBar.graphics.value=oldSetting;
        bPrinting = false;
        self.location.reload(true);
  }
  return true;
}


function getValidAnchor(href) {
  //alert("getValidAnchor(" + href + ")");
  var x = 0;
  var y = 0;
  var thisAnchor;
  var bFound = false;
  //var finalHref = href;
  if ( href.indexOf("#") == -1 ) {
    return href;
  } else {
    if ( href.substr(1,1) != "#" ) {
        href = href.substring(href.indexOf("#") + 1, href.length);
    }
      //alert("start of if");
    if ( bBook || top.strDocType == "la" ) {
            //alert("inside if href = " + href);
            var layerAndAnchor = top.tab_frame.Navigation.tocframe.getLayer(href);
            //alert("layer =" + layerAndAnchor);
            finalHref = layerAndAnchor.substring(layerAndAnchor.indexOf("||")
                    + 2, layerAndAnchor.length);
            //alert("got finalHref");
    } else {
        //alert("inside else href =" + href);
        for(y=0; y <= top.doc_frame.document.anchors.length - 1; y++) {
                if ( top.doc_frame.document.anchors[y].name == href ) {
                bFound = true;
                        break;
                }
        }
        if (bFound) {
        bFound = false;
        var finalHref = href;
                var sib = null;
                //var y;
                //bFound = false;
anchorLoop:
                //Find nearest following heading tag to determine heading level
                if ( document.all ) {
                for (y=thisAnchor.sourceIndex + 1; document.all.length - 1; y++) {
                        sib = document.all[y];
                        //alert(sib.outerHTML);
                        if (sib.tagName == 'A' && sib.name.substr(0,1) == 'H') {
                                //alert(sib.outerHTML);
                                //bFound = true;
                                if (sib.name.substr(0,2) == 'H4' || sib.name.substr(0,2) == 'H5') {
                                        //alert(sib.name);
                                        for (x = x - 1; x >= 0; x--) {
                                                if (document.anchors[x].name.substr(0,2) == 'H3') {
                                                        //alert(document.anchors[x].name);
                                                        for(x = x; x >= 0; x--) {
                                                                if (document.anchors[x].name.substr(0,1)!='H' && document.anchors[x].name.substr(0,5)!='F1ID_' && document.anchors[x].name.substr(0,9)!='topofpage') {
                                                                        //alert(document.anchors[x].name);
                                                                        finalHref = self.location.pathname + "#" + document.anchors[x].name;
                                                                        //alert("found parent heading");
                                                                        break anchorLoop;
                                                                }
                                                        }
                                                }
                                        }

                                } else break anchorLoop;
                        }
                }
                }
        }
    }
  }
  //alert("returning " + finalHref);
  return finalHref;

}



function showLinkText(l) {
  if (gbNS) {
        status = l.text;
   } else if (gbIE) {
        status = l.innerText;
  }
  return true;
}


function clearStatus() {
  status ="";
  return true;
}


function reloadFrames() {
  if (gbNS) {
        if (self.innerHeight != origHeight || self.innerWidth != origWidth) {
                origHeight = self.innerHeight;
                origWidth = self.innerWidth;
                if (top.length==0) self.location.reload(true);
                else top.frames['doc_frame'].location.reload(true);
        } else top.location.reload();
  }
  return true;
}

function returnLink(link, popup) {
  top.location.replace(link);
  popup.close();
}


function setCookie(name,value,expires) {
  // Create default expiration date as one year from today
  if (!expires) {
    var expires = new Date ();
    expires.setTime (expires.getTime() + (1000 * 60 * 60 * 24 * 365));
  }
  document.cookie = name + "=" + escape(value) +
  "; expires=" + expires.toGMTString() +
  "; path=/";
}

function getCookie(name) {
  var dcookie = document.cookie;
  var cname = name + "=";
  var clen = dcookie.length;
  var cbegin = 0;
  var vbegin = 0;
  while (cbegin < clen) {
    vbegin = cbegin + cname.length;
    if (dcookie.substring(cbegin, vbegin) == cname) {
      var vend = dcookie.indexOf (";", vbegin);
      if (vend == -1) vend = clen;
      return unescape(dcookie.substring(vbegin, vend));
    }
    cbegin = dcookie.indexOf(" ", cbegin) + 1;
    if (cbegin == 0) break;
  }
  return null;
}

var pdfTest = false;
if (self.location.pathname.indexOf('chapter.htm') != -1 || self.location.pathname.indexOf('book.htm') != -1 || self.location.pathname.indexOf('tocdata.htm') != -1) {
        if (gbIE) {
                document.writeln("<SCRIPT LANGUAGE='VBScript' TYPE='TEXT/VBSCRIPT'>");
                document.writeln("Function IEpdfCheck()");
                document.writeln("On Error Resume Next");
                document.writeln("For i = 1 to 6");
                document.writeln('If (not IsNull(CreateObject("PDF.PdfCtrl." & i))) Then');
                document.writeln("If Err.Number = 0 Then");
                document.writeln("IEpdfCheck = true");
                document.writeln("Exit For");
                document.writeln("Else");
                document.writeln("Err.Clear");
                document.writeln("End If");
                document.writeln("End If");
                document.writeln("Next");
                document.writeln("End Function");
                document.write("</SCRIP");
                document.writeln("T>");
        } else if (gbNS || gbNS6) {
                //alert("in PDF test");
                var pdfTest = navigator.mimeTypes['application/pdf'];
        }
}



function ShowPopup (imgtag, strTitle) {

  // This displays a graphic in a popup window

  var strDimensions = imgtag.substr(imgtag.toUpperCase().indexOf("WIDTH="), imgtag.length).toUpperCase();
  var strWidth = strDimensions.substring(strDimensions.indexOf("WIDTH=") + 6, strDimensions.indexOf(" "));
  var strHeight = strDimensions.substring(strDimensions.indexOf("HEIGHT=") + 7, strDimensions.indexOf(">"));
  var newtag = imgtag;

  //The following code scales down graphics when screen width is less than 1024.  Deactivated.
  /*if (screen.width < 1024) {
        var scale = screen.width / 1024;
  } else {
        var scale = 1;
  }*/

  var strTitle = unescape(strTitle);
  if (strTitle == "") strTitle = "Exhibit";
  newtag = imgtag.substr(0, imgtag.length - 1) + " ALT=\"" + strTitle + "\">";
  var Width = (Number(strWidth));
  //var Height = (Number(strHeight)) * scale;
  var Height = (Number(strHeight));
  if (Width > screen.width * 0.85) {
        Width = screen.width * 0.85;
        Height += 15;
  }
  if (Height > screen.height * 0.85) {
        Height = screen.height * 0.85;
        Width += 15;
  }
  strWidth = (Width + 20).toString();
  strHeight = (Height + 27).toString();
  var strFeatures = "menubar=no,resizable=yes,scrollbars=yes,width=" + strWidth + ",height="
    + strHeight + ",top=20,left=20,titlebar=hello";
  popupWindow=window.open("","popupWindow",strFeatures);
  with (popupWindow) {
  if (gbIE) resizeTo(Number(strWidth) + 32, Number(strHeight) + 35);
  document.close();
  var strTTag = "";
  strTTag = "<TITLE>" + strTitle + "</TITLE>";
  document.write("<HEAD>" + strTTag + "</HEAD><BODY>");
  //document.title=strTitle;
  document.writeln("<P>" + newtag + "</P></BODY>");
  focus();
  }
}


function PopupLogic (imgtag, caption, id) {
  //alert("PopupLogic " + imgtag);
  // This routine controls how graphics appear in the document depending on the Popups parameter
  if (top.length==0) {
        return;
  } else {
  var strInlineBorder = "1";  //Set to "0" to turn off image borders in print and inline format
  if (strPopup.substr(0, 5) == "print") {
        // Show popup graphics inline and scaled to 69%
        if (strLang=="jpn" || strLang=="zhs") caption = unescape(caption);
        if (gbNS) strInlineBorder="0";
        var newtag      = imgtag;
        var strDimensions = imgtag.substring(imgtag.toUpperCase().indexOf("WIDTH="), imgtag.length).toUpperCase();
        var strWidth    = strDimensions.substring(strDimensions.indexOf("WIDTH=") + 6, strDimensions.indexOf(" "));
        var Width       = Number(strWidth);
        var strHeight   = strDimensions.substring(strDimensions.indexOf("HEIGHT=") + 7, strDimensions.indexOf(">"));
        var Height      = Number(strHeight);
        var Scale       = 0.69;

        Height = (Height * Scale);
        Width = (Width * Scale);

        newtag = imgtag.substr(0, imgtag.toUpperCase().indexOf("WIDTH=") + 6) + Width.toString() + " "
          + imgtag.substr(imgtag.indexOf("HEIGHT="), 7) + Height.toString() + " BORDER=" + strInlineBorder
          + " HSPACE=2 VSPACE=0 ALT=\"" + caption + "\">";
        document.write(newtag + "</P><P CLASS=CAPTION ID=" + id + "> " + caption + "</P>");
  } else if (id == "" || strPopup.substring(strPopup.length - 5, strPopup.length) == "large") {
        // Show popup graphics inline
        if (strLang=="jpn" || strLang=="zhs") caption = unescape(caption);
        var newtag = imgtag
        newtag = imgtag.substr(0, imgtag.length - 1) + " BORDER=" + strInlineBorder
          + " HSPACE=2 VSPACE=0 ALT=\"" + caption + "\">";

        //The following section scales inline graphics to fit within the browser window.  Currently deactivated.
        /*
        var strDimensions = imgtag.substring(imgtag.toUpperCase().indexOf("WIDTH="), imgtag.length).toUpperCase();
        var strWidth    = strDimensions.substring(strDimensions.indexOf("WIDTH=") + 6, strDimensions.indexOf(" "));
        var Width       = Number(strWidth);
        var strHeight   = strDimensions.substring(strDimensions.indexOf("HEIGHT=") + 7, strDimensions.indexOf(">"));
        var Height      = Number(strHeight);

        if (gbNS || gbNS6) var frameWidth = top.doc_frame.innerWidth - 40;
          else if (gbIE) var frameWidth = top.doc_frame.document.body.clientWidth - 40;
        if (Width > frameWidth) var Scale = frameWidth / Width;
          else var Scale = 1;
        Height = (Height * Scale);
        Width = (Width * Scale);
        newtag = imgtag.substr(0, imgtag.toUpperCase().indexOf("WIDTH=") + 6) + Width.toString() + " "
          + imgtag.substr(imgtag.indexOf("HEIGHT="), 7) + Height.toString() + " BORDER=" + strInlineBorder + ">";
        */

        if (id == "") document.write(newtag + "</P>");
          else document.write(newtag + "</P><P CLASS=CAPTION ID=" + id + "> " + caption + "</P>");

  } else if (id == "popup" && (bBook || bChapter) && (strLang == "zhs" || strLang == "jpn")) {
        // Show popup graphics as popup icons
        document.write("<A HREF=\"javascript:ShowPopup('" + imgtag + "','" + escape(caption)
          + "')\"><IMG SRC=../../img/panel_icon.gif BORDER=0 ALT=\"" + top.strClickIcon + "\"></A> "
          + unescape(caption) + "</P>");

  } else if (id == "popup" && (bBook || bChapter)) {
        // Show popup graphics as popup icons
        document.write("<A HREF=\"javascript:ShowPopup('" + imgtag + "',escape('" + caption + "')"  
          + ")\"><IMG SRC=../../img/panel_icon.gif BORDER=0 ALT=\"" + top.strClickIcon + "\"></A> "
          + unescape(escape(caption)) + "</P>");

  } else if (parent.length > 1 && document.layers) {
        // Used for Netscape ILAYER customization
        document.write("<A HREF=\"javascript:ShowPopup('" + imgtag + "','" + escape(caption)
          + "')\"><IMG SRC=../../img/panel_icon.gif BORDER=0 ALT=\"" + top.strClickIcon + "\"></A> "
          + unescape(caption) + "</P>");

  } else {
        // Only used for PS writer preview
        document.write("<A HREF=\"javascript:ShowPopup('" + imgtag + "','" + escape(caption)
          + "')\"><IMG SRC=../img/panel_icon.gif BORDER=0></A ALT=\"" + top.strClickIcon + "\"> "
          + unescape(caption) + "</P>");
  }
  return;
  }
}


