		var ColorPBG = "#336633";
		var ColorPBGOnSet = "#003300";
		var ColorPBGOnSetNN = "#003300";
		var ColorPBGFont = "#99CC33";
		var ColorPBGFontOnSet = "#ffffff";
		var ColorCBG = "#6699CC";
		var ColorCBGOnSet = "#ffffff";
		var ColorCBGOnSetNN = "#336633";
		var ColorCBGFont = "#ffffff";
		var ColorCBGFontOnSet = "#336699";
		var firstInd = "";
		
		
		
		function getIndex(el) {
		    ind = null;
		    for (i=0; i<document.layers.length; i++) {
		        whichEl = document.layers[i];
		        if (whichEl.id == el) {
		            ind = i;
		            break;
		        }
		    }
		    return ind;
		}
		
		function getCurrentTitle() {                                          
		   //alert(window.parent.frames.parent.frames.parent.frames["mainpage"].document.pageTitle);
		   return window.parent.frames["mainbody"].pageTitle;
		}
		
		function arrange() {
		//alert("in arrange");
		    nextY = document.layers[firstInd].pageY + document.layers[firstInd].document.height + 4;
		    for (i=firstInd+1; i<document.layers.length; i++) {
		        whichEl = document.layers[i];
		        if (whichEl.visibility != "hide") {
		            whichEl.pageY = nextY;
		            nextY += whichEl.document.height + 4;
		        }
		    }
		}
		
		function initMenu(){
		   if (NS4) {
		      for (i=0; i<document.layers.length; i++) {
		         whichEl = document.layers[i];
		         if (whichEl.id.indexOf("Child") != -1) {
		            whichEl.visibility = "hide";
		         }
		      }
		    //arrange();
		   }  
		   else {
		      divColl = document.all.tags("DIV");
		      for (i=0; i<divColl.length; i++) {
		         whichEl = divColl(i);
		         if (whichEl.className == "child") {
		            whichEl.style.display = "none";
		            }
		      }
		   }
		}
		
		
		function isMyChild(childToCompare, parentValue) {
		
		if (NS4) {
		   var isAChild = ((isChild(document.layers[childToCompare].id)) && (document.layers[childToCompare].id.substr(0, document.layers[childToCompare].id.indexOf("Child")) == parentValue)) ? true : false; 
		   return isAChild;
		}
		else {
		var isAChild = ((isChild(childToCompare)) && (childToCompare.substr(0, childToCompare.indexOf("Child")) == parentValue)) ? true : false;
		      return isAChild;
		   }
		}
		
		function toggleIndicator(id, toggle) {
		   
		   if ((toggle == "show") || (toggle == "block")) {
		      if (NS4) 
		         document.layers[id].document.images[id + "_name"].src = eval("ArrowSide.src");
		      else 
		         document.images[id + "_name"].src = eval("ArrowSide.src");
		   }
		   else {
		      if (NS4) 
		         document.layers[id].document.images[id + "_name"].src = eval("ArrowDown.src");
		      else 
		         document.images[id + "_name"].src = eval("ArrowDown.src");
		   }
		}
		
		
		function expandMyChildren(parent) {
		   var state = null;
		   
		   var parentStr = parent.substr(0, parent.indexOf("Parent"));
		   if (NS4) {
		      //alert(document.layers.length);
		      
		      for (i = 0; i < document.layers.length; i++) {
		         
		         if (isMyChild(i, parentStr)) {
		            whichEL = eval("document." + document.layers[i].id.toString());
		            if (whichEL.visibility == "show") {
		               state = whichEL.visibility;
		               whichEL.visibility = "hide";
		            }
		            else
		               whichEL.visibility = "show";
		         }
		      //alert(whichEl.visibilty.toString()); 
		      }
		      //alert("about to do arrange");
		   arrange();
		   }
		   
		   else {
		      divColl = document.all.tags("DIV");
		      for (i = 0; i < divColl.length; i++) {
		         var itemDiv = divColl(i);
		         
		         if (isMyChild(itemDiv.id, parentStr)) {
		            
		            whichEl = eval(itemDiv.id);
		            if (whichEl.style.display == "block") {
		               state = whichEl.style.display;
		               whichEl.style.display = "none";
		            }
		            else 
		               whichEl.style.display = "block";
		         }
		      }
		   }
		toggleIndicator(parent, state);
		}
		
		function openMyChildren(parent) {
		   var childCount = 0;
		   parentStr = parent.substr(0, parent.indexOf("Parent"));
		   if (NS4) {
		      for (i = 0; i < document.layers.length; i++) {
		         if (isMyChild(i, parentStr)) {
		            whichEL = eval("document." + document.layers[i].id.toString());
		            whichEL.visibility = "show";
		            childCount++;           
		         }
		      }
		   arrange();
		   }
		   else {
		      divColl = document.all.tags("DIV");
		      for (i = 0; i < divColl.length; i++) {
		         var itemDiv = divColl(i);
		         if (isMyChild(itemDiv.id, parentStr)) {
		            whichEl = eval(itemDiv.id);
		            whichEl.style.display = "block";
		            childCount++;
		         }
		      }
		   }
		
		   if (childCount > 0) {
		      toggleIndicator(parent, "");
		   }
		
		}
		
		function applyColorsTo(id, backgroundColor, fontColor) {
		   if (NS4) {
			  if (document.layers[id]) {
				document.layers[id].document.bgColor = backgroundColor;
			  }
		   }
		   else {
			  if (document.all[id]) {
				document.all[id].style.backgroundColor = backgroundColor;
				document.all[id + "a"].style.color = fontColor;
			  }		      
		   }
		}
		
		function set(id, img) {
		   setColor(id)
		   if (img == null) 
		      setNoImage();
		   else
		      setImage(getParentName(id), img);
		}
		
		function swapIn(id, img) {
		   swapInColor(id);
		   /*if (img != null)
		      swapImageIn(id, img);*/
		}
		
		function swapOut(id, img) {
		   swapOutColor(id);
		   /*if (img != null)
		      swapImageOut(id, img);*/
		}
		
		function setColor(id) {
		   if (lastParent != null) 
		      applyColorsTo(lastParent, ColorPBG, ColorPBGFont);
		   if (lastChild != null) 
		      applyColorsTo(lastChild, ColorCBG, ColorCBGFont);
		   if (isChild(id)) {
		      var parentStr = getParentName(id);
		      //applyColorsTo(parentStr, ColorPBGOnSet, ColorPBGFontOnSet);
		       if(NS4)
		         applyColorsTo(id, ColorCBGOnSetNN, ColorPBGFontOnSet);
		       else
		      applyColorsTo(id, ColorCBGOnSet, ColorCBGFontOnSet);
		      lastChild = id;
		      lastParent = parentStr;
		      
		   }
		   else if (isParent(id)) {
		       if(NS4)
		         applyColorsTo(id, ColorPBGOnSetNN, ColorPBGFontOnSet);
		       else
		      applyColorsTo(id, ColorPBGOnSet, ColorPBGFontOnSet);
		      lastParent = id;
		      lastChild = null;
		   }
		}
		
		function getParentName(id) {
		   if (isParent(id)) 
		      return id;
		   else  
		      return parentStr = id.substr(0, id.indexOf("Child")) + "Parent";     
		}
		
		function isParent(id) {
		   return varIsParent = (id.indexOf("Parent") != -1) ? true : false;
		}
		
		function isChild(id) {
		   return varIsParent = (id.indexOf("Child") != -1) ? true : false;
		}
		
		function swapInColor(id) {
		   if ((id == lastChild) || (id == lastParent)) return;
		   if (isParent(id)) 
		       if(NS4)
		            applyColorsTo(id, ColorPBGOnSetNN, ColorPBGFontOnSet);
		       else
		      applyColorsTo(id, ColorPBGOnSet, ColorPBGFontOnSet);
		   if (isChild(id))
		       if(NS4)
		         applyColorsTo(id, ColorCBGOnSetNN, ColorPBGFontOnSet);
		       else
		      applyColorsTo(id, ColorCBGOnSet, ColorCBGFontOnSet);
		}
		
		function swapOutColor(id) {
		   if ((id == lastChild) || (id == lastParent)) return;
		   if (isParent(id)) 
		      applyColorsTo(id, ColorPBG, ColorPBGFont);
		   if (isChild(id))
		      applyColorsTo(id, ColorCBG, ColorCBGFont);
		}
		
		function applyImageTo(divId, theImageName, theImage) {
		   if (NS4) 
		      document.layers[divId].document.images[theImageName].src = eval(theImage + ".src");
		   else 
		      document.images[theImageName].src = eval(theImage + ".src");
		}  
		
		function setImage(id, imgName) {
		   if (lastImageName != null) {
		      var imgToRemove = lastImage.substr(0, lastImage.indexOf('_hi'));
		      applyImageTo(lastImageLayer, lastImageName, imgToRemove);
		   }
		   //var imgObj = imgName.substr(0, imgName.indexOf("_name")) + "_hi";
		   //applyImageTo(id, imgName, imgObj)
		   //lastImage = imgObj;
		   //lastImageName = imgName;
		   //lastImageLayer = id;
		}
		
		function swapImageIn(id, imgName) {
		   var imgObj = imgName.substr(0, imgName.indexOf("_name")) + "_hi";
		   if (id != lastImageLayer)
		      applyImageTo(id, imgName, imgObj);
		}
		
		function swapImageOut(id, imgName) {
		   var imgObj = imgName.substr(0, imgName.indexOf("_name"));
		   if (id != lastImageLayer)
		      applyImageTo(id, imgName, imgObj);
		}
		
		function openMyParent(id, img) {
		   set(id, img);  
		   if (isParent(id)) 
		      openMyChildren(id);
		   else 
		      openMyChildren(getParentName(id));
		}
		
		function setNoImage() {
		   if (lastImageName != null) {
		      imgObj = lastImage.substr(0, lastImage.indexOf('_hi'));
		      applyImageTo(lastImageLayer, lastImageName, imgObj);
		   }
		      lastImageName = null;
		      lastImageLayer = null;
		}
		
		function dohilight(menuId) {
		   if (NS4) {
		      document.layers[menuId.id].document.bgColor = 'red';
		   }
		   else {
				menuId.className = 'parentHilight'
				//menuId.color = "white";
				//menuId.background = "red";
				selectedMenu = menuId;
			}
		}
		
		function unhilight(menuId) {
			menuId.className = 'parent'
			//menuId.color = "#99CC33";
			//menuId.background = "#336633";
		}

