// HiTOC - A HIERARCHICAL TABLE OF CONTENTS GENERATOR
// Version 3.05
//
// Copyright © 1998-2000 Alexei Kourbatov
//
// You can reuse this script provided that you do not remove
// the copyright notices and do not change the script in any
// ways except as described in the HiTOC Guide.
//
// For help visit http://www.javascripter.net/hitoc-guide/ 

v4 =(parseInt(navigator.appVersion)>3)	?1:0
ns4=(navigator.appName=="Netscape"&& v4)?1:0
ie4=(navigator.appName!="Netscape"&& v4)?1:0
function silentError() {return true}
if(parseInt(navigator.appVersion)>2) window.onerror=silentError

if(!self.iconPath)		iconPath="images/"
if(!self.iconSize)		iconSize="width=17 height=15"
if(!self.iconStyle)		iconStyle=9999
if(!self.plusMinus)		plusMinus="no"
if(!self.TOCFrame)		TOCFrame="self.nav"
if(!self.pageFrame)		pageFrame="self.main"
if(!self.defaultTarget) defaultTarget="main"
if(!self.bgrImage)		bgrImage=""
if(!self.bgrColor)		bgrColor="#000088"
if(!self.txtColor)		txtColor="#CCFFFF"
if(!self.lnkColor)		lnkColor="#FFFFFF"
if(!self.lnkSubColor)	lnkSubColor="#FFFFFF"
if(!self.hghColor)		hghColor="#FFFFCC0"
if(!self.fontName)		fontName="Arial,Helvetica,Geneva,sans-serif"
if(!self.fontSize)		fontSize=10
if(!self.fontSize)		ftSize=2
if(!self.fontItalic)	fontItalic=0
if(!self.fontBold)		fontBold=1
if(!self.hideSubtopics)	hideSubtopics="collapse"
if(!self.showSubtopics)	showSubtopics="expand"
if(!self.showPage)		showPage="go to this page"
if(!self.restoreSettings)	restoreSettings=0
if(!self.restoreTree)		restoreTree=0
if(!self.hlight)			hlight=1
if(!self.doCollapse)		doCollapse=1
if(!self.underlineLinks)	underlineLinks=0
if(!self.underlineAlinks)	underlineAlinks=1
if(!self.pointCurr)			pointCurr=0
if(!self.Bheight)			Bheight = 25
if(!self.Bwidth)			Bwidth =150
if(!self.Bsubheight)		Bsubheight = 20
if(null==self.NavVertMargin) NavVertMargin = 10
if(!self.Bsubwidth)			Bsubwidth = 140
if(!self.FrameWidth)		FrameWidth = 150
if(!self.indentSize)		indentSize = 10
if(null==self.hlightAlinks)	hlightAlinks=1
if(null==self.topLevel)		topLevel=1
if(null==self.navButtonDimStr)		navButtonDimStr='height="10" width="140"'
if(null==self.motifDirectory)		motifDirectory=''
if(null==self.navButtonDimSmall)	 navButtonDimSmall=navButtonDimStr
if(null==self.lowerNavImageStr)	 lowerNavImageStr=""
if(null==self.lowerNavImgValign)	 lowerNavImgValign='top'
if(null==self.subnavindent)	 subnavindent=''
if(null==self.CustomNavDir)	 CustomNavDir=''
if(null==self.TopNavImageStr)	 TopNavImageStr=""


if(topLevel && window!=top) top.location=''+self.location

var imax,j,n,altxt,docID,rootURL,trueRootURL,docURL,trueDocURL,testStr,pmOn
var numCustomButtons=0;

nowClosed=2;	prevPage=0;	curLevel=1;	spaceCode=-99999900
nowOpen=1;	nextPage=0;	buf="";		titleCode=-88888800
toShow=-1;	curPage=0;	addPath="";	i=0
nPages=0;	curSel=-1;	DY=0;		wizardButtons=0
noIcons=9999

// ARRAYS
txt =new Array(); levl=new Array(); tgt =new Array()
addr=new Array(); nxtp=new Array(); page=new Array()
stat=new Array(); nxtt=new Array(); pagetop=new Array()
btnAry=new Array(); btnRollAry=new Array();

wizButtonCode=new Array()

function fillArrays() {
 n=0;
 for(i=0;i<imax;i++) {
  j=i+1
  while(j<imax && !txt[j]) j++
  nxtp[i]=j
  nxtt[i]=j
  if(stat[i]%100!=0) {
   j=nxtp[i]
   while(j<imax && levl[j]>levl[i]) {j++}
   nxtt[i]=j
  }
  if(addr[i]!="" && tgt[i]==defaultTarget) {
   if(n==0 || n>0 && cutAnchor(addr[i])!=page[n-1] ) {
    page[n]=cutAnchor(addr[i])
    pagetop[n]=i
    n++
   }
  }
 }
 nPages=n
}

// TREE DEFINITION FUNCTIONS

function Group(gs) {
	j=i-1; while(j>0 && !txt[j]) j--
	stat[j]=100*iconStyle+gs
	curLevel++
}

function endGroup() {curLevel--; if(curLevel<1) curLevel=1}

function item(itemTitle,itemURL,itemTarget,btnURL) {
	var btnrollover
	levl[i]=curLevel
	stat[i]=100*iconStyle

	if(isExtLink(itemURL) || !itemURL){ addr[i]=itemURL}
	else {  addr[i]=rootURL+itemURL }
	if (itemURL==" ") {
		addr[i]=null
	}
	txt[i]=itemTitle
//	set the target to top if its an external link
	if(itemTarget!=null) tgt[i]=itemTarget
	else tgt[i] = (isExtLink(addr[i]) && (addr[i].indexOf(rootURL) == -1))  ? "_top" : defaultTarget 

	if (btnURL != "" && btnURL != null){
		btnAry[i]=CustomNavDir+btnURL;
		btnrollover=btnAry[i].split(".");
		btnRollAry[i]=btnrollover[0]+'_on.'+btnrollover[1]
		numCustomButtons++;
	}
	else{
		btnAry[i]=null;
		btnRollAry[i]=null;
	}

	i++
}
//----------------------------------------------------
function vspace(pix) {
 levl[i]=curLevel
 stat[i]=spaceCode
 addr[i]=''
 txt[i]=pix
 tgt[i]=defaultTarget
 i++
}

function title(par) {
 levl[i]=curLevel
 stat[i]=titleCode
 addr[i]=''
 txt[i]=par
 tgt[i]=defaultTarget
 i++
}

// URL ANALYSIS FUNCTIONS-----------------------------------

function findRootURL() {
 trueRootURL=regularize(""+self.location)
 trueRootURL=trueRootURL.substring(0,trueRootURL.lastIndexOf("/")+1)
 rootURL=trueRootURL.toLowerCase()
}

function isExtLink(theURL) {
 var tStr=(""+theURL).substring(0,6)
 return (tStr=="http:/" || tStr=="https:" || tStr=="ftp://")
}

function cutAnchor(inStr) {
 var outStr=""+inStr
 var k=outStr.indexOf("#")
 if(k>-1) outStr=outStr.substring(0,k)
 return outStr
}

function cutQuery(inStr) {
 var outStr=""+inStr
 var k=outStr.indexOf("?")
 if(k>-1) outStr=outStr.substring(0,k)
 return outStr
}

function regularize(theURL) {
 theURL=cutQuery(cutAnchor(theURL))
 for(j=0;j<theURL.length;j++) {
  if(theURL.charAt(j)=="\\") theURL=theURL.substring(0,j)+"/"+theURL.substring(j+1,theURL.length)
 }
 return theURL
}

// TREE PAGE GENERATION FUNCTIONS----------------------------------------

function showTopics(k) {
 if(k>=0) { 
  if(stat[k]%100==nowOpen)	stat[k]++ 
  else if(stat[k]%100==nowClosed)stat[k]-- 
  if(doCollapse) {collapseAll(k); expandThis(k)}
  setUCT()
 }
 if(ns4) saveTree()
 setTimeout("renewTOC()",1)
}

setFont=""
endFont=""
function setFontTags() {
 if(fontItalic=="1" || fontItalic=="yes") {setFont="<i>";endFont="</i>"}
 else {setFont=""; endFont=""}
 if(fontBold=="1" || fontBold=="yes") {setFont="<b>"+setFont; endFont+="</b>"}
}

function renewTOC() {
 setFontTags()
 curSel=-1
 if(v4) {
  if(ns4 && self.TOCLayer) eval(TOCLayer+".src=''+"+TOCLayer+".src")
  else eval(TOCFrame+".location=''+"+TOCFrame+".location")
  return
 }
 i=0
 initBuf()
 
 while(true) {
  finished=setBuf(15000)
  eval(TOCFrame+".document.write(buf)"); buf=''
  if(finished) break
 }

 buf+="</font></pre></BODY></HTML>"+"\n"
 eval(TOCFrame+".document.write(buf)")
 eval(TOCFrame+".document.close()")
 return
}
//-----------------------INITIALIZE THE PAGE HTML------------------
bufTxt=''
function initBuf() {
	var bg,tbltags,bodymargins,navVerticalSpace;
	pmOn=(plusMinus=="yes"||plusMinus=="1")
	bufTxt=''
	buf='<BASE HREF="'+self.trueRootURL+'"></HEAD><!--whatsup-->\r\n'
	if((''+bgrImage).indexOf('.')!=-1){
		bg=bgrImage;
	}
	else {
		bg='bgcolor="'+bgrColor+'" ';
	 }
	if (numCustomButtons>0)	{
		tbltags='align="left"';
		bodymargins=' marginwidth="0" marginheight="0" leftmargin="0" topmargin="0"';
		//navVerticalSpace="";
		if (NavVertMargin > 0)
		{
			navVerticalSpace='<tr><td height="'+NavVertMargin+'">'+TopNavImageStr+'&nbsp;</td></tr>'+"\n";
		}else{
			navVerticalSpace="";
		}

	}else{
		tbltags='align="center" width="'+(FrameWidth-10)+'"';
		bodymargins="";
		if (NavVertMargin > 0)
		{
			navVerticalSpace='<tr><td height="'+NavVertMargin+'">'+TopNavImageStr+'&nbsp;</td></tr>'+"\n";
		}else{
			navVerticalSpace="";
		}

	}

	buf+='<BODY '+bg+'" text="'+txtColor+'" link="'+lnkColor+'" alink="'+lnkColor+'" vlink="'+lnkColor+'"'


	if(v4 && !hlight) buf+='" onLoad="setTimeout(\'scrollTo(0,parent.DY)\',1)"';

 //	got to set based on nav width
	buf+=bodymargins+'>'+"\n";
	if (!(ns4 && lowerNavImgValign=='top'))
	{
		buf+='<table border=0 cellspacing=0 cellpadding=0 height=100% width=100%><tr height=10%><td valign=top>';
	}
	buf+='<table '+tbltags+' border="0" cellpadding="0" cellspacing="0">'+"\n"+navVerticalSpace
//	buf+='<!--numcustombuttons='+numCustomButtons+'-->'+"\n";
	//	dumptables();
}
//-------------------------

onClk="parent.focus()"
onClk1=""
if(ns4) onClk1="parent.DY=self.pageYOffset;parent.focus()"
if(ie4) onClk1="parent.DY=self.document.body.scrollTop;parent.focus()"

leftSpace=''

function setBuf(lenBuf) {
	var lowerColor,twidth,theight,leadchar,buttonnameoff
	var junk

	while(i<imax) {
		nexti=(stat[i]%100==nowClosed)?nxtt[i]:nxtp[i]
		if(levl[i]>1) {
			bface=""
			bfaceEnd=""
			lowerColor=lnkSubColor
//			twidth=Bsubwidth - ((levl[i]-2)*10) not using subnav width !!
			twidth=Bwidth - ((levl[i]-2)*10)
			theight=Bsubheight
			if (null== btnAry[i]) {
				buttonname = motifDirectory+'navbuttons_sm.gif'
			}else{
				buttonname =btnAry[i]
				//txt[i]=""
			}

			btnfontsize = ftSize-1 ;
			leadchar="";
		}
	else{
		lowerColor= lnkColor
		bface="<b>"
		bfaceEnd="</b>"
		twidth=Bwidth
		theight=Bheight
		if (null== btnAry[i]) {
			buttonname = motifDirectory+'navbuttons.gif'
		}else{
			buttonname =btnAry[i]
		}
		btnfontsize = ftSize
		leadchar=''
	}


	if (  btnAry[i]==null )
	{  // no rollovers or custom buttons
			 buf+='<tr><td align=center>'
		buf+='<table width="'+twidth+'" height="'+theight+'" border="0" cellspacing="0" cellpadding="0" background="'+buttonname+'">'+"\n"+'<tr><td>'
		buf+='<table  align="right" width="'+(twidth-indentSize)+'" height="'+theight+'" border="0" cellspacing="0" cellpadding="0" background="">'+"\n"+'<tr><td>'
		buf+='<font face="'+fontName+'" size='+btnfontsize+'>'+"\n"	
		//junk+=' i='+i+'name='+txt[i]+' nexti='+nexti+' nxtti='+nxtt[i]+' nxtpi='+nxtp[i]+"\n";
		isOpen=(stat[i]%100==nowOpen)
		altxt=isOpen? hideSubtopics:showSubtopics
		if(stat[i]%100==0) {  	//output the lowest level visible links ie no children , could be top level !
			buf+='<A id=c'+i+' onMouseOver="parent.movr('+i+',1);return true" onMouseOut="parent.mout('+i+');return true" onClick="parent.mout('+i+');'
			buf+= onClk+'" HREF=\"'+addr[i]+'" target="'+tgt[i]+'">'+"\n"
			buf+='<font face="'+fontName+'" size="'+btnfontsize+'" color="'+lowerColor+'">'+"\n"
			buf+= setFont+leftSpace+leadchar+txt[i]+endFont+"\n</font></a></font>\n"
		}else {   //-------Parent links --------
			buf+='<A  id=c'+i+' onMouseOver="parent.movr('+i+',1);return true" onMouseOut="parent.mout('+i+');return true" '
	//		link is set for section label
			if(addr[i] && addr[i] != "") buf+=' onClick="'+onClk1+';parent.showTopics('+i+')" HREF="'+addr[i]+'" target="'+tgt[i]+'">'
			else buf+=' onClick="'+onClk1+'" HREF="javascript:parent.showTopics('+i+')">' 	// no link set for section label 
		// output the label text 
			buf+="\n"+'<font face="'+fontName+'" size="'+btnfontsize+'" color="'+lowerColor +'">'+"\n"+setFont+leftSpace+leadchar+txt[i]+endFont+"\n</font></A></font>\n"
			} 
			buf+='</td></tr></table>'+"\n"+'</td></tr></table>'+"\n"+'</td></tr>'+"\n"   // close off this button/link
	}else{ //rollovers and custom buttons
		buf+='<tr><td align=left>'+"\n"

		isOpen=(stat[i]%100==nowOpen)
		altxt=isOpen? hideSubtopics:showSubtopics

		if(stat[i]%100==0) {  	//output the lowest level visible links ie no children , could be top level !
			buf+='<a id=c'+i+' onMouseOver="parent.movr('+i+',1);return true" onMouseOut="parent.mout('+i+');return true" onClick="parent.mout('+i+');'
			buf+= onClk+'" HREF=\"'+addr[i]+'" target="'+tgt[i]+'">'+"\n"
			buf+='<img name="navbtn'+i+'" alt="'+txt[i]+'" src="'+buttonname+'" border="0" width="'+twidth+'" height="'+theight+'"></a>'	
		//alert('name="navbtn'+i+'" src="'+buttonname+'" '+btnRollAry[i]);
		}
		else {   //-------Parent links --------
			buf+='<A  id=c'+i+' onMouseOver="parent.movr('+i+',1);return true" onMouseOut="parent.mout('+i+');return true" '
	//		link is set for section label
			if(addr[i] && addr[i] != "") buf+=' onClick="'+onClk1+';parent.showTopics('+i+')" HREF="'+addr[i]+'" target="'+tgt[i]+'">'+"\n"
			else buf+=' onClick="'+onClk1+'" HREF="javascript:parent.showTopics('+i+')">'+"\n"	// no link set for section label 
			buf+='<img name="navbtn'+i+'" alt="'+txt[i]+'" src="'+buttonname+'" border="0" width="'+twidth+'" height="'+theight+'"></a>'	
			//alert('name="navbtn'+i+'" src="'+buttonname+'" '+btnRollAry[i]+' xx');
		} 
		buf+="</td></tr>\n"   // close off this button/link
	}


	if(lenBuf >100 && buf.length >lenBuf){
		alert('buffer size exceeded -lenbuf='+lenBuf+' bufsize='+ buf.length);
		return false   // nav bar larger than buffer allocated

	}
	//junk+='updating i='+i+' nexti='+nexti+"\n"
	//alert(junk);
	i=nexti
 } // end while

 buf+='</td></tr></table>\n';   // close off navbar encapsulating table 
 if ( ! lowerNavImageStr == "")  // display image below nav bar if specified 
 {
//	 buf+="\n"+'<center>'+lowerNavImageStr+"</center>\n"
	buf+='</td></tr>\n';

	if (!(ns4 && lowerNavImgValign == 'top'))
	{
		buf+='<tr height=90%><td align="center" valign="'+lowerNavImgValign+'">\n';
		buf+=lowerNavImageStr+'\n';
		buf+='</td></tr></table>\n';
	}else{
		buf+='<center>'+lowerNavImageStr+'</center>\n';
	}

 }
   // close off outer encapsulating table 
 if(self.bufEnd) buf+=bufEnd ;

 return true
}
//---------------------------------------
// PRELOADING IMAGES 
styleIsPage=new Array(1,1,0,0,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0)
if(document.images && 0) {
 hLinkImg=new Image(); hLinkImg.src=iconPath+"shortcut.gif"
 lLinkImg=new Image(); lLinkImg.src=iconPath+"internet.gif"
 spcImg=new Image(); spcImg.src=iconPath+"spacer.gif"
 ptrImg=new Image(); ptrImg.src=iconPath+"pointer.gif"
 for(var k=0;k<=20;k++) {
  if(styleIsPage[k]) {
   eval('hPageImg'+k+'=new Image();hPageImg'+k+'.src="'+iconPath+'shortcut.gif"')
   eval('lPageImg'+k+'=new Image();lPageImg'+k+'.src="'+iconPath+'0.gif"')
  }
  else {
   eval('hPageImg'+k+'=new Image();hPageImg'+k+'.src="'+iconPath+'hibullet.gif"')
   eval('lPageImg'+k+'=new Image();lPageImg'+k+'.src="'+iconPath+(100*k)+'.gif"')
  } 
 }
}

// MOUSEOVER AND MOUSEOUT HANDLERS----------------------------
function movr(i,isTextLink) {
 if(stat[i]%100==0) {
	 if (null== btnAry[i]) { // not custom nav
			self.status=txt[i]
			if(document.images && hlightAlinks && (ie4 || !self.TOCLayer) && eval(TOCFrame+'.document.i'+i)) 
			eval(TOCFrame+'.document.i'+i+'.src=(isExtLink(addr[i]) ? hLinkImg.src : hPageImg'+(Math.floor(stat[i]/100))+'.src)')
	 }
	 else{ //custom nav
	 		//alert(TOCFrame+'.document.navbtn'+i+".src='"+btnRollAry[i]+"'");
			eval(TOCFrame+'.document.navbtn'+i+".src='"+btnRollAry[i]+"'")
	 } 
 }
 else
	if (null== btnAry[i]) { // not custom nav
		  self.status = isTextLink ? txt[i] : ( (stat[i]%100==nowOpen) ? hideSubtopics:showSubtopics)
	} 
	else {
		//alert(TOCFrame+'.document.navbtn'+i+".src='"+btnRollAry[i]+"'-2");
		eval(TOCFrame+'.document.navbtn'+i+".src='"+btnRollAry[i]+"'")
	}
 }

function mout(i) {
	 if (null== btnAry[i]) { // not custom nav
		if(document.images && hlightAlinks && stat[i]%100==0 && eval(TOCFrame+'.document.i'+i)) {
			eval(TOCFrame+'.document.i'+i+'.src=(isExtLink(addr['+i+']) ? lLinkImg.src : lPageImg'+(Math.floor(stat[i]/100))+'.src)')
		}
	 }else{
		//alert(TOCFrame+'.document.navbtn'+i+".src='"+btnAry[i]+"'-3");
			eval(TOCFrame+'.document.navbtn'+i+".src='"+btnAry[i]+"'")
	
}
 self.status=''
}

//------ PREV/NEXT NAVIGATION FUNCTIONS- not used

function queryNum() {
 if(eval(pageFrame+".document")) {
  trueDocURL=regularize(""+eval(pageFrame+".document.location"))
  docURL=trueDocURL.toLowerCase()
  for(j=0;j<nPages;j++) {
   testStr=rootURL+page[j].toLowerCase()
   if(docURL.indexOf(testStr)!=-1) {
    curPage=j
    prevPage=j-1
    nextPage=j+1
    if(prevPage<0) prevPage=curPage
    if(nextPage>=nPages) nextPage=curPage
    return
   }
  }
  curPage=-1
  prevPage=0
  nextPage=0
 }
 return
}

function showNext() {
 queryNum();
 if(curPage==-1) {eval(pageFrame+".history.back()");return;}
 if(nextPage!=curPage) {
  eval(pageFrame+".location=trueRootURL+page[nextPage]");
 }
}

function showPrev() {
 queryNum();
 if(curPage==-1) {eval(pageFrame+".history.back()");return;}
 if(prevPage!=curPage) {
  eval(pageFrame+".location=trueRootURL+page[prevPage]");
 }
}

// SYNCHRONIZATION FUNCTIONS

timerU=null
timerUactive=0
userChangesTree=0

function setUCT() {
 if(v4){
  userChangesTree=1
  if(timerUactive) clearTimeout(timerU)
  timerUactive=1
  timerU=setTimeout("userChangesTree=0;timerUactive=0",9999)
 }
}

function sync() {
 //if((hlight && v4) || pointCurr) {queryNum(); if(curPage>=0) selectItem(pagetop[curPage])}
 setTimeout("sync()",1599);
}

function selectItem(ci) {
 while(!txt[ci]) ci--
 while(ci>0 && addr[ci-1].indexOf(cutAnchor(addr[ci]))!=-1) ci--
 if(isExtLink(addr[ci])) return
 if(!eval(TOCFrame+".document")) return
 if(curSel!=ci && pointCurr && document.images) {
  if(eval(TOCFrame+'.document.p'+ci)) eval(TOCFrame+'.document.p'+ci+'.src=ptrImg.src')
  if(eval(TOCFrame+'.document.p'+curSel)) eval(TOCFrame+'.document.p'+curSel+'.src=spcImg.src')
 }
 if(curSel==ci) {
  if(!isVisible(ci)) curSel=-1
  if(ie4) return
  if(ns4 && txt[ci]==eval(TOCFrame+".document.getSelection()")) return
 }
 if(!isVisible(ci)) {
  if(userChangesTree) return
  showItem(ci)
  return;
 }
 if(hlight && ns4) {
  eval(TOCFrame+".find(txt[ci])")
  while(eval(TOCFrame+".find(txt[ci],0,1)")) {continue}
  offs=bufTxt.indexOf(txt[ci])
  while(bufTxt.lastIndexOf(';:'+ci+':;',offs)!=bufTxt.lastIndexOf(';:',offs)) {
   eval(TOCFrame+".find(txt[ci])")
   offs=bufTxt.indexOf(txt[ci],offs+1)
  }
 }
 if(hlight && ie4) {
  TRange=eval(TOCFrame+".document.body.createTextRange()")
  TRange.moveToElementText(eval(TOCFrame+".document.all['c"+ci+"']"))
  TRange.select()
 }
 curSel=ci;
}

function isVisible(ci) {return(bufTxt.indexOf(';:'+ci+':;')==-1?0:1)}
function showItem(ni) {collapseAll(ni);expandThis(ni);showTopics(-1)}
function clickPlus() {expandAll(99);showTopics(-1);setUCT()}
function clickMinus() {collapseAll(-1);showTopics(-1);setUCT()}
function collapseAll(ci) {for(var i=0;i<imax;i++) {if(stat[i]%100==nowOpen && i!=ci) stat[i]++}}
function expandAll  (lv) {for(var i=0;i<imax;i++) {if(stat[i]%100==nowClosed && levl[i]<lv) stat[i]--}}
function expandThis(ci) {
 var i=ci
 OL=levl[ci]
 while(i>=0) {
  CL=levl[i]
  if(CL<OL) {OL=CL; if(stat[i]%100==nowClosed && i!=ci) stat[i]--}
  if(CL==1) break
  i--; while(!txt[i]) i--
 }
}

//------ OPTIONAL COOKIE SUPPORT

var today =new Date()
var expire=new Date()
expire.setTime(today.getTime()+3600000*24*365)

function saveTree() {
 var i=0
 newstr=""
 while(i<imax) {
  theStat=stat[i]%100
  if(theStat!=0) newstr+=theStat
  i=(theStat==nowClosed)?nxtt[i]:nxtp[i]
 } 
 if(restoreTree) self.document.cookie="HiTOCtree="+escape(newstr)+";expires="+expire.toGMTString()
}

function restoreFromCookie(par) {
 var theCookie=''+self.document.cookie
 var ind=theCookie.indexOf(par)
 if(ind==-1) return
 var ind1=theCookie.indexOf(';',ind)
 if(ind1==-1) ind1=theCookie.length
 var theCode=unescape(theCookie.substring(ind+par.length+1,ind1))
 if(par=='HiTOCsettings') eval(''+theCode)
 if(par=='HiTOCtree') {
  i=0; L=0
  while(i<imax && L<theCode.length) {
   theStat=stat[i]%100
   if(theStat!=0) {
    stat[i]=stat[i]-theStat+parseInt(theCode.charAt(L))
    L++
   }
   i=(stat[i]%100==nowClosed)?nxtt[i]:nxtp[i]
  }
 }
}

//-------- PRE-INITIALIZATION

findRootURL()
if(restoreSettings) restoreFromCookie('HiTOCsettings')

function makeTree() {
 imax=i
 fillArrays()
 if(restoreTree) restoreFromCookie('HiTOCtree')
 setFontTags()
 var dRef=''

 if(document.referrer) dRef=regularize(''+document.referrer)
 var srch=''+unescape(self.location.search)
 if(srch.length>1) dRef=trueRootURL+srch.substring(1,srch.length)
 if(dRef!='' && pageFrame!="self" && pageFrame!="top") {
  for(n=1;n<nPages;n++) {
   if(dRef.toLowerCase().indexOf(rootURL+page[n].toLowerCase())!=-1 && tgt[pagetop[n]]==defaultTarget) {
    setTimeout(pageFrame+".location=trueRootURL+page[n]",999)
    break
   }
  }
 }
}

// INITIALIZATION - AFTER FRAMESET LOADED

function init() {if(v4) setTimeout("sync()",1599)}

function dumptables(){
var ix;
	//alert('numcustom buttons'+numCustomButtons);
	buf+='<!-- numcustom buttons = '+numCustomButtons+"-->\n";
	for (ix=0;ix<numCustomButtons ;ix++ )
	{
		buf+= '<!-- '+ix+' B='+btnAry[ix]+' R='+btnRollAry[ix]+" -->\n";
	}
}
