/////////////////////////////////////////////////////////////////////////////
// RoboHELP® WebHelp 4 Dynamic HTML Effects Script
// Copyright © 1998-2000 eHelp Corporation.  All rights reserved.

// Version= 4.40

// Warning:  Do not modify this file.  It is generated by RoboHELP® and changes will be overwritten.

//{{WH3_SYMBOL_SECTION
var gstrNavFrmst = "navpane1.htm";
var gstrTocDhtml = "tocdhtml.htm";
var gstrIdxDhtml = "idxdhtml.htm";
var gstrFtsDhtml = "ftsdhtml.htm";
var gstrIniDhtml = "tocdhtml.htm";
var gstrBlankhtml = "_blank.htm";

//}}WH3_SYMBOL_SECTION

var gnPageWidth = 0;
var gnPageHeight = 0;
var gstrColl = "";
var gstrStyle = ""
var gbNav4 = false;
var gbIE4 = false;
var gbIE = false;
var gbIE5 = false;
var gbIE55 = false;
var gbTocLoaded = false;
var gbIndexLoaded = false;
var gbFtsLoaded = false;
var gAgent = navigator.userAgent.toLowerCase(); 
var gbMac = (gAgent.indexOf("mac") != -1);

var gbIndexInputEnable = false;
var gITE = new Array();
var gIndexKeywordArray = new Array();
var gIndexLetterArray = new Array();

var gbFtsInputEnable = false;
var gKE = new Array();
var gTE = new Array();
var gSTP = new Array();

gbIE = (navigator.appName.indexOf("Microsoft") != -1);
if (parseInt(navigator.appVersion) >= 4) {
	gbNav4 = (navigator.appName == "Netscape");
	gbIE4 = (navigator.appName.indexOf("Microsoft") != -1);
}
if (gbNav4) {
	document.gnPageWidth = innerWidth;
	document.gnPageHeight = innerHeight;
//	document.captureEvents(Event.RESIZE);
//	document.onresize = HandleResize;
} else if (gbIE4) {
	gstrStyle = ".style";
	gstrColl = "all.";
	if (gAgent.indexOf("msie 5") != -1) {
		gbIE5 = true;
	}
	if (gAgent.indexOf("msie 5.5") != -1) {
		gbIE55 = true;
	}
}

function HandleResize()
{
	if (innerWidth != window.document.gnPageWidth || innerHeight != window.document.gnPageHeight) {
		if (window.document.gnPageWidth == 0) {
			window.document.gnPageWidth = innerWidth;
			window.document.gnPageHeight = innerHeight;
		} else {
			window.document.gnPageWidth = innerWidth;
			window.document.gnPageHeight = innerHeight;
			window.document.location.reload();
		}
		return false;
	}
}


function FindTopLevelLayer(strID)
{
	if (gbNav4) {
		return FindTopLevelLayerNS(strID);
	} else if (gbIE4) {
		var obj = eval("document.all." + strID);
		return obj;
	}
	return null;
}

function FindTopLevelLayerNS(strID)
{
	for (var iLayer = 0; iLayer < window.document.layers.length; iLayer++) {
		if (window.document.layers[iLayer].id == strID) {
			return window.document.layers[iLayer];
		}
	}

	// This section is added to the search because when the scrollbar is
	// added, Netscape messes up the layer list. This is another way
	// of getting to the layers
	if (window.document.layers.length > 0) {
		var iLayer = 0;
		var objLayer = window.document.layers[0];
		while ((iLayer < 20) && (objLayer != null)) {
			if (objLayer.id == strID) {
				return objLayer;
			}
			iLayer++;
			objLayer = objLayer.above;
		}
	}
	return null;
}

function GetAttribObject(obj)
{
	var objAttrib = null;
	if (typeof obj == "string") {
		objAttrib = eval("document." + gstrColl + obj + gstrStyle);
	} else {
		objAttrib = obj;
	}
	return objAttrib;
}


function TabFrame()
{
	if (gbNav4) {
		return Tabs;
	} else {
		return document.frames['Tabs'];
	}
}

function NavFrame()
{
	if (gbNav4) {
		return Navigation;
	} else {
		return document.frames['Navigation'];
	}
}

function GetIFrameByDiv(div)
{
	var cIframe;
	if ((frames.length > 0) &&
	    (div != null) &&
	    (div.id != null))
	{
		if (div.id == "TocNav")
			cIframe = frames['TocIFrame'];
		else if (div.id == "IndexNav")
			cIframe = frames['IndexIFrame'];
		else if (div.id == "FtsNav")
			cIframe = frames['FtsIFrame'];			
	}
	return cIframe;
}


function ShowDiv(strDiv, bShow)
{
	var Div = FindTopLevelLayer(strDiv);
	if (Div == null) {
		return;
	}

	if (gbNav4) {
		if (bShow == true) {
			Div.visibility = 'show';
//			Div.left = 0;
			Div.moveToAbsolute(0, 0);
		} else {
			Div.visibility = 'hide';
//			Div.left = -2000;
			Div.moveToAbsolute(-2000, 0);
		}
	} else {
		if (gbIE55)
		{
			var curIframe = GetIFrameByDiv(Div);
			if (bShow)
			{
			   Div.style.zIndex = 3;
			   if (curIframe != null)  
			   {
				curIframe.frameElement.style.zIndex=3;
				curIframe.frameElement.style.visibility = "visible";
			   }
			}
			else
			{
			   Div.style.zIndex = 2;
			   if (curIframe != null)
			   {
				curIframe.frameElement.style.zIndex= 2;
				curIframe.frameElement.style.visibility = "hidden";
			   }
			}
		}

		Div.style.visibility = (bShow == true) ? 'visible' : 'hidden';
	}
	return;
}

function LoadTocContent(TocDiv)
{	
	gbTocLoaded = true;
	return;
}

function AutoSyncToc(strtocURL)
{
	if (strtocURL == "") return;

	var TocDiv = this.FindTopLevelLayer('TocNav');

	if (TocDiv.document.all.TocIFrame == null) return;

	var strFile = TocDiv.document.all.TocIFrame.document.location.href;
	var strHash = TocDiv.document.all.TocIFrame.document.location.hash;
	if (strHash.length > 0) {
		strFile = strFile.substring(0, strFile.length - strHash.length);
	}

	var strHash = "";
	if (strtocURL.length > 0)  {
		strHash = "#" + strtocURL;
	} 
	if (strHash.length > 0) {
		strFile += strHash;
	}
	if (gbNav4) {
		TocDiv.src = strFile;
	} else if (gbIE4) {
		if (document.frames['TocIFrame'] != null) // sure. we can access this iframe.
			if (typeof(document.frames['TocIFrame'].window.NavBar_SyncToc) == 'function')
				document.frames['TocIFrame'].window.NavBar_SyncToc(strtocURL);
	}
	gbTocLoaded = true;
	return;
}

function SyncTocContent(strtocURL)
{
	var TocDiv = this.FindTopLevelLayer('TocNav');
	if (TocDiv.document.all.TocIFrame == null) return;

	var strFile = TocDiv.document.all.TocIFrame.document.location.href;
	var strHash = TocDiv.document.all.TocIFrame.document.location.hash;
	if (strHash.length > 0) {
		strFile = strFile.substring(0, strFile.length - strHash.length);
	}

	var strHash = "";
	if (strtocURL.length > 0)  {
		strHash = "#" + strtocURL;
	} 
	if (strHash.length > 0) {
		strFile += strHash;
	}
	if (gbNav4) {
		TocDiv.src = strFile;
	} else if (gbIE4) {
		// no refresh.
		// but we need to switch div , if need.
		if (parent.TabFrame().document.images['TocTab'] != null) {
			parent.TabFrame().document.images['TocTab'].src='bssctab1.gif';
		}
		if (parent.TabFrame().document.images['IndexTab'] != null) {
			parent.TabFrame().document.images['IndexTab'].src='bssctab4.gif';
		}
		if (parent.TabFrame().document.images['FtsTab'] != null) {
			parent.TabFrame().document.images['FtsTab'].src='bssctab6.gif';
		}			
		ShowDiv('TocNav', true);
		ShowDiv('IndexNav', false);
		ShowDiv('FtsNav', false);
		TOCFocusA();
		if (document.frames['TocIFrame'] != null) // sure. we can access this iframe.
			document.frames['TocIFrame'].window.NavBar_SyncToc(strtocURL);

//		parent.document.strtocURL = strtocURL;
//		TocDiv.document.location.reload();
	}
	gbTocLoaded = true;
	return;
}

function TOCFocusA()
{
	if (gbIE55) 
	{
		var TocDiv = FindTopLevelLayer('TocNav');
		if (TocDiv && TocDiv.document && TocDiv.document.frames['TocIFrame'])
		{
			TocDiv = TocDiv.document.frames['TocIFrame'];
			if (TocDiv)
				TocDiv.focus();
		}
	}
}

function LoadIndexContent(IndexDiv)
{
	if (gstrIdxDhtml.length > 0) {
		var strFile = location.href;
		var nPosFile = strFile.indexOf(gstrNavFrmst);
		strFile = strFile.substring(0, nPosFile);
		strFile += gstrIdxDhtml;
		if (gbNav4) {
			IndexDiv.src = strFile;
		} else if (gbIE4) {
//			IndexDiv.document.frames['IndexIFrame'].location.href = strFile;
			IndexDiv.document.all.IndexIFrame.src = strFile;
		}
		gbIndexLoaded = true;
	}
	return;
}

function LoadFtsContent(FtsDiv)
{
	if (gstrFtsDhtml.length > 0) {
		var strFile = location.href;
		var nPosFile = strFile.indexOf(gstrNavFrmst);
		strFile = strFile.substring(0, nPosFile);
		strFile += gstrFtsDhtml;
		if (gbNav4) {
			FtsDiv.src = strFile;
		} else if (gbIE4) {
		//	FtsDiv.document.frames['FtsIFrame'].location.href = strFile;
			FtsDiv.document.all.FtsIFrame.src = strFile;
		}
		gbFtsLoaded = true;
	}
	return;
}


function TimeoutChangeToTOC()
{
	if (!gbTocLoaded) {
		var TocDiv = window.NavFrame().FindTopLevelLayer('TocNav');
		if (TocDiv != null) {
			LoadTocContent(TocDiv);
		}
	}
	if (window.TabFrame().document.images['TocTab'] != null) {
		window.TabFrame().document.images['TocTab'].src='bssctab1.gif';
	}
	if (window.TabFrame().document.images['IndexTab'] != null) {
		window.TabFrame().document.images['IndexTab'].src='bssctab4.gif';
	}
	if (window.TabFrame().document.images['FtsTab'] != null) {
		window.TabFrame().document.images['FtsTab'].src='bssctab6.gif';
	}
	window.NavFrame().ShowDiv('TocNav', true);
	window.NavFrame().ShowDiv('IndexNav', false);
	window.NavFrame().ShowDiv('FtsNav', false);
	if (gbNav4 && window.NavFrame().window.NSscrollbar) {
		NavFrame().window.NSscrollbar.SetActiveLayer(NavFrame().FindTopLevelLayer('TocNav'));
	}
	window.NavFrame().DoAutoSync();
}


function ChangeToTOC()
{
	setTimeout("TimeoutChangeToTOC();", 50);
	return;
}

function SelectTOC()
{
	if (!gbTocLoaded) {
		var TocDiv = NavFrame().FindTopLevelLayer('TocNav');
		if (TocDiv != null) {
			LoadTocContent(TocDiv);
		}
	}
	if (TabFrame().document.images['TocTab'] != null) {
		TabFrame().document.images['TocTab'].src='bssctab1.gif';
	}
	if (TabFrame().document.images['IndexTab'] != null) {
		TabFrame().document.images['IndexTab'].src='bssctab4.gif';
	}
	if (TabFrame().document.images['FtsTab'] != null) {
		TabFrame().document.images['FtsTab'].src='bssctab6.gif';
	}
	NavFrame().ShowDiv('TocNav', true);
	NavFrame().ShowDiv('IndexNav', false);
	NavFrame().ShowDiv('FtsNav', false);
	if (gbNav4 && NavFrame().window.NSscrollbar) {
		NavFrame().window.NSscrollbar.SetActiveLayer(NavFrame().FindTopLevelLayer('TocNav'));
	}

	if (!gbIE5 || gbIE55)
		setTimeout("TOCFocus()", 200);
	else
		window.NavFrame().DoAutoSync();
}

function TimeoutChangeToIndex()
{
	if (!gbIndexLoaded) {
		var IndexDiv = window.NavFrame().FindTopLevelLayer('IndexNav');
		if (IndexDiv != null) {
			LoadIndexContent(IndexDiv);
		}
	}
	if (window.TabFrame().document.images['TocTab'] != null) {
		window.TabFrame().document.images['TocTab'].src='bssctab2.gif';
	}
	if (window.TabFrame().document.images['IndexTab'] != null) {
		window.TabFrame().document.images['IndexTab'].src='bssctab3.gif';
	}
	if (window.TabFrame().document.images['FtsTab'] != null) {
		window.TabFrame().document.images['FtsTab'].src='bssctab6.gif';
	}
	window.NavFrame().ShowDiv('TocNav', false);
	window.NavFrame().ShowDiv('IndexNav', true);
	window.NavFrame().ShowDiv('FtsNav', false);
	if (gbNav4 && window.NavFrame().window.NSscrollbar) {
		NavFrame().window.NSscrollbar.SetActiveLayer(NavFrame().FindTopLevelLayer('IndexNav'));
	}
}


function ChangeToIndex()
{
	setTimeout("TimeoutChangeToIndex();", 50);
}

function SelectIndex()
{
	if (!gbIndexLoaded) {
		var IndexDiv = NavFrame().FindTopLevelLayer('IndexNav');
		if (IndexDiv != null) {
			LoadIndexContent(IndexDiv);
		}
	}
	if (TabFrame().document.images['TocTab'] != null) {
		TabFrame().document.images['TocTab'].src='bssctab2.gif';
	}
	if (TabFrame().document.images['IndexTab'] != null) {
		TabFrame().document.images['IndexTab'].src='bssctab3.gif';
	}
	if (TabFrame().document.images['FtsTab'] != null) {
		TabFrame().document.images['FtsTab'].src='bssctab6.gif';
	}
	NavFrame().ShowDiv('TocNav', false);
	NavFrame().ShowDiv('IndexNav', true);
	NavFrame().ShowDiv('FtsNav', false);
	if (gbNav4 && NavFrame().window.NSscrollbar) {
		NavFrame().window.NSscrollbar.SetActiveLayer(NavFrame().FindTopLevelLayer('IndexNav') );
	}

	setTimeout("IndexFocus()", 200);
}


function SelectFTS()
{
	var FtsDiv = NavFrame().FindTopLevelLayer('FtsNav');
	if (!gbFtsLoaded) {
		if (FtsDiv != null) {
			LoadFtsContent(FtsDiv);
		}
	}
	if (TabFrame().document.images['TocTab'] != null) {
		TabFrame().document.images['TocTab'].src='bssctab2.gif';
	}
	if (TabFrame().document.images['IndexTab'] != null) {
		TabFrame().document.images['IndexTab'].src='bssctab4.gif';
	}
	if (TabFrame().document.images['FtsTab'] != null) {
		TabFrame().document.images['FtsTab'].src='bssctab5.gif';
	}
	NavFrame().ShowDiv('TocNav', false);
	NavFrame().ShowDiv('IndexNav', false);
	NavFrame().ShowDiv('FtsNav', true);
	if (gbNav4 && NavFrame().window.NSscrollbar) {
		NavFrame().window.NSscrollbar.SetActiveLayer(NavFrame().FindTopLevelLayer('FtsNav'));
	}

	setTimeout("FTSFocus()", 200);
}

function TOCFocus()
{
	if (!gbIE5 || gbIE55)
	{
		var TocDiv = NavFrame().FindTopLevelLayer('TocNav');
		if (TocDiv && TocDiv.document && TocDiv.document.frames['TocIFrame'])
		{
			TocDiv = TocDiv.document.frames['TocIFrame'];
			if (TocDiv) {
				TocDiv.focus();
				if (typeof(TocDiv.ItemFocus) != "undefined")
					TocDiv.ItemFocus();
			}
		}
		window.NavFrame().DoAutoSync();
	}
}


function FTSFocus()
{
	var FtsDiv = NavFrame().FindTopLevelLayer('FtsNav');
	if (gbIE4) {
		if (FtsDiv && FtsDiv.document && FtsDiv.document.frames['FtsIFrame'] &&
			FtsDiv.document.frames['FtsIFrame'].frames['ftsform']) 
			FtsDiv = FtsDiv.document.frames['FtsIFrame'].frames['ftsform'];
	}

	if (FtsDiv && FtsDiv.FtsInputForm != null) {
		FtsDiv.FtsInputForm.ftsField.focus();
	}
}

function IndexFocus()
{

	var IndexDiv = NavFrame().FindTopLevelLayer('IndexNav');
	if (gbIE4) {
		if (IndexDiv && IndexDiv.document && IndexDiv.document.frames['IndexIFrame'] &&
			IndexDiv.document.frames['IndexIFrame'].frames['idxform']) 
			IndexDiv = IndexDiv.document.frames['IndexIFrame'].frames['idxform'];
	}
	if (IndexDiv && IndexDiv.IndexInputForm != null) {
		IndexDiv.IndexInputForm.keywordField.focus();
	}
}

function SelectInitialTab()
{
	// Create the necessary IFrames for IE
	if (gbIE4) {
		if (FindTopLevelLayer('TocNav') != null && gstrTocDhtml.length > 0) {
			var nIFrameHeight = FindTopLevelLayer('TocNav').style.pixelHeight - 10;
			var strIFrame = '<IFRAME ID="TocIFrame" SRC="' + gstrTocDhtml + '" BORDER=0 FRAMEBORDER=no STYLE="position:absolute; left:2%; width:92%; height:';
			if (gbMac) {
				strIFrame += nIFrameHeight + 'px;"></IFRAME>';
			} else {
				strIFrame += '100%;"></IFRAME>';
			}
			FindTopLevelLayer('TocNav').innerHTML = strIFrame;
		}
		if (FindTopLevelLayer('IndexNav') != null && gstrIdxDhtml.length > 0) {
			var nIFrameHeight = FindTopLevelLayer('IndexNav').style.pixelHeight - 10;
			var strIFrame = '<IFRAME ID="IndexIFrame" SRC="' + gstrBlankhtml + '" BORDER=0 FRAMEBORDER=no STYLE="position:absolute; left:2%; width:92%; height:';
			if (gbMac) {
				strIFrame += nIFrameHeight + 'px;"></IFRAME>';
			} else {
				strIFrame += '100%;"></IFRAME>';
			}
			FindTopLevelLayer('IndexNav').innerHTML = strIFrame;
		}

		if (FindTopLevelLayer('FtsNav') != null && gstrFtsDhtml.length > 0) {
			var nIFrameHeight = FindTopLevelLayer('FtsNav').style.pixelHeight - 10;
			var strIFrame = '<IFRAME ID="FtsIFrame" SRC="' + gstrBlankhtml + '" BORDER=0 FRAMEBORDER=no STYLE="position:absolute; left:2%; width:92%; height:';
			if (gbMac) {
				strIFrame += nIFrameHeight + 'px;"></IFRAME>';
			} else {
				strIFrame += '100%;"></IFRAME>';
			}
			FindTopLevelLayer('FtsNav').innerHTML = strIFrame;
		}
	}

	// Call the real selection function
	setTimeout("SelectInitTabReal()", 50);
}

function SelectInitTabReal()
{
	parent.gbTocLoaded = false;
	parent.gbIndexLoaded = false;
	parent.gbFtsLoaded = false;

	if (gstrIniDhtml == gstrTocDhtml)	{
		parent.SelectTOC();
	} else if (gstrIniDhtml == gstrIdxDhtml) {
		parent.SelectIndex();
	} else if (gstrIniDhtml == gstrFtsDhtml) {
		parent.SelectFTS();
	}

//	if (FindTopLevelLayer('TocNav') != null) {
//		parent.SelectTOC();
//	} else if (FindTopLevelLayer('IndexNav') != null) {
//		parent.SelectIndex();
//	} else if (FindTopLevelLayer('FtsNav') != null) {
//		parent.SelectFTS();
//	}
}


//////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Index code
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////

var gbIndexLayerInit = false;
function IndexInitPage()
{
	parent.gbIndexLayerInit = false;
	if (gbNav4) {
		TocBuildLayerArrayNS();
		onLoad = TocArrangeAllLayerNS();
	} else if (gbIE4) {

		// Mark all Index blocks as "expanded"
		var tempColl = document.all.tags("DIV");
		for (var i = 0; i < tempColl.length; i++) {
			if (tempColl(i).className == "child") tempColl(i).style.display = "block";
		}

		// Make an array of parents so we can access them directly
		var tempColl = document.all.tags("DIV");
		var iLetterIndex = 0;
		var nACharCode = "A".charCodeAt(0);
		for (var i = 0; i < tempColl.length; i++) {
			if (tempColl(i).className == "parent" && tempColl(i).innerText.length > 0 ) {
				gIndexLetterArray[tempColl(i).innerText.charCodeAt(0)] = tempColl(i);
			}
		}
	}
	setTimeout("parent.gbIndexLayerInit = true;",1000);
	return;
}

function IndexWriteClassStyle()
{
	document.write("<STYLE TYPE='text/css'>");
	if (gbNav4) {
		document.write(".IndexItem {visibility:inherit; font-size:9pt;}");
		document.write(".parent {font-size:10pt; position:absolute; visibility:hidden}");
		document.write(".child {font-size:10pt; position:absolute; visibility:hidden}");
		document.write("BLOCKQUOTE {margin-top:0pt; margin-bottom:0pt; margin-left:-15pt;}");
		document.write("DIV {margin-left:10pt; margin-top:0pt; margin-bottom:0pt}");
		document.write("P {margin-top:0pt; margin-bottom:0pt}");
		document.write("A:link {text-decoration: none; color: 000000}");
		document.write("A:visited {text-decoration: none; color: 333333}");
		document.write("A:active {text-decoration: none; background-color: #cccccc}");
		document.write("A:hover {text-decoration: underline; color: 007f00}");
	} else if (gbIE4) {
		if (gbMac) {
			if (gbIE5) {
				document.write(".IndexItem {visibility:inherit; font-size:10pt;}");
				document.write(".parent {font-size:10pt;}");
				document.write("BLOCKQUOTE {margin-top:0pt; margin-bottom:0pt; margin-left:15pt;}");
				document.write("P {font-family:'Arial'; color:#cccccc; font-size:10pt; margin-top:0pt; margin-bottom:0pt;}");
				document.write("H6 {font-family:'Arial'; color:#cccccc; font-size:10pt; margin-top:0pt; margin-bottom:0pt; font-style:normal;font-weight:normal;}");
				document.write("H6.firstsub {font-family:'Arial'; color:#cccccc; font-size:10pt; margin-top:0pt; margin-bottom:0pt; font-style:normal;font-weight:normal;}");
			} else {

				document.write(".IndexItem {visibility:inherit; font-size:12pt;}");
				document.write(".parent {font-size:14pt;}");
				document.write("BLOCKQUOTE {margin-top:0pt; margin-bottom:0pt; margin-left:15pt;}");
				document.write("P {font-family:'Arial'; color:#cccccc; font-size:12pt; margin-top:0pt; margin-bottom:0pt;}");
				document.write("H6 {font-family:'Arial'; color:#cccccc; font-size:12pt; margin-top:0pt; margin-bottom:0pt; font-style:normal;font-weight:normal;}");
				document.write("H6.firstsub {font-family:'Arial'; color:#cccccc; font-size:12pt; margin-top:-10pt; margin-bottom:0pt; font-style:normal;font-weight:normal;}");
			}
		} else {
			document.write(".IndexItem {visibility:inherit; font-size:8pt;}");
			document.write(".parent {font-size:10pt;}");
			document.write("BLOCKQUOTE {margin-top:0pt; margin-bottom:0pt; margin-left:15pt;}");
			document.write("P {font-family:'Arial'; color:#cccccc; font-size:9pt; margin-top:0pt; margin-bottom:0pt;}");
			document.write("H6 {font-family:'Arial'; color:#cccccc; font-size:9pt; margin-top:0pt; margin-bottom:0pt; font-style:normal;font-weight:normal;}");
		}
		document.write(".child {display:block}");
		document.write("DIV {margin-top:0pt; margin-bottom:0pt}");
		document.write("A:link {text-decoration: none; color: 000000}");
		document.write("A:visited {text-decoration: none; color: 333333}");
		document.write("A:active {text-decoration: none; background-color: #cccccc}");
		document.write("A:hover {text-decoration: underline; color: 007f00}");
	}
	document.write("</STYLE>");
	return;
}

//Define variable arguments as: strTitle, strUrl
function TE() 
{
	var argLen = TE.arguments.length;
	this.strTitle = TE.arguments[0];
	this.strURL = TE.arguments[1];
}

//Define variable arguments as: strKeyword [,strTopicIndex]*
function IndexKeywordEntry() 
{
	var argLen = IndexKeywordEntry.arguments.length;
	this.strKeyword = IndexKeywordEntry.arguments[0];
	this.arrayTopics = new Array();

	// Now add all of the topic entries
	for (var i=0; i < argLen - 1; i++) {
		this.arrayTopics[i] = IndexKeywordEntry.arguments[i + 1];
	}
}


function IndexBody()
{
	// Get the appropriate item to add items to
	var layerFind = null;
	if (gbIE4) {
		layerFind = parent.document.frames['idxbody'];
	} else if (gbNav4) {
		layerFind = parent.document.idxbody.document;
	}
	
	return layerFind;
}

function IndexForm()
{
	// Get the appropriate item to add items to
	var layerFind = null;
	if (gbIE4) {
		layerFind = parent.document.frames['idxform'];
	} else if (gbNav4) {
		layerFind = parent.document.idxform.document;
	}
	
	return layerFind;
}

function IndexExpandIt(elId, bForceOpen) 
{
	var layerChild = null;
	if (gbIE4) {
		layerChild = TocExpandIE(elId, false, bForceOpen);

		if (!bForceOpen) {
			var nNewScroll = document.body.scrollTop;
			if (layerChild.style.display == "block") {
				var nItemTop = layerChild.offsetTop;
				var nItemBottom = nItemTop + layerChild.offsetHeight;
				// Make sure the bottom is visible if possible
				if (document.body.scrollTop + document.body.clientHeight < nItemBottom) {
					nNewScroll = nItemBottom - document.body.clientHeight;
				}
				// If expanded item is bigger than the client area, scroll the item to the top
				if (nItemBottom - nItemTop > document.body.clientHeight) {
					nNewScroll = nItemTop - 20;
				}
			}
			document.body.scrollTop = nNewScroll;
		}
	} else if (gbNav4) {
		layerChild = TocExpandNS(elId, false, bForceOpen);
		if (window.NSscrollbar != null) {
			window.NSscrollbar.SetContentHeight(nextY);
			window.NSscrollbar.SetContentWidth(nextX);
		}
	}
	return layerChild;
}


function IndexInputEnable(bEnable)
{
	gbIndexInputEnable = bEnable;
	return;
}

function IndexInputSubmit()
{
	IndexLookup(true);
	return;
}

//Initize the site
function IndexSiteInit()
{
  if (!window.Array) return;

  if (gbNav4) document.captureEvents(Event.KEYUP);
  document.onkeyup = IndexLookupKeydown;
}

function IndexLookupKeydown() 
{
	if (gbIE4)
	{
		if (event.keyCode == 13)	//Enter key
		{
			IndexLookup(true);
		}
		else 
			IndexLookup(false);
	}
	else
		IndexLookup(false);
}

function IndexLookup(bCR) 
{
	if (!parent.gbIndexLayerInit) {
		return; 
	}

	if (!gbIndexInputEnable && !gbMac) {
		return;
	}

	var strInput = document.IndexInputForm.keywordField.value.toUpperCase();
	if (strInput != "") {
		IndexSiteDisplay(strInput, bCR);
	}

	if (gbMac) {
		document.IndexInputForm.keywordField.focus();
	}

	return;
}

function  IndexSiteDisplay(strInput, bCR)
{
	// Get the topmost Index layer
	var IndexDiv = IndexBody();

	// Get the layer for the first letter
	var cFirst = strInput.charAt(0);
	cFirst = GetFlagChar(cFirst);
	var layerFirst = null;
	if (gbNav4) {
		for (var iLayer = 0; iLayer < document.layers.length; iLayer++) {
			if ((document.layers[iLayer].id.indexOf("Parent") != -1) &&
				(document.layers[iLayer].id.charAt(0) == cFirst)) {
				layerFirst = document.layers[iLayer];
				break;
			}
		}
		if (layerFirst == null) {
			layerFirst = document.BookR0000000Parent;
		}
	} else if (gbIE4) {
		layerFirst = IndexDiv.gIndexLetterArray[cFirst.charCodeAt(0)];
	}

	// If we didn't find anything then return - something went terribly wrong
	if (layerFirst == null) {
		return;
	}

	// Expand the first layer
	var strLayerID = layerFirst.id;
	var iParent = strLayerID.indexOf("Parent");
	strLayerID = strLayerID.substr(0, iParent);

	var layerChild = IndexDiv.IndexExpandIt(strLayerID, true);

	// Find the first child that "matches" the item we are searchig for
	var MatchingItem = null;
	if (gbNav4) {
	} else if (gbIE4) {

		var tempColl = layerChild.all.tags("P");
		if (tempColl.length == 0) {
			MatchingItem = layerChild;
		} else {
			var iStart = 0;
			var iEnd = tempColl.length - 1;
			var iMid = 0;
			var strItemUpper = "";
			while (iStart <= iEnd) {
				iMid = iStart + iEnd;
				iMid >>= 1;
				strItemUpper = tempColl(iMid).innerText;
				strItemUpper = strItemUpper.toUpperCase();
				if (compare(strItemUpper, strInput) > 0  ) {
					iEnd = iMid - 1;
				} else if (compare(strItemUpper, strInput) < 0) {
					iStart = iMid + 1;
					if (iStart < tempColl.length)
						iMid = iStart;
				} else break;
			}

			// Search backward to find the first one that partially matches
			var iMatch = 0;
			for (var iMatch = iMid; iMatch >= 0; iMatch--) {
				strItemUpper = tempColl(iMatch).innerText;
				strItemUpper = strItemUpper.toUpperCase();
				if (compare(strItemUpper, strInput) != 0) {
					break;
				}
			}
			if (iMatch != iMid) {
				if (iMatch >= 0) {
					if (iMatch < tempColl.length - 1) {
						iMid = iMatch + 1;
					} else {
						iMid = iMatch;
					}
				} else {
					iMid = 0;
				}
			}
			MatchingItem = tempColl(iMid);
		}
	}

	// Scroll to the closest matching item
	if (MatchingItem) {
		if (gbNav4) {
		} else if (gbIE4) {
			IndexDiv.document.body.scrollTop = MatchingItem.offsetTop;

			// Set the focus on the selected hyperlink (if there is one)
			tempColl = MatchingItem.all.tags("A");
			if (tempColl.length > 0) {
				// If a carriage return was used then simulate a click
				if (bCR) {
					tempColl(0).click();
				} else {
					// Simply set the focus to the hyperlink
					if (!gbIE5 || gbIE55) {
					   var nbTag = MatchingItem.all.tags("NOBR");
					   if (nbTag.length > 0)
						   HighLightElement(nbTag(0));
					} else {
					   tempColl(0).focus();
					}
				}
				IndexForm().document.IndexInputForm.keywordField.focus();
			}
		}
	}

	return;
}

var gBsLastHighLightElement = null;
function HighLightElement(objAnchor)
{
	resetHighLight();
	objAnchor.style.backgroundColor = "lightgrey";
	gBsLastHighLightElement = objAnchor;
}

function resetHighLight()
{
	if (gBsLastHighLightElement != null)
	{
		gBsLastHighLightElement.style.backgroundColor = "white";
	}
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// TOC code
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////
var imgBookClose ="bssctoc1.gif";
var imgBookOpen  ="bssctoc2.gif";

var  elTocArray = new Array();
var  elTocArrayNum = 0;

function TocWriteClassStyle()
{
	document.write("<STYLE TYPE='text/css'>");
	if (gbNav4) {
		document.write(".parent {position:absolute; visibility:hidden}");
		document.write(".child {position:absolute; visibility:hidden}");
		document.write("BLOCKQUOTE {margin-top:0pt; margin-bottom:0pt; margin-left:-15pt;}");
		document.write("DIV {margin-top:0pt; margin-bottom:0pt}");
		document.write("P {margin-top:0pt; margin-bottom:0pt}");
		document.write("PRE {margin-top:0pt; margin-bottom:0pt}");
	} else if (gbIE4) {
		if (gbMac) {
			if (gbIE5){
				document.write(".parent {font-size:10pt;}");
				document.write("P {font-family:'Arial'; font-size:10pt; margin-top:0pt; margin-bottom:0pt;}");
				document.write("PRE {font-family:'Arial'; font-size:10pt; margin-top:0pt; margin-bottom:0pt;}");
				document.write("BLOCKQUOTE {margin-top:0pt; margin-bottom:0pt; margin-left:15pt;}");
				document.write("DIV {margin-top:0pt; margin-bottom:0pt}");
			} else {
				document.write(".parent {font-size:14pt;}");
				document.write("P {font-family:'Arial'; font-size:12pt; margin-top:0pt; margin-bottom:0pt;}");
				document.write("PRE {font-family:'Arial'; font-size:12pt; margin-top:0pt; margin-bottom:0pt;}");
				document.write("BLOCKQUOTE {margin-top:0pt; margin-bottom:0pt; margin-left:15pt;}");
				document.write("DIV {margin-top:0pt; margin-bottom:0pt;}");
			}
		} else {
			document.write(".parent {font-size:10pt;}");
			document.write("BLOCKQUOTE {margin-top:0pt; margin-bottom:0pt; margin-left:15pt;}");
			document.write("P {font-family:'Arial'; font-size:8pt; margin-top:0pt; margin-bottom:0pt;}");
			document.write("PRE {font-family:'Arial'; font-size:8pt; margin-top:0pt; margin-bottom:0pt;}");
			document.write("DIV {margin-top:0pt; margin-bottom:0pt}");
		}
		document.write(".child {display:none}");
		document.write("A:link {text-decoration: none; color: 000000}");
		document.write("A:visited {text-decoration: none; color: 333333}");
		document.write("A:active {text-decoration: none; background-color: #cccccc}");
		document.write("A:hover {text-decoration: underline; color: 007f00}");
	}
	document.write("</STYLE>");
	return;
}

function TocWriteFixedWidth(bBegin, nWidth)
{
	//Avoid the wrap of text after book/page, make a invisble outter table is approch (for IE4 iMac only)
	// This will make IE4 DHTML Sync Toc DO NOT WORK.
	if ((gbIE4) && (gbMac) && (!gbIE5)) {
		if (bBegin)	{
			document.write("<table width=" + nWidth +" border=0><tr><td>");
		} else	{
			document.write("</td></tr></table>");
		}
	}
}

//Assign the layer's visibility at initialize the Page
function TocInitPage()
{
//	var TocDiv = NavFrame().FindTopLevelLayer('TocNav');
//	if (TocDiv != null) {
//		return;
//	}
	if (gbNav4) {
//		for (var i=0; i < document.layers.length; i++) {
//			var whichEl = document.layers[i];
//			if (whichEl.id.indexOf("Child") != -1) {
//				whichEl.visibility = "hide";
//			} else {
//				whichEl.visibility = "show";
//			}
//		}
		TocBuildLayerArrayNS();
		onLoad  = TocArrangeAllLayerNS();
	} else if (gbIE4) {

		// Select the first hyperlink
		var tempColl = document.all.tags("A");
		if (tempColl.length > 0) {
			tempColl(0).focus();
		}
	}
	return;
}

function TocShowLayer(whichEl, bShow)
{
	if (bShow) {
		whichEl.visibility = "show";
	} else {
		whichEl.visibility = "hide";
	}
	for (var i=0; i<whichEl.document.layers.length; i++) {
		var whichChildEl = whichEl.document.layers[i];
		ShowLayer(whichChildEl, bShow);
	}
}

function TocExpandAll()
{
	for (var i=0; i<document.layers.length; i++) {
		var whichEl = document.layers[i];
		TocShowLayer(whichEl, true);
	}
	TocBuildLayerArrayNS();
	TocArrangeAllLayerNS();

	return;
}

function TocCollapseAll()
{
	for (var i=0; i<document.layers.length; i++) {
		var whichEl = document.layers[i];
		ShowLayer(whichEl, false);
		if (whichEl.id.indexOf("Child") != -1) {
			whichEl.visibility = "hide";
		} else {
			whichEl.visibility = "show";
		}
	}
	TocBuildLayerArrayNS();
	TocArrangeAllLayerNS();

	return;
}

//Expand a layer
function TocExpandIt(elId)
{
	TocExpandIt2(elId, false);
}

//Expand a layer
function TocExpandIt2(elId, bForceOpen)
{
	if (gbIE4) {
		var child = TocExpandIE(elId, true, bForceOpen);
		var nNewScroll = document.body.scrollTop;
		if (child.style.display == "block") {
			var nItemTop = child.offsetTop;
			var nItemBottom = nItemTop + child.offsetHeight;
			// Make sure the bottom is visible if possible
			if (document.body.scrollTop + document.body.clientHeight < nItemBottom) {
				nNewScroll = nItemBottom - document.body.clientHeight;
			}
			// If expanded item is bigger than the client area, scroll the item to the top
			if (nItemBottom - nItemTop > document.body.clientHeight) {
				nNewScroll = nItemTop - 20;
			}
		}
		document.body.scrollTop = nNewScroll;
	} else if (gbNav4) {
		TocExpandNS(elId, true, false);
		if (window.NSscrollbar != null) {
			window.NSscrollbar.SetContentHeight(nextY);
			window.NSscrollbar.SetContentWidth(nextX);
		}
	}
	return;
}


////////////////////////////////////////////////////////////////
//Functions for IE
function TocExpandIE(elId, bChangeImg, bForceOpen) 
{ 
	var whichEl = eval(elId + "Child");
	var whichIm = document.images[elId];

	if (whichEl == null) {
		return null;
	}

	if ((whichEl.style.display != "block") || bForceOpen) {
		whichEl.style.display = "block";
		if (bChangeImg) {
			whichIm.src = imgBookOpen;		
		}
	} else {
		whichEl.style.display = "none";
		if (bChangeImg) {
			whichIm.src = imgBookClose;
		}
		if (gbMac) {
			//YJ: ?? can not scroll into view, if div has fixed width, it will scroll horizal to the very end.
			//whichEl.scrollIntoView(false);
		}
	}
	return whichEl;
}

////////////////////////////////////////////////////////////////
//Functions for NS
function TocExpandNS(elId, bChangeImg, bForceOpen)
{
	var whichParent = null;
	var whichChild  = null;
	var idParent = elId + "Parent";
	var idChild  = elId + "Child";
	for (var i=0; i<elTocArrayNum ;i++) {
		if  (idParent == elTocArray[i].id) {
			whichParent = elTocArray[i].el;

			if ((i+1 < elTocArrayNum) && (idChild == elTocArray[i+1].id))
			{
				whichChild = elTocArray[i+1].el;
			}
			break;
		}
	}
	if (whichParent == null)	return null;
	var imgParent = whichParent.document.images[0];
	if (whichChild == null) return null;

	if (whichChild.visibility == "hide")
	{
		whichChild.visibility = "show";
		if (bChangeImg) {
			imgParent.src = imgBookOpen;
		}
		for (var i=0; i<whichChild.layers.length; i++)
		{
			var whichEl = whichChild.layers[i];
			if (whichEl.id.indexOf("Parent") != -1)
				whichEl.visibility = "show";
		}
	}
	else if (bForceOpen)
	{
		return whichChild;
	}
	else
	{
		whichChild.visibility = "hide";
		if (bChangeImg) {
			imgParent.src = imgBookClose;
		}
		for (var i=0; i<whichChild.layers.length; i++)
		{
			var whichEl = whichChild.layers[i];
			whichEl.visibility = "hide";
		}
	}
	TocArrangeAllLayerNS(bChangeImg);
	return whichChild;
}

function elTocLayerNS(elLayer, elLayerId)
{
	this.el  = elLayer;
	this.id  = elLayerId;
	return;
}

function TocFindLayerNS(elLayer)
{
	for (var i = 0; i < elLayer.layers.length; i++) {
		var whichEl = elLayer.layers[i];
//		if (typeof whichEl != "undefined") {
		if ((whichEl.id.indexOf("Parent") != -1) ||
			(whichEl.id.indexOf("Child") != -1)) {
			elTocArray[elTocArrayNum] = new elTocLayerNS(whichEl,whichEl.id);
			elTocArrayNum++;
	    	TocFindLayerNS(whichEl);
		}
	}
	return;
}

function TocBuildLayerArrayNS()
{
	elTocArrayNum = 0;
	TocFindLayerNS(document);
	return;
}

var  nextY = 0;
var  nextX = 0; // real means : the maxium width of sub-layers' width
function TocArrangeLayerNS(elLayer, bShowLayer, iLevel, bChangeImg)
{
	var i = 0;
	while (i < elLayer.layers.length)
	{
		var whichParent = elLayer.layers[i];
		
		if (whichParent.id.indexOf("Parent") == -1) 
			i++; // Check to make sure this is a "parent" because we do have extra layers on the page
		else
		{
			var whichChild  = elLayer.layers[i+1];
			if (bShowLayer)
			{   // Check to see if we have a second (or lower level) block with pages
				// on top of books. If so, Netscape would ordinarily add space for the
				// BLOCKQUOTE, but we don't want one - so remove the space.
				if( (i == 0) && (iLevel > 0) &&
					(null != whichParent.parentLayer) &&
					(whichParent.parentLayer.document.images.length > 0))
					nextY -= whichParent.document.height;

				whichParent.pageY = nextY;
				whichParent.visibility = "show";

				whichParent.clip.bottom = whichParent.document.height;
				whichParent.clip.right  = whichParent.document.width + iLevel*20;// plus indent width
				if( whichParent.clip.right > nextX )
					nextX = whichParent.clip.right;

				nextY += whichParent.document.height;
				if (whichChild.visibility == "show")
				{
					if (bChangeImg)
						whichParent.document.images[0].src = imgBookOpen;

					whichChild.pageY = nextY;
					nextY += whichChild.document.height;

					whichChild.clip.right = whichChild.document.width + iLevel*20;// plus indent width
					if( whichChild.clip.right > nextX )
						nextX = whichChild.clip.right;

					TocArrangeLayerNS(whichChild, true, iLevel + 1, bChangeImg);
					whichChild.clip.bottom = nextY - window.NSscrollbar.GetContentVerticalPos();
					if( nextX > whichChild.clip.right )
						whichChild.clip.right = nextX;
				}
				else
				{
					if (bChangeImg)
						whichParent.document.images[0].src = imgBookClose;

					TocArrangeLayerNS(whichChild, false, iLevel + 1, bChangeImg);
				}
			}
			else
			{
				if (bChangeImg)
					whichParent.document.images[0].src = imgBookClose;
				whichParent.visibility = "hide";
				whichParent.clip.bottom = 0;
				whichParent.clip.right  = 0;

				whichChild.visibility = "hide";
				whichChild.clip.bottom = 0;
				whichChild.clip.right  = 0;
				TocArrangeLayerNS(whichChild, false, iLevel, bChangeImg);
			}
			i += 2;
		}
	}
	return;
}

function TocArrangeAllLayerNS(bChangeImg) 
{
	if (document.layers.length > 0) {
		nextX = document.layers[0].pageX;
		nextY = document.layers[0].pageY;
		TocArrangeLayerNS(document, true, 0, bChangeImg);
	}
	return;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// FTS code
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////

function FtsWriteClassStyle()
{
	document.write("<STYLE TYPE='text/css'>");
	if (gbNav4) {
		document.write("P {font-family:'Arial'; font-size:9pt;}");
		document.write("A:link {text-decoration: none; color: 000000}");
		document.write("A:visited {text-decoration: none; color: 333333}");
		document.write("A:active {text-decoration: none; background-color: #cccccc}");
		document.write("A:hover {text-decoration: underline; color: 007f00}");
	} else if (gbIE4) {
		if (gbMac) {
			if (gbIE5) {
				document.write("P {font-family:'Arial'; font-size:10pt;}");
				document.write("dt {font-family:'Arial'; font-size:10pt;}");
			} else {
				document.write("P {font-family:'Arial'; font-size:12pt;}");
				document.write("dt {font-family:'Arial'; font-size:12pt;}");
			}
		} else {
			document.write("P {font-family:'Arial'; font-size:9pt;}");
			document.write("dt {font-family:'Arial'; font-size:9pt;}");
		}
		document.write("A:link {text-decoration: none; color: 000000}");
		document.write("A:visited {text-decoration: none; color: 333333}");
		document.write("A:active {text-decoration: none; background-color: #cccccc}");
		document.write("A:hover {text-decoration: underline; color: 007f00}");
	}
	document.write("</STYLE>");
	return;
}

//Define variable arguments as: strKeyword [,strTopicIndex]*
//function KeywordEntry() 
function KE() 
{
	var argLen = KE.arguments.length;
	this.strKeyword = KE.arguments[0];
	this.arrayTopics = new Array();

	// Now add all of the topic entries
	for (var i=0; i < argLen - 1; i++) {
		this.arrayTopics[i] = KE.arguments[i + 1];
	}
}

/*
function FtsStopWord()
{
	this.strStopWord = FtsStopWord.arguments[0];
}*/

function FtsInputEnable(bEnable)
{
   gbFtsInputEnable = bEnable;
   return;
}

function FtsInputSubmit()
{
	//Hack for IE, have to use keydown to get enter event,
	//Embedding WebHelp to WinHelp2000 will fail to fire the submit the form. 
	if (!gbIE4)
	{
		FtsLookup();
	}
	return false;
}

//Initize the site
function FtsInit()
{
  if (!window.Array) return;

  if (gbNav4) document.captureEvents(Event.KEYUP);
  document.onkeyup = FtsLookupKeydown;
}

function FtsLookupKeydown() 
{
	if (gbIE4)
	{
		if (event.keyCode == 13)	//Enter key
		{
			FtsLookup();
		}
	}
}

function FtsLookup() 
{
	if (!gbFtsInputEnable && !gbMac)
		return;

	var strInput = document.FtsInputForm.ftsField.value.toLowerCase();
	if (strInput != "") {
		FtsDisplay(strInput);
	}

	if (gbMac) {
		document.FtsInputForm.ftsField.focus();
	}
}

var gstrDisplayInput = "";

function FtsFindTable()
{
	// Get the appropriate item to add items to
	var layerFind = null;
	if (gbIE4) {
		layerFind = parent.document.frames['ftsbody'].document.all.FtsFindTable;
	} else if (gbNav4) {
		layerFind = parent.document.ftsbody.document.FtsFindTable.document;
	}
	
	return layerFind;
}

function FtsBody()
{
	// Get the appropriate item to add items to
	var layerFind = null;
	if (gbIE4) {
		layerFind = parent.document.frames['ftsbody'];
	} else if (gbNav4) {
		layerFind = parent.document.ftsbody.document;
	}
	
	return layerFind;
}

function FtsDisplay(strInput)
{
	var layerFind = FtsFindTable();
	if (layerFind == null) {
		return;
	}

	// Let the user know we are busy
	var strHtm = "<P><B><FONT SIZE=2>Searching...</FONT></B></P>"
	if (gbIE4) {
		layerFind.innerHTML = strHtm;
	} else if (gbNav4) {
		layerFind.write(strHtm);
		layerFind.close();
	}
	window.gstrDisplayInput = strInput;
	setTimeout("FtsDisplayReal()", 50);

	return;
}

function FtsDisplayReal()
{
	var FtsDiv = FtsBody();
//	if (gbNav4) {
//		FtsDiv = FindTopLevelLayer('FtsNav');
//	} else if (gbIE4) {
//		FtsDiv = parent.parent.FindTopLevelLayer('FtsNav');
//		FtsDiv = FtsDiv.document.frames['FtsIFrame'].document.all.ftsbody;
//	}

	var strInput = window.gstrDisplayInput;
	var nKeywordArrayLen = FtsDiv.gKE.length;
	var nTopicArrayLen = FtsDiv.gTE.length;
	var nStopArrayLen = FtsDiv.gSTP.length;

	// Get the appropriate item to add items to
	var layerFind = FtsFindTable();
	if (layerFind == null) {
		return;
	}

	// Keep track of which operation we are currently in
	// 0 = OR; 1 = AND
	var nCurrentOp = 0;
	var bNot = false;

	// Loop through the words in the input string
	var bFinished = false;
	var bFirstKeyword = true;
	var strCurrentWord = "";
	var strCurrentStem = "";
	var strKeyword = "";
	var strHtm = "";
	var nFirstMatch = -1;
	var nLastMatch  = -1;
	var i=0;
	var iSpace = 0;
	var iFound = 0;
	var SearchTopicArray = new Array();
	var iSearch = 0;
	// If you change this Word Break string make sure you also change it in FtsDataBase.CPP
	var FTS_WORD_BREAK_CHARS = "\t\r\n\"\\ .,!@#$%^&*()~'`:;<>?/{}[]|+-=\x85\x92\x93\x94\x95\x96\x97\x99\xA9\xAE\xB7";
	var nNumWordBreakChars = FTS_WORD_BREAK_CHARS.length;

	// Clear the flags for each of the topics
	var iTopic = 0;
	for (iTopic = 0; iTopic < nTopicArrayLen; iTopic++) {
		SearchTopicArray[iTopic] = 0;
	}

	while (!bFinished) {

		// Get the next word
		iSpace = -1;
		iChar = 0;
		iSep = -1;
		for (var iChar = 0; iChar < nNumWordBreakChars; iChar++) {
			iFound = strInput.indexOf(FTS_WORD_BREAK_CHARS.charAt(iChar));
			if ((iFound != -1) && ((iSpace == -1) || (iFound < iSpace))) {
				iSpace = iFound;
				iSep = iChar;
			}
		}
		if (iSpace == -1) {
			strCurrentWord = strInput;
			strInput = "";
		} else {
			strCurrentWord = strInput.substr(0, iSpace);
			strInput = strInput.substr(iSpace + 1);
		}

		// Check for operators or a blank word
		if ((strCurrentWord == "or") ||
			   ((iSep >= 0) && (FTS_WORD_BREAK_CHARS.charAt(iSep) == "|"))) {
			nCurrentOp = 0;
			bNot = false;
		} else if ((strCurrentWord == "and") ||
			   ((iSep >= 0) && (FTS_WORD_BREAK_CHARS.charAt(iSep) == "&"))) {
			nCurrentOp = 1;
			bNot = false;
		} else if ((strCurrentWord == "not") ||
			   ((iSep >= 0) && (FTS_WORD_BREAK_CHARS.charAt(iSep) == "~"))) {
			bNot = true;
		} else if (strCurrentWord == "") {
			if (strInput == "") {
				break;
			} else {
				continue;
			}
		} else if (!IsStopWord(strCurrentWord, FtsDiv.gSTP, nStopArrayLen)){

			// See if this is has a NOT at the beginning
			if (strCurrentWord.substr(0, 1) == "~") {
				bNot = true;
				strCurrentWord = strCurrentWord.substr(1);
			}

			// Get the stemmed version of the word
			strCurrentStem = GetStem(strCurrentWord);

			// See if the stemmed word is found in the list
			iFound = -1;
			iFound = FtsFindKeyword(strCurrentStem, FtsDiv.gKE, nKeywordArrayLen);

			// Did we find the keyword?
			if (iFound != -1) {

				// See if we are performing an OR operation
				var nNumTopics = FtsDiv.gKE[iFound].arrayTopics.length;
				if (nCurrentOp == 0) {
					if (bNot) {
						var cFoundArrayTopics =  FtsDiv.gKE[iFound].arrayTopics;
						// Add all topics that are not in the list for this keyword
						for (iTopic = 0; iTopic < nTopicArrayLen; iTopic++) {
							// See if the topic is in the list for this keyword
							for (iListTopic = 0; iListTopic < nNumTopics; iListTopic++) {
								if (cFoundArrayTopics[iListTopic] == iTopic) {
									break;
								}
							}
							if (iListTopic == nNumTopics) {
								// The topic is not in the list for the current keyword, so add it
								SearchTopicArray[iTopic] = 1;
							}
						}

					} else {
						// Loop through the topics that have the keyword and add them to the list
						for (iTopic = 0; iTopic < nNumTopics; iTopic++) {
							var nTopicNum = FtsDiv.gKE[iFound].arrayTopics[iTopic];
							// Add the topic to the list
							SearchTopicArray[nTopicNum] = 1;
						}
					}
				// See if this is an AND operation
				} else if (nCurrentOp == 1) {

					if (bNot) {
						// Loop through the topics for the current word and remove them from the list
						for (iTopic = 0; iTopic < nNumTopics; iTopic++) {
							SearchTopicArray[FtsDiv.gKE[iFound].arrayTopics[iTopic]] = 0;
						}
					} else {
						// Loop through the topics already in the list and remove them if they are not
						// in the list for the current word
						for (iTopic = 0; iTopic < nNumTopics; iTopic++) {
							if (SearchTopicArray[FtsDiv.gKE[iFound].arrayTopics[iTopic]] == 1) {
								SearchTopicArray[FtsDiv.gKE[iFound].arrayTopics[iTopic]] = -1;
							}
						}
						for (iTopic = 0; iTopic < nTopicArrayLen; iTopic++) {
							if (SearchTopicArray[iTopic] == -1) {
								SearchTopicArray[iTopic] = 1;
							} else {
								SearchTopicArray[iTopic] = 0;
							}
						}
					}
				}
			} else {
				// Word was not found

				// Clear the list if this is an AND operation
				if ((nCurrentOp == 1) && (!bNot)) {
					for (iSearch = 0; iSearch < nTopicArrayLen; iSearch++) {
						SearchTopicArray[iSearch] = 0;
					}

				// Add all items to the list if this is an OR operation with a NOT operator
				} else if ((nCurrentOp == 0) && (bNot)) {

					// Add all topics that are not in the list for this keyword

					// First set all flags to -1 if they are not already set
					for (iTopic = 0; iTopic < nTopicArrayLen; iTopic++) {
						if (SearchTopicArray[iTopic] == 0) {
							SearchTopicArray[iTopic] = -1;
						}
					}

					// Now clear all -1s for topics associated with this keyword
					for (iTopic = 0; iTopic < nNumTopics; iTopic++) {
						if (SearchTopicArray[FtsDiv.gKE[iFound].arrayTopics[iTopic]] == -1) {
							SearchTopicArray[FtsDiv.gKE[iFound].arrayTopics[iTopic]] = 0;
						}
					}

					// Finally change all -1s to 1s
					for (iTopic = 0; iTopic < nTopicArrayLen; iTopic++) {
						if (SearchTopicArray[iTopic] == -1) {
							SearchTopicArray[iTopic] = 1;
						}
					}
				}
			}

			// If this was the first word change the operation to "and". We need to have it be
			// an "or" for the first keyword so we would add the items for the first search word.
			if (bFirstKeyword) {
				bFirstKeyword = false;
				nCurrentOp = 1;
			}
		}
	}

	var aSortedTopics = new Array();
	var nNumSortTopics = 0;
	for (iSearch = 0; iSearch < nTopicArrayLen; iSearch++) {
		if (SearchTopicArray[iSearch]) {
			aSortedTopics[nNumSortTopics++] = iSearch;
		}
	}

	// Limit the number of topics in the result set
	if (nNumSortTopics > 75) {
		nNumSortTopics = 75;
	}

	// Sort the topics by title
	SortTopics(FtsDiv, aSortedTopics, 0, nNumSortTopics - 1);

	// Add hyperlinks for all of the found topics
	var strLine = "";
	for (iSearch = 0; iSearch < nNumSortTopics; iSearch++) {
		i = aSortedTopics[iSearch];
		if (i != -1) {
			strLine = "<dt><nobr><a href='" + FtsDiv.gTE[i].strURL + "'>";
			strLine += FtsDiv.gTE[i].strTitle; 
			strLine += "</a></nobr></dt>";
			strHtm += strLine;
		}
	}

	// Give a special message if none were found
	if (strHtm == "") {
		strHtm = "<P><B>No Topics Found.</B></P>"
	} else {
		strHtm = "<dl>" + strHtm + "</dl>";
	}

	if (gbIE4) {
		layerFind.innerHTML = strHtm;
	} else if (gbNav4) {
		layerFind.write(strHtm);
		layerFind.close();
	}

	return;
}


function FtsFindKeyword(strCurrentWord, aFtsKeywordArray, nKeywordArrayLen)
{
	// Search for the current word in the array (binary search)
	var nLow = 0; 
	var nHigh = nKeywordArrayLen - 1;
	var nMid = 0;
	var bFound = false;
	var strKeyword = "";
	while (nLow <= nHigh) {
		nMid = (nLow + nHigh);
		nMid >>= 1;
		strKeyword = aFtsKeywordArray[nMid].strKeyword;
		if (strCurrentWord > strKeyword) {
			nLow = (nLow == nMid) ? nMid + 1 : nMid;
		} else {
			if (strCurrentWord < strKeyword)  {
				nHigh = (nHigh == nMid) ? nMid - 1: nMid;
			} else {
				bFound = true;
				break;
			}
		}
	}

	if (bFound) {
		return nMid;
	} else {
		return -1;
	}
}


// QuickSort
var gbSortChar = new Array();
var gbNeedStem = true;

function SortTopics(FtsDiv, SearchTopicArray, nStart, nEnd)
{
	if (nEnd - nStart > 0) {
		var nLastLow = nStart;

		// Get the first value into its proper spot
		for (var i = nStart + 1; i <= nEnd; i++) {
			if ((SearchTopicArray[i] != -1) && (SearchTopicArray[nStart] != -1) &&
			    compare(FtsDiv.gTE[SearchTopicArray[i]].strTitle, FtsDiv.gTE[SearchTopicArray[nStart]].strTitle) < 0 ) {
				nLastLow++;
				temp = SearchTopicArray[i];
				SearchTopicArray[i] = SearchTopicArray[nLastLow];
				SearchTopicArray[nLastLow] = temp;
			}
		}
		temp = SearchTopicArray[nStart];
		SearchTopicArray[nStart] = SearchTopicArray[nLastLow];
		SearchTopicArray[nLastLow] = temp;

		// Sort the two halves of this array surrounding the new spot for the first value
		SortTopics(FtsDiv, SearchTopicArray, nStart, nLastLow);
		SortTopics(FtsDiv, SearchTopicArray, nLastLow + 1, nEnd);
	}
}

function compare(strTitle1, strTitle2)
{
	if (gbSortChar.length < 256) {
		var strt1 = strTitle1.toLowerCase();
		var strt2 = strTitle2.toLowerCase();
		if (strt1 < strt2) return -1;
		if (strt1 > strt2) return 1;
		return 0;
	}
	else {
		for (var i = 0 ; i < strTitle1.length && i < strTitle2.length; i ++) {
			if (gbSortChar[strTitle1.charCodeAt(i)] < gbSortChar[strTitle2.charCodeAt(i)]) return -1;
			if (gbSortChar[strTitle1.charCodeAt(i)] > gbSortChar[strTitle2.charCodeAt(i)]) return 1;
		}
		if (strTitle1.length < strTitle2.length) return -1;
		if (strTitle1.length > strTitle2.length) return  1;
		return 0;
	}
}

function GetFlagChar(strchar)
{
	if (gbSortChar.length < 256 || strchar.length > 1) {
		return strchar.toUpperCase();
	}
	else {
		for (var i = 0 ; i < 256; i ++) {
			if (gbSortChar[i] == gbSortChar[strchar.charCodeAt(0)])
				return String.fromCharCode(i);
		}
		return strchar;
	}
	
}

function IsStopWord(strCurrentWord, aFtsStopArray, nStopArrayLen)
{
	// Search for the current word in the array (binary search)
	var nLow = 0; 
	var nHigh = nStopArrayLen - 1;
	var nMid = 0;
	var bFound = false;
	var strStopWord = "";
	while (nLow <= nHigh) {
		nMid = (nLow + nHigh);
		nMid >>= 1;
//		strStopWord = aFtsStopArray[nMid].strStopWord;
		strStopWord = aFtsStopArray[nMid];
		if (strCurrentWord > strStopWord) {
			nLow = (nLow == nMid) ? nMid + 1 : nMid;
		} else {
			if (strCurrentWord < strStopWord) {
				nHigh = (nHigh == nMid) ? nMid - 1: nMid;
			} else {
				bFound = true;
				break;
			}
		}
	}

	if (bFound) {
		return true;
	} else {
		return false;
	}
}


/////////////////////////////////////////////////////////////
//
// NOTE: If you change this function, you should also change
// it in the FtsDatabase.CPP file
//
/////////////////////////////////////////////////////////////
function GetStem(szWord)
{
	if (!gbNeedStem) return szWord; 
	var aStems = new Array();
	aStems[0] = "ed";
	aStems[1] = "es";
	aStems[2] = "er";
	aStems[3] = "e";
	aStems[4] = "s";
	aStems[5] = "ingly";
	aStems[6] = "ing";
	aStems[7] = "ly";

	// Loop through all the stems
	var nNumStems = aStems.length;
	var	nStemPos = 0;
	var csStem = "";
	var csSubString = "";
	for (var iStem = 0; iStem < nNumStems; iStem++) {

		// Get the "would be" position of the stem in the word and see
		// if this word has the stem
		nStemPos = szWord.lastIndexOf(aStems[iStem]);
		if (nStemPos > 0) {
			csSubString = szWord.substring(nStemPos);
			if (csSubString == aStems[iStem]) {
				
				// Found a stem

				// Check for double consonant
				csStem = szWord;
				if (szWord.charAt(nStemPos - 2) == szWord.charAt(nStemPos - 1)) {
					csStem = csStem.substring(0, nStemPos - 1);
				} else {
					csStem = csStem.substring(0, nStemPos);
				}
				return csStem;
			}
		}
	}

	// No stem found
	csStem = szWord;
	return csStem;
}

////////////////////////////////////////////////////////////////////////////////////////////////
//
// Navgation Bar Code
//
////////////////////////////////////////////////////////////////////////////////////////////////

function NavBar_SelectTOC()
{
	var frameLeft = null
	if (gbNav4) {
		frameLeft = window.parent.left;
	} else {
		frameLeft = window.parent.frames("left");
	}
	frameLeft.ChangeToTOC();
}

function NavBar_SelectIndex()
{
	var frameLeft = null
	if (gbNav4) {
		frameLeft = window.parent.left;
	} else {
		frameLeft = window.parent.frames("left");
	}
	frameLeft.ChangeToIndex();
}

////////////////////////////////////////////////////////////////////////////////////////////////
//
// Function support sync toc for DHTML
//
////////////////////////////////////////////////////////////////////////////////////////////////

var gb_strCurrentURL = "";
var gb_res = null;

function NavBar_SyncToc(strRelURL)
{
	var strHomeURL = location.href;
	if (location.hash.length > 0) 
		strHomeURL = location.href.substring(0, location.href.indexOf("#"));

	var strHomePath = strHomeURL.substring(0, strHomeURL.lastIndexOf("/"));
	var strAbsURL = strHomePath + "/" + strRelURL;

	var containTags = new Array();
	strAbsURL = NavBar_ReplaceSlash(strAbsURL);
	strAbsURL = NavBar_ConvertToURLFormat(strAbsURL);
	var OrgScrollLeft = document.body.scrollLeft;

	if (gb_strCurrentURL == strAbsURL) {
		if (gb_res != null) {
			gb_res.focus();
			document.body.scrollLeft = OrgScrollLeft;
		}
		return;
	}
	var res = NavBar_SearchTocEx(document.body, strAbsURL, strRelURL, containTags, 0);
	if (res >= 0) 
	{
		for (i = 0; i < res; i ++ ) {
			var elId = containTags[i].id;
			elId = elId.substring(0, elId.indexOf("Child"));
			if (elId != null && elId.length != 0)
				TocExpandIt2(elId, true);
		}
		gb_res = containTags[res];
		containTags[res].focus();
		document.body.scrollLeft = OrgScrollLeft;
	}
	gb_strCurrentURL = strAbsURL;
}

//Hash code for speeding up AutoSync
function HrefHashCode(strRelHref)
{
	var lHashCode = 0;
	var lValue = 0;
	for (i = 0; i < strRelHref.length; i ++)
	{
		var nCode = strRelHref.charCodeAt(i);
		lValue = nCode;
		if ((nCode >= 97) && (nCode <= 122))	//'a'~'z'
			nCode = nCode-97+65;				//to 'A'~'Z'
		else if (nCode == 92)					//'\'
			nCode = 47;							//'/'
		lValue = nCode;
		lHashCode = (((lHashCode * 43) & (0x00ffffff)) + lValue) & (0x00ffffff);
	}
	return lHashCode;
}

//The old way of search Toc entity is too slow: JavaScript spend too many time on fetch info from tag.
//and id of the tag is the best way to quick accessing.
//if the DHTML structure changed . the following code MUST MODIFY.
function NavBar_SearchTocEx(tagsObject, strAbsURL,strRelURL, containTags, level)
{
	if (typeof HST == "undefined")
		return NavBar_SearchToc(tagsObject, strAbsURL, containTags, level);

	var cTagsA = document.all.tags("A");
	var lHashCode = HrefHashCode(strRelURL);
	var i;
	var bFindMatch = false;
	var cFindTag
	for (i = 0; i< HST.length; i++)
	{
		if (lHashCode == HST[i])
		{
			var hid = "h"+i;
			var cTag = cTagsA[hid];
			if (typeof cTag != "undefined")
			{
				var hrefURL = NavBar_ReplaceSlash(cTag.href);
				hrefURL = NavBar_ConvertToURLFormat(hrefURL);
				if (hrefURL == strAbsURL)
				{
					bFindMatch = true;
					cFindTag = cTag;
					break;
				}
			}
		}
	}
	if (bFindMatch)
	{
		//Find the the containers: from inner to outer
		var cRevContainTags = new Array;
		var level =0;
		var cParentTag = cFindTag.parentElement;
		cRevContainTags[level++] = cFindTag;
		do
		{
			if (cParentTag.tagName == "DIV")
			{
				var id = cParentTag.id;
				if (typeof id != "undefined")
				{
					if (id.indexOf("Child") != -1)
						cRevContainTags[level++] = cParentTag;
				}
			}
			cParentTag = cParentTag.parentElement;	
		}while(!((cParentTag.tagName == "BODY") || (cParentTag.tagName == "HTML")))
		
		var j = 0;
		for (i=level-1; i >= 0 ; i--)
		{
		  containTags[i] = cRevContainTags[j++];		
		}
		return level-1;
	}
	return -1;
}

// if the DHTML structure changed . the following code MUST MODIFY.
// Currently do not support IE4.5 on Mac. because on iMac we will capsulate all the contents in a <TABLE>.
// for IE 4.5 will wrap text which is not good for us.
// so if want to enable IE4.5. something need to take care here.
// now we are using Applet for IE 4.5 instead of DHTML for some other reasons.
function NavBar_SearchToc(tagsObject, strAbsURL, containTags, level)
{
	var i = 0;
	var j = 0;
	var collBlock = tagsObject.children.tags("BLOCKQUOTE");
	if (collBlock != null) {
		for (i = 0; i < collBlock.length ; i ++ )
		{
			// here we assume each BLOCKQUOTE has one and only one DIV
			containTags[level] = collBlock[i].children.tags("DIV")[0];
			var res = NavBar_SearchToc(containTags[level], strAbsURL, containTags, level + 1);
			if (res != -1)
				return res;
		}

	}
	var collA = tagsObject.all.tags("A");
	if (collA != null) {
		for (j = 0; j < collA.length; j ++ )
		{
			var hrefURL = NavBar_ReplaceSlash(collA[j].href);
			hrefURL = NavBar_ConvertToURLFormat(hrefURL);
			if (hrefURL == strAbsURL)
			{
				containTags[level] = collA[j];
				return level;
			}
		}

	}
	return -1;
}

// replace \\ to /
function NavBar_ReplaceSlash(strURL)
{	
	var strReplacedURL = "";
	var i = 0;
	for (i = 0; i < strURL.length; i ++ )
	{
		if (strURL.charAt(i) == '\\') 
			strReplacedURL = strReplacedURL + "/"
		else
		    strReplacedURL = strReplacedURL + strURL.charAt(i);
	}
	return strReplacedURL;
}

function ItemFocus()
{
	if (gb_strCurrentURL.length > 0 ) {
		if (gb_res != null) {
			gb_res.focus();
		}	
	}
}

// mark the current clicked url.
function MarkIt()
{
	var strURL = window.event.srcElement.href;
	strURL = NavBar_ConvertToURLFormat(strURL);
	gb_strCurrentURL = strURL;
	gb_res = window.event.srcElement;
	if (typeof(parent.parent.NavFrame) != "undefined" &&
		typeof(parent.parent.NavFrame().gstrAutoSyncURL) != "undefined")
		parent.parent.NavFrame().gstrAutoSyncURL = "";
}


// change àáã to %E0%E1%E3
function NavBar_ConvertToURLFormat(strURL)
{
	var strResURL = "";
	var i = 0;
	for (i = 0; i < strURL.length; i ++)
	{
		var nCode = strURL.charCodeAt(i);
		if (nCode > 127) {
			strResURL += "%";
			var strTemp = String.fromCharCode(HEXToCharCode(nCode/16), HEXToCharCode(nCode%16));
			strResURL += strTemp
		}
		else 
			strResURL += strURL.charAt(i);
	}
	return strResURL;
}

function HEXToCharCode(n)
{
	if (n < 10) {
		return '0'.charCodeAt(0) + n;
	}
	else if (n < 16) {
		return 'A'.charCodeAt(0) + (n - 10);
	}
	else
		return 0;
}
