
		var gstrNavFrmst = "navpane1.htm";
		var gstrTocDhtml = "tocdhtml.htm";
		var gstrIdxDhtml = "idxdhtml.htm";
		var gstrFtsDhtml = "ftsdhtml.htm";
		var gstrIniDhtml = "tocdhtml.htm";

		var gnPageWidth = 0;
		var gnPageHeight = 0;
		var gstrColl = "";
		var gstrStyle = ""
		var gbNav4 = false;
		var gbIE4 = false;
		var gbIE = false;
		var gbIE5 = 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 gIndexTopicArray = new Array();
		var gIndexKeywordArray = new Array();
		var gIndexLetterArray = new Array();

		var gbFtsInputEnable = false;
		var gFtsKeywordArray = new Array();
		var gFtsTopicArray = new Array();
		var gFtsStopArray = new Array();
		var imgBookClose ="images/groupclose.gif";
		var imgBookOpen  ="images/groupopen.gif";

		var  elTocArray = new Array();
		var  elTocArrayNum = 0;
		
		//for parcel layers visibility
		
		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.0") != -1) {
				gbIE5 = true;
			}
		}
		var t;
		var tName = "";
		if (opener) {
			if (opener.name=="MapFrame") {
				t = opener.parent.MapFrame;
				tName = "opener.parent.MapFrame.";
			} else {
				t = opener;
				tName = "opener.";
			}
		} else {

			if (parent.MapFrame!=null) {
				t = parent.MapFrame;
				tName = "parent.MapFrame.";
			} else {
				t=document;
			}
		}
		var tempColl = document.all.tags("A");
		if (tempColl.length > 0) {
			tempColl(0).focus();
		}

		function TocExpandIt(elId){
		var group = elId.replace("Group","");
			
				if (t.LayerVisible[group] == 0) {
					t.LayerVisible[group] = 1;
				}else {
					t.LayerVisible[group] = 0;
				}
				
				var child = TocExpandIE(elId, true, false);
				var nNewScroll = document.body.scrollTop;
				t.tocScroll=nNewScroll
				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;
			return;
		}

		function TocReExpand(elId){
			var child = TocExpandIE(elId, true, false);
			var nNewScroll = t.tocScroll;
			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;
			return;
		}
		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;
		}
		function layerReset(){
			var nNewScroll = document.body.scrollTop;
			t.tocScroll=nNewScroll
			for(var r=0;r<t.layerCount;r++){
				t.LayerVisible[r] = t.ResetLayers[r];
			}
			t.clearSelection();
			//t.sendMapXML();
			parent.TOCFrame.location="toc.htm";
		}

		function newImage(arg) {
			if (document.images) {
				rslt = new Image();
				rslt.src = arg;
				return rslt;
			}
		}

		function changeImages() {
			if (document.images && (preloadFlag == true)) {
				for (var i=0; i<changeImages.arguments.length; i+=2) {
					document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
				}
			}
		}

		var preloadFlag = false;
		function preloadImages() {
			if (document.images) {
				RefreshMap_01_over = newImage("images/images/Refresh_01-over.png");
				RefreshMap_01_down = newImage("images/images/Refresh_01-down.png");
				preloadFlag = true;
			}
		}
		function setActiveLayer(i,group) {
		t.activegroup=t.Groups[group-1000];
			var nNewScroll = document.body.scrollTop;
			t.tocScroll=nNewScroll
			var theForm = document.forms[0];
			t.ActiveLayer=t.LayerID[i];
			t.ActiveLayerType=t.LayerType[i];
			t.ActiveLayerIndex=i;
			t.setActiveLayer(i);
			if (t.toolMode==15) {
				var isOk = t.checkHyperLinkLayer(i)
				if (!isOk) {
					t.currentHyperLinkLayer="";
					t.currentHyperLinkField="";
					alert("This layer does not have any HyperLinks.");

				}
			}

			// highlight the active layer, unhighlight others
			var sLyrLink;
			for (var m=0;m<t.layerCount;m++) {
		
				sLyrLink = "LayerLink" + m;
				if (document.links.item(sLyrLink) != null) {
					if (m==t.ActiveLayerIndex) {
						document.links.item(sLyrLink).style.backgroundColor = "yellow";
					}else{
						document.links.item(sLyrLink).style.backgroundColor = "";
					}
				}
			}
		//parent.ModeFrame.location="ModeFrame.htm";
		}

		function showLayerInfo(i) {
			t.showLayerInfo(i);
		}

		// refresh map display with checked layers visible
		function updateLayers() {
			
			//alert(parent.TOCFrame.document.forms[0].LayerVisible.length);
			var nNewScroll = document.body.scrollTop;
			t.tocScroll=nNewScroll
			var theForm = document.forms[0];
			var j = 0;
			if (theForm.LayerVisible.length>1) {
				for (var i=0;i<theForm.LayerVisible.length;i++) {
						j = theForm.LayerVisible[i].value;
						if (j == -9999) {
							    if (theForm.LayerVisible[i].checked) {
									t.setGroup(1);
								}
								else {
									t.setGroup(0);
								}
						} else {
								if (theForm.LayerVisible[i].checked) {
									t.LayerVisible[j] = 1;
									if (j==54) alert("Notice: Contour lines were derived from a digital elevation model (DEM) and therefore should be used for reference purposes only and not for any kind of engineering or design decisions.")
								}
								else {
									t.LayerVisible[j] = 0;
								}
						}
				}
			} else {
				if (j == -9999) {
								if (theForm.LayerVisible[i].checked) {
									t.setGroup(1);
								}
								else {
									t.setGroup(0);
								}
				} else {
					if (theForm.LayerVisible.checked) {
						j = theForm.LayerVisible.value;
						t.LayerVisible[j] = 1;
						if (j==54) alert("Notice: Contour lines were derived from a digital elevation model (DEM) and therefore should be used for reference purposes only nad not for any kind of engineering or design decisions.")
					}
					else {
						t.LayerVisible[j] = 0;
					}
				} //j = -9999
			}
			t.sendMapXML();
		}
		
		function updateTOCs(){
			if (t.autoRefresh==true) {
				updateLayers();
			} 
		}

		
			function updateParcels(){
				var theForm = document.forms[0];
				//var appDir = parent.MapFrame.getPath(document.location.pathname);
			if (theForm.ParcelAll.checked) {
				for (var i=25;i<=27;i++) {
					theForm.LayerVisible[i].checked=true;
					}
				}else {
					for (var i=25;i<=27;i++) {
					theForm.LayerVisible[i].checked=false;
					}
				}
			}

			function updateWater(){
				var theForm = document.forms[0];
				//var appDir = parent.MapFrame.getPath(document.location.pathname);
			if (theForm.WaterAll.checked) {
				for (var i=20;i<=24;i++) {
					theForm.LayerVisible[i].checked=true;
					}
				}else {
					for (var i=20;i<=24;i++) {
					theForm.LayerVisible[i].checked=false;
					}
				}
			}
		// stop displaying the Layerlist
		// 	only works in  separate window
		function closeIt() {
			t.LayerListOpen=false;
			window.close();
		}
		// startup function for separate window
		function startUp() {
			if (opener) {
				t.LayerListOpen=true;
				window.focus();
			}
		}

