//**************************************************************** 
// Keep this copyright notice: 
// This copy of the script is the property of the owner of the 
// particular web site you were visiting.
// Do not download the script's files from there.
// For a free download and full instructions go to: 
// http://www.treeview.net
//**************************************************************** 

 
// Definition of class Folder 
// ***************************************************************** 
function Folder(folderDescription, hreference) //constructor 
{ 
  //constant data 
  this.desc = folderDescription; 
  this.hreference = hreference;
  this.id = -1;
  this.navObj = 0;
  this.iconImg = 0; 
  this.nodeImg = 0;
  this.isLastNode = 0;
  this.children = new Array;
  this.nChildren = 0;
  this.level = 0;
  this.leftSideCoded = "";
  this.isLastNode=false;
  this.parentObj = null;
  this.maySelect=true;
  this.prependHTML = ""
 
  //dynamic data 
  this.isOpen = false
  this.isLastOpenedFolder = false
  this.isRendered = 0
 
  //methods 
  this.initialize = initializeFolder 
  this.setState = setStateFolder 
  this.addChild = addChild 
  this.addChildren = addChildren
  this.createIndex = createEntryIndex 
  this.escondeBlock = escondeBlock
  this.esconde = escondeFolder 
  this.folderMstr = folderMstr 
  this.renderOb = drawFolder 
  this.totalHeight = totalHeight 
  this.subEntries = folderSubEntries 
  this.linkHTML = linkFolderHTML
  this.blockStartHTML = blockStartHTML
  this.blockEndHTML = blockEndHTML
  this.nodeImageSrc = nodeImageSrc
  this.iconImageSrc = iconImageSrc
  this.getID = getID
  this.forceOpeningOfAncestorFolders = forceOpeningOfAncestorFolders
} 
 
function initializeFolder(level, lastNode, leftSide) 
{ 
  var j=0 
  var i=0       
  nc = this.nChildren 
   
  this.createIndex() 
  this.level = level
  this.leftSideCoded = leftSide

  if (browserVersion == 0 || STARTALLOPEN==1)
    this.isOpen=true;

  if (level>0)
    if (lastNode) //the last child in the children array 
		leftSide = leftSide + "0"
	else
		leftSide = leftSide + "1"

  this.isLastNode = lastNode
 
  if (nc > 0) 
  { 
    level = level + 1 
    for (i=0 ; i < this.nChildren; i++)  
    {
      if (typeof this.children[i].initialize == 'undefined') //document node was specified using the addChildren function
      {
        if (typeof this.children[i][0] == 'undefined' || typeof this.children[i] == 'string')
        {
          this.children[i] = ["item incorrectly defined", ""];
        }

        //Basic initialization of the Item object
        //These members or methods are needed even before the Item is rendered
        this.children[i].initialize=initializeItem;
        this.children[i].createIndex=createEntryIndex;
        if (typeof this.children[i].maySelect == 'undefined')
          this.children[i].maySelect=true
        this.children[i].forceOpeningOfAncestorFolders = forceOpeningOfAncestorFolders
      }
      if (i == this.nChildren-1) 
        this.children[i].initialize(level, 1, leftSide)
      else 
        this.children[i].initialize(level, 0, leftSide)
    } 
  } 
} 
 
function drawFolder(insertAtObj) 
{ 
  var nodeName = ""
  var auxEv = ""
  var docW = ""
  var i=0
  finalizeCreationOfChildDocs(this)

//  var leftSide = leftSideHTML(this.leftSideCoded)

//  if (browserVersion > 0) 
//    auxEv = "<a href='javascript:clickOnNode(\""+this.getID()+"\")'>" 
//  else 
//    auxEv = "<a>" 

  nodeName = this.nodeImageSrc()
 
  this.isRendered = 1

  if (browserVersion == 2) { 
    if (!doc.yPos) 
      doc.yPos=20 
  } 

  docW = this.blockStartHTML("folder");  // <table....

//tdo
  if (this.id==0) {
//alert(navigator.family + "- " + navigator.version)
    if (navigator.family=='nn4' || (navigator.family=='opera' && navigator.version<7) || (navigator.family=='ie4' && navigator.version<5.5)) {
      docW=this.blockStartHTML("folder") + "<tr valign=top><td bgcolor=404040 class=oldbrowser width=164><nobr>"
      docW+="The Horology Source pages do<br>not display well with older<br>browsers; please upgrade to<br>current versions of "
      docW+="Internet<br>Explorer, <a href='http://browser.netscape.com/'>Netscape</a>, <a href='http://www.mozilla.com/firefox/'>Firefox</a>,"
      docW+=" or<br><a href='http://www.opera.com/'>Opera</a></nobr></td></tr>"
    } else {
      docW=this.blockStartHTML("folder") + "<tr height=15 valign=top><td bgcolor=404040></td></tr>"
    }
  } else {

//tdo
    docW = this.blockStartHTML("folder") + "<tr><td class=nav nowrap width=100%>" // <table....
    switch (this.level) {
    case 1: docW = docW + "<img src=images/Blank.gif width=0 height=1 border=0>";break;
    case 2: docW = docW + "<img src=images/Blank.gif width=11 height=1 border=0>";break;
    }
    docW += this.linkHTML(true);
    docW += "<img name='nodeIcon" + this.id + "' id='nodeIcon" + this.id + "' src=images/NavRightArrow.gif width=6 border=0>";
    if (this.level==1) docW = docW + "<b>"
    docW += this.desc + "</a>"
    if (this.level==1) docW += "</b>"
    docW += "</td></tr>"

//tdo
  }
  docW += this.blockEndHTML()
//alert(docW);
 if (insertAtObj == null)
  {
	  if (supportsDeferral) {
		  doc.write("<div id=domRoot></div>") //transition between regular flow HTML, and node-insert DOM DHTML
		  insertAtObj = getElById("domRoot")
		  insertAtObj.insertAdjacentHTML("beforeEnd", docW)
	  }
	  else
		  doc.write(docW)
  }
  else
  {
      insertAtObj.insertAdjacentHTML("afterEnd", docW)
  }
  if (browserVersion == 2) 
  { 
    this.navObj = doc.layers["folder"+this.id] 
    if (USEICONS)
      this.iconImg = this.navObj.document.images["folderIcon"+this.id] 
    this.nodeImg = this.navObj.document.images["nodeIcon"+this.id] 
    doc.yPos=doc.yPos+this.navObj.clip.height 
  } 
  else if (browserVersion != 0)
  { 
    this.navObj = getElById("folder"+this.id)
    if (USEICONS)
      this.iconImg = getElById("folderIcon"+this.id) 
    this.nodeImg = getElById("nodeIcon"+this.id)
  } 
// tdo inserted - For IE this is executed here because nodes are created backwards.  Safari is other way; can't click on node yet cause it doesn't exist yet
  if (supportsDeferral) {
    if (ParentSection != null) {
      if (CurrSection==this.desc || ParentSection==this.desc)
        clickOnFolder(this.id);
    } else {
      if (CurrSection==this.desc)
        clickOnFolder(this.id);
		}
  }
} 
 
function setStateFolder(isOpen) 
{ 
  var subEntries 
  var totalHeight 
  var fIt = 0 
  var i=0 
  var currentOpen
 
  if (isOpen == this.isOpen) 
    return 
 
  if (browserVersion == 2)  
  { 
    totalHeight = 0 
    for (i=0; i < this.nChildren; i++) 
      totalHeight = totalHeight + this.children[i].navObj.clip.height 
      subEntries = this.subEntries() 
    if (this.isOpen) 
      totalHeight = 0 - totalHeight 
    for (fIt = this.id + subEntries + 1; fIt < nEntries; fIt++) 
      indexOfEntries[fIt].navObj.moveBy(0, totalHeight) 
  }
  this.isOpen = isOpen;

  if (this.getID()!=foldersTree.getID() && PRESERVESTATE && !this.isOpen) //closing
  {
     currentOpen = GetCookie("clickedFolder")
     if (currentOpen != null) {
         currentOpen = currentOpen.replace(this.getID()+cookieCutter, "")
         SetCookie("clickedFolder", currentOpen)
     }
  }
	
  if (!this.isOpen && this.isLastOpenedfolder)
  {
		lastOpenedFolder = null;
		this.isLastOpenedfolder = false;
  }
  propagateChangesInState(this) 
} 
 
function propagateChangesInState(folder) 
{   
  var i=0 

  //Change icon
  if (folder.nChildren > 0 && folder.level>0) { //otherwise the one given at render stays
    if (folder.isOpen)
      folder.nodeImg.src = 'images/NavDownArrow.gif';
    else
      folder.nodeImg.src = 'images/NavRightArrow.gif';
  }

  //Change node
  if (USEICONS)
    folder.iconImg.src = folder.iconImageSrc()
  //Propagate changes
  for (i=folder.nChildren-1; i>=0; i--) {
    if (folder.isOpen) 
      folder.children[i].folderMstr(folder.navObj)
    else 
  	  folder.children[i].esconde() 
  }
} 
 
function escondeFolder() 
{ 
  this.escondeBlock()
   
  this.setState(0) 
} 
 
function linkFolderHTML(isTextLink) 
{ 
  var docW = "";
  if (this.hreference) 
  { 
	if (USEFRAMES)
	  docW += "<a href='" + this.hreference + "' TARGET=\"basefrm\" "
	else
	  docW += "<a href='" + this.hreference + "' TARGET=_top "
        
    if (isTextLink) {
        docW += "id=\"itemTextLink"+this.id+"\" ";
    }

    if (browserVersion > 0) 
      docW += "onClick='javascript:clickOnFolder(\""+this.getID()+"\")'"

    docW = docW + ">"
  } 
  else 
//tdo
//    docW = "<a>"
    docW += "<a onMouseOver=\"window.status='';return true;\" href='javascript:clickOnNode(\""+this.getID()+"\")'>"

  return docW;
} 
 
function addChild(childNode) 
{ 
  this.children[this.nChildren] = childNode;
  childNode.parentObj = this;
  this.nChildren++;
  return childNode;
} 

//The list can contain either a Folder object or a sub list with the arguments for Item 
function addChildren(listOfChildren) 
{ 
  this.children = listOfChildren 
  this.nChildren = listOfChildren.length
  for (i=0; i<this.nChildren; i++)
    this.children[i].parentObj = this;
} 

function folderSubEntries() 
{ 
  var i = 0 
  var se = this.nChildren 
 
  for (i=0; i < this.nChildren; i++){ 
    if (this.children[i].children) //is a folder 
      se += this.children[i].subEntries();
  } 
 
  return se;
} 

function nodeImageSrc() {
  var srcStr = "";
  return srcStr;
}

function iconImageSrc() {
  if (this.isOpen)
    return(this.iconSrc);
  else
    return(this.iconSrcClosed);
} 
 
// Definition of class Item (a document or link inside a Folder) 
// ************************************************************* 
 
function Item(itemDescription) // Constructor 
{ 
  // constant data 
  this.desc = itemDescription;

  this.level = 0;
  this.isLastNode = false;
  this.leftSideCoded = "";
  this.parentObj = null;

  this.maySelect=true;

  this.initialize = initializeItem;
  this.createIndex = createEntryIndex;
  this.forceOpeningOfAncestorFolders = forceOpeningOfAncestorFolders;
  finalizeCreationOfItem(this);
} 

//Assignments that can be delayed when the item is created with folder.addChildren
//The assignments that cannot be delayed are done in addChildren and in initializeFolder
//Additionaly, some assignments are also done in finalizeCreationOfChildDocs itself
function finalizeCreationOfItem(itemArray)
{
  itemArray.navObj = 0 //initialized in render() 
  itemArray.iconImg = 0 //initialized in render() 
  itemArray.isRendered = 0
  itemArray.nChildren = 0
  itemArray.prependHTML = ""
 
  // methods 
  itemArray.escondeBlock = escondeBlock
  itemArray.esconde = escondeBlock
  itemArray.folderMstr = folderMstr 
  itemArray.renderOb = drawItem 
  itemArray.totalHeight = totalHeight 
  itemArray.blockStartHTML = blockStartHTML
  itemArray.blockEndHTML = blockEndHTML
  itemArray.getID = getID
}

function initializeItem(level, lastNode, leftSide) 
{  
  this.createIndex() 
  this.level = level
  this.leftSideCoded = leftSide
  this.isLastNode = lastNode
} 
 
function drawItem(insertAtObj) 
{ 
//  var leftSide = leftSideHTML(this.leftSideCoded)
  var docW = "";

  var fullLink = "href=\""+this.link+"\" target=\""+this.target+"\" onClick=\"clickOnLink('"+this.getID()+"\', '"+this.link+"','"+this.target+"');return false;\"";
  this.isRendered = 1;

  if (CurrPage==this.link) {
    lclass="navcurr";
  } else {
    lclass="nav";
  }
//tdo
  docW=this.blockStartHTML("item") + "<tr><td class=" + lclass + " nowrap width=100%>";

  if (this.desc!="Home") {
    if (this.desc!=="") {
      docW += "<img src=images/Blank.gif width=" + (1 + (this.level-1)*10) + " height=7 border=0>";
      if (this.level==1) docW += "<b>";
      docW += "<a " + fullLink + " id=\"itemTextLink"+this.id+"\"><img src=images/NavDash.gif width=6 height=7 border=0>" + this.desc + "</a>";
      if (this.level==1) docW += "</b>";
    } else {
      docW += "<img src=images/Blank.gif width=1 height=4 border=0>";
    }
  } else {
      docW += "<img src=images/Blank.gif width=1 height=7 border=0><b>";
      docW += "<a " + fullLink + " id=\"itemTextLink"+this.id+"\">" + this.desc + "</a></b>";
  }

  docW += "</td></tr>"

  docW += this.blockEndHTML()
//tdo
//alert(this.id+" "+STARTALLOPEN+" "+docW);
//if (this.id==160) {
//var fso = new ActiveXObject("Scripting.FileSystemObject");
//var a = fso.CreateTextFile("c:\\testfile.txt", true);
//a.WriteLine(docW);
//a.Close();
//}
  if (insertAtObj == null)
  {
	  doc.write(docW);
  }
  else
  {
      insertAtObj.insertAdjacentHTML("afterEnd", docW);
  }

  if (browserVersion == 2) { 
    this.navObj = doc.layers["item"+this.id] 
    if (USEICONS)
      this.iconImg = this.navObj.document.images["itemIcon"+this.id] 
    doc.yPos=doc.yPos+this.navObj.clip.height 
  } else if (browserVersion != 0) { 
    this.navObj = getElById("item"+this.id)
    if (USEICONS)
      this.iconImg = getElById("itemIcon"+this.id)
  } 
//if (this.id>15) alert('Finished '+this.id);
// tdo inserted - For IE this is executed here because nodes are created backwards.  Safari is other way; can't click on node yet cause it doesn't exist yet
//alert(this.id+this.desc+" "+CurrPage+" - "+this.link+" = "+this.level)
  if (!supportsDeferral) {
    if (CurrPage != null) {
      if (CurrPage == this.link && this.level != 1) {
//alert(this.parentObj.parentObj.id+"-L="+this.level)			
			    
        tdoSAFARINODE = this.parentObj.id;
			  if (this.level == 3)
			    tdoSAFARINODE1 = this.parentObj.parentObj.id
			}
		}
  }
} 
 
 
// Methods common to both objects (pseudo-inheritance) 
// ******************************************************** 
 
function forceOpeningOfAncestorFolders() {
  if (this.parentObj == null || this.parentObj.isOpen)
    return
  else {
    this.parentObj.forceOpeningOfAncestorFolders()
    clickOnNodeObj(this.parentObj)
  }
}

function escondeBlock() 
{ 
  if (browserVersion == 1 || browserVersion == 3) { 
    if (this.navObj.style.display == "none") 
      return 
    this.navObj.style.display = "none" 
  } else { 
    if (this.navObj.visibility == "hidden") 
      return 
    this.navObj.visibility = "hidden" 
  }     
} 
 
function folderMstr(domObj) 
{ 
//  if (browserVersion == 1 || browserVersion == 3) { 
//    if (t==-1)
//      return
//    var str = new String(doc.links[t])
//    if (str.slice(14,16) != "em")
//      return
//  }

  if (!this.isRendered)
     this.renderOb(domObj)
  else
    if (browserVersion == 1 || browserVersion == 3) 
      this.navObj.style.display = "block";
    else 
      this.navObj.visibility = "show";
} 

function blockStartHTML(idprefix) {
  var idParam = "id='" + idprefix + this.id + "'";
  var docW = "";

  if (browserVersion == 2) 
    docW = "<layer "+ idParam + " top=" + doc.yPos + " visibility=show>";
  else if (browserVersion != 0)
    docW = "<div " + idParam + " style='display:block; position:block;'>";
     
//  docW = docW + "<table border=0 cellspacing=0 cellpadding=0 width=100% >"
  docW += "<table class=stdT100>";
  return docW
}

function blockEndHTML() {
  var docW = "";

  docW = "</table>"
   
  if (browserVersion == 2) 
    docW += "</layer>";
  else if (browserVersion != 0)
    docW += "</div>";

  return docW;
}
 
function createEntryIndex() 
{ 
  this.id = nEntries 
  indexOfEntries[nEntries] = this 
  nEntries++ 
} 
 
// total height of subEntries open 
function totalHeight() //used with browserVersion == 2 
{ 
  var h = this.navObj.clip.height; 
  var i = 0;
   
  if (this.isOpen) //is a folder and _is_ open 
    for (i=0 ; i < this.nChildren; i++)  
      h += this.children[i].totalHeight();
 
  return h 
} 


function getID()
{
  //define a .xID in all nodes (folders and items) if you want to PERVESTATE that
  //work when the tree changes. The value eXternal value must be unique for each
  //node and must node change when other nodes are added or removed
  //The value may be numeric or string, but cannot have the same char used in cookieCutter
  if (typeof this.xID != "undefined") 
    return this.xID;
  else
    return this.id;
}

 
// Events 
// ********************************************************* 
 
function clickOnFolder(folderId) 
{ 
  var clicked = findObj(folderId)

  if (typeof clicked=='undefined' || clicked==null)
  {
    alert("Treeview was not able to find the node object corresponding to ID=" + folderId + ". If the configuration file sets a.xID values, it must set them for ALL nodes, including the foldersTree root.");
    return;
  }

//tdo
  if (!clicked.isOpen) {
    clickOnNodeObj(clicked);
  }

  if (lastOpenedFolder != null && lastOpenedFolder != folderId)
    clickOnNode(lastOpenedFolder); //sets lastOpenedFolder to null

  if (clicked.nChildren==0) {
    lastOpenedFolder = folderId;
    clicked.isLastOpenedfolder = true;
  }

  if (isLinked(clicked.hreference)) {
      highlightObjLink(clicked);
  }
} 
 
function clickOnNode(folderId) 
{ 
window.status='';
  fOb = findObj(folderId);
  if (typeof fOb=='undefined' || fOb==null)
  {
    alert("Treeview was not able to find the node object corresponding to ID=" + folderId + ". If the configuration file sets a.xID, it must set foldersTree.xID as well.");
    return;
  }

  clickOnNodeObj(fOb);
}

function clickOnNodeObj(folderObj) 
{ 
  var state = 0 
  var currentOpen

  state = folderObj.isOpen;
  folderObj.setState(!state); //open<->close  

  if (folderObj.id!=foldersTree.id && PRESERVESTATE)
  {
    currentOpen = GetCookie("clickedFolder");
    if (currentOpen == null);
      currentOpen = "";

    if (!folderObj.isOpen) //closing
    {
      currentOpen = currentOpen.replace(folderObj.getID()+cookieCutter, "");
      SetCookie("clickedFolder", currentOpen);
    }
    else
      SetCookie("clickedFolder", currentOpen+folderObj.getID()+cookieCutter);
  }
}

function clickOnLink(clickedId, target, windowName) {
    highlightObjLink(findObj(clickedId));
    if (isLinked(target)) {
        window.open(target,windowName);
    }
}

function ld  ()
{
	return document.links.length-1;
}
 

// Auxiliary Functions 
// *******************

function finalizeCreationOfChildDocs(folderObj) {
  for(i=0; i < folderObj.nChildren; i++)  {
    child = folderObj.children[i];
    if (typeof child[0] != 'undefined')
    {
      // Amazingly, arrays can have members, so   a = ["a", "b"]; a.desc="asdas"   works
      // If a doc was inserted as an array, we can transform it into an itemObj by adding 
      // the missing members and functions
      child.desc = child[0];
      setItemLink(child, GLOBALTARGET, child[1]);   
      finalizeCreationOfItem(child);
    }
  }
}

function findObj(id)
{
  var i=0;
  var nodeObj;

  if (typeof foldersTree.xID != "undefined") {
    nodeObj = indexOfEntries[i];
    for(i=0;i<nEntries&&indexOfEntries[i].xID!=id;i++) //may need optimization
      ;
    id = i;
  }
  if (id >= nEntries)
    return null; //example: node removed in DB
  else
    return indexOfEntries[id];
}

function isLinked(hrefText) {
    var result = true;
    result = (result && hrefText !=null);
    result = (result && hrefText != '');
    result = (result && hrefText.indexOf('undefined') < 0);
    result = (result && hrefText.indexOf('parent.op') < 0);
    return result;
}

// Do highlighting by changing background and foreg. colors of folder or doc text
function highlightObjLink(nodeObj) {
  if (!HIGHLIGHT || nodeObj==null || nodeObj.maySelect==false) {//node deleted in DB 
    return;
  }

  if (browserVersion == 1 || browserVersion == 3) {
    var clickedDOMObj = getElById('itemTextLink'+nodeObj.id);
    if (clickedDOMObj != null) {
        if (lastClicked != null) {
            var prevClickedDOMObj = getElById('itemTextLink'+lastClicked.id);
            prevClickedDOMObj.style.color=lastClickedColor;
            prevClickedDOMObj.style.backgroundColor=lastClickedBgColor;
        }
        
        lastClickedColor    = clickedDOMObj.style.color;
        lastClickedBgColor  = clickedDOMObj.style.backgroundColor;
        clickedDOMObj.style.color=HIGHLIGHT_COLOR;
        clickedDOMObj.style.backgroundColor=HIGHLIGHT_BG;
    }
  }
  lastClicked = nodeObj;
  if (PRESERVESTATE)
    SetCookie('highlightedTreeviewLink', nodeObj.getID());
}

function insFld(parentFolder, childFolder) 
{ 
  return parentFolder.addChild(childFolder);
} 
 
function insDoc(parentFolder, document) 
{ 
  return parentFolder.addChild(document);
} 

function gFld(description, hreference) 
{ 
  folder = new Folder(description, hreference);
  return folder;
} 
 
function gLnk(optionFlags, description, linkData) 
{ 
  if (optionFlags>=0) { //is numeric (old style) or empty (error)
    //Target changed from numeric to string in Aug 2002, and support for numeric style was entirely dropped in Mar 2004
    alert("Change your Treeview configuration file to use the new style of target argument in gLnk");
    return;
  }

  newItem = new Item(description);
  setItemLink(newItem, optionFlags, linkData);
  return newItem;
} 

function setItemLink(item, optionFlags, linkData) {
  var targetFlag = "";
  var target = "";
  var protocolFlag = "";
  var protocol = "";

  targetFlag = optionFlags.charAt(0)
  if (targetFlag=="B")
    target = "_blank"
  if (targetFlag=="P")
    target = "_parent"
  if (targetFlag=="R")
    target = "basefrm"
  if (targetFlag=="S")
    target = "_self"
  if (targetFlag=="T")
    target = "_top"

  if (optionFlags.length > 1) {
    protocolFlag = optionFlags.charAt(1)
    if (protocolFlag=="h")
      protocol = "http://"
    if (protocolFlag=="s")
      protocol = "https://"
    if (protocolFlag=="f")
      protocol = "ftp://"
    if (protocolFlag=="m")
      protocol = "mailto:"
  }

  item.link = protocol+linkData;    
  item.target = target;
}

//Function created  for backwards compatibility purposes
//Function contents voided in March 2004
function oldGLnk(target, description, linkData)
{
}
 
function preLoadIcons() {
	var auxImg
	auxImg = new Image();
	auxImg.src='images/NavRightArrow.gif';
	auxImg.src='images/NavDownArrow.gif';
	auxImg.src='images/NavDash.gif';
}

//Open some folders for initial layout, if necessary
function setInitialLayout() {
  if (browserVersion > 0 && !STARTALLOPEN)
    clickOnNodeObj(foldersTree);
  
}

//Used with NS4 and STARTALLOPEN
function renderAllTree(nodeObj, parent) {
  var i=0;
  nodeObj.renderOb(parent)
  if (supportsDeferral)
    for (i=nodeObj.nChildren-1; i>=0; i--) 
      renderAllTree(nodeObj.children[i], nodeObj.navObj)
  else
    for (i=0 ; i < nodeObj.nChildren; i++) 
      renderAllTree(nodeObj.children[i], null)
}

function hideWholeTree(nodeObj, hideThisOne, nodeObjMove) {
  var i=0;
  var heightContained=0;
  var childrenMove=nodeObjMove;

  if (hideThisOne)
    nodeObj.escondeBlock()

  if (browserVersion == 2)
    nodeObj.navObj.moveBy(0, 0-nodeObjMove)

  for (i=0 ; i < nodeObj.nChildren; i++) {
    heightContainedInChild = hideWholeTree(nodeObj.children[i], true, childrenMove)
    if (browserVersion == 2) {
      heightContained = heightContained + heightContainedInChild + nodeObj.children[i].navObj.clip.height
      childrenMove += heightContainedInChild
	}
  }

  return heightContained;
}

 
// Simulating inserAdjacentHTML on NS6
// Code by thor@jscript.dk
// ******************************************

if(typeof HTMLElement!="undefined" && !HTMLElement.prototype.insertAdjacentElement){
	HTMLElement.prototype.insertAdjacentElement = function (where,parsedNode)
	{
		switch (where){
		case 'beforeBegin':
			this.parentNode.insertBefore(parsedNode,this)
			break;
		case 'afterBegin':
			this.insertBefore(parsedNode,this.firstChild);
			break;
		case 'beforeEnd':
			this.appendChild(parsedNode);
			break;
		case 'afterEnd':
			if (this.nextSibling) 
				this.parentNode.insertBefore(parsedNode,this.nextSibling);
			else this.parentNode.appendChild(parsedNode);
			break;
		}
	}

	HTMLElement.prototype.insertAdjacentHTML = function(where,htmlStr)
	{
		var r = this.ownerDocument.createRange();
		r.setStartBefore(this);
		var parsedHTML = r.createContextualFragment(htmlStr);
		this.insertAdjacentElement(where,parsedHTML)
	}
}

function getElById(idVal) {
  if (document.getElementById != null)
    return document.getElementById(idVal)
  if (document.all != null)
    return document.all[idVal]
  
  alert("Problem getting element by id")
  return null
}


//To customize the tree, overwrite these variables in the configuration file (demoFramesetNode.js, etc.)
var USETEXTLINKS = 1;
var STARTALLOPEN = 0;
var USEFRAMES = 0;
var USEICONS = 0;
var WRAPTEXT = 0;
var PERSERVESTATE = 0; //backward compatibility
var PRESERVESTATE = 0;
var HIGHLIGHT = 0;
var HIGHLIGHT_COLOR = 'white';
var HIGHLIGHT_BG    = 'blue';
var BUILDALL = 0;
var GLOBALTARGET = "R"; // variable only applicable for addChildren uses


//Other variables
var lastClicked = null;
var lastClickedColor;
var lastClickedBgColor;
var indexOfEntries = new Array 
var nEntries = 0 
var browserVersion = 0 
var selectedFolder=0
var lastOpenedFolder=null
var t=5
var doc = document
var supportsDeferral = false
var cookieCutter = '^' //You can change this if you need to use ^ in your xID or treeID values
var tdoSAFARINODE = 0
var tdoSAFARINODE1 = 0

doc.yPos = 0

// Main function
// ************* 

// This function uses an object (navigator) defined in
// ua.js, imported in the main html page (left frame).
function initializeDocument() 
{ 
  preLoadIcons();
  switch(navigator.family)
  {
    case 'ie4':
      browserVersion = 1 //Simply means IE > 3.x
      break;
    case 'opera':
      browserVersion = (navigator.version > 6 ? 1 : 0); //opera7 has a good DOM
      break;
    case 'nn4':
      browserVersion = 0 //NS4.x changed from 2
      break;
    case 'gecko':
      browserVersion = 3 //NS6.x
      break;
    case 'safari':
		//tdo changed from 1 to 0
      browserVersion = 1 //Safari Beta 3 seems to behave like IE in spite of being based on Konkeror
      break;
	default:
      browserVersion = 0 //other, possibly without DHTML  
      break;
  }

  // backward compatibility
  if (PERSERVESTATE)
    PRESERVESTATE = 1;

  supportsDeferral = ((navigator.family=='ie4' && navigator.version >= 5 && navigator.OS != "mac") || browserVersion == 3);
  supportsDeferral = supportsDeferral & (!BUILDALL)
  if (!USEFRAMES && browserVersion == 2)
  	browserVersion = 0;
t=0
  //foldersTree (with the site's data) is created in an external .js (demoFramesetNode.js, for example)
  foldersTree.initialize(0, true, "") 

	if (supportsDeferral && !STARTALLOPEN) {
      foldersTree.renderOb(null) //delay construction of nodes
  }

  else {
    renderAllTree(foldersTree, null);


    //To force the scrollable area to be big enough
    if (browserVersion == 2) 
      doc.write("<layer top=" + indexOfEntries[nEntries-1].navObj.top + ">&nbsp;</layer>") 

    if (browserVersion != 0 && !STARTALLOPEN)
      hideWholeTree(foldersTree, false, 0)
//tdo
    if (navigator.family == 'safari') {
//alert(tdoSAFARINODE+"==="+tdoSAFARINODE1);
			if (tdoSAFARINODE != 0)
  		  clickOnFolder(tdoSAFARINODE);
			if (tdoSAFARINODE1 != 0)
			  clickOnFolder(tdoSAFARINODE1);
		}
  }

  setInitialLayout()
//tdo
  if (browserVersion>0)
	{
    writeButton();
    displayOClock();
	}
	else
	  displayOClock();
} 

// Open all folders
// May not work with very large trees (browser may time out)
// You may call this on a node other than the root, but it must be a folder
function expandTree(folderObj)
{
    var childObj;
    var i;

    //Open folder
    if (!folderObj.isOpen)
      clickOnNodeObj(folderObj)

    //Call this function for all folder children
    for (i=0 ; i < folderObj.nChildren; i++)  {
      childObj = folderObj.children[i]
      if (typeof childObj.setState != "undefined") {//is folder
        expandTree(childObj)
      }
    }
}

// Close all folders
function collapseTree()
{
	//hide all folders
	clickOnNodeObj(foldersTree)
	//restore first level
	clickOnNodeObj(foldersTree)
}


function writeButton() {
  document.write('<table class=stdT width=100%><tr><br><td align=center><input type=button value="Expand All" class=menubtn onClick="javascript:expandTree(foldersTree);"><br><img src=http://www.horologysource.com/Images/Blank.gif height=2><br>')
  document.write('<input type=button value="Collapse All" class=menubtn onClick="javascript:collapseTree(1);"></td><td width=10%>&nbsp;</td></tr></table>')
  document.write('<table id=clocktable class=stdT width=100%><tr><td align=center valign=top><img src=http://www.horologysource.com/images/Blank.gif height=15></td></tr><tr><td align=center valign=top><img src=http://www.horologysource.com/images/BGClock-Mantel5f.gif alt=""></td><td width=18 bgcolor=#404040><iimg src=http://www.horologysource.com/images/Blank.gif width=18></td></tr></table>');
}


<!-- Standard Scroll Clock by kurt.grigg@virgin.net with extensive modifications

if (navigator.family!='nn4') { 
fCol='202020';//face color.
sCol='980000';//seconds color.
mCol='2f3f4f';//minutes color.
hCol='2f3f4f';//hours color.
cCol='BCA800';//center pin color
H='.............';
H=H.split('');
M='...................';
M=M.split('');
S='...................';
S=S.split('');
Ypos=0;
Xpos=0;
Ybase=1.3;
Xbase=1.3;
facewidth=23;
facefont=6;
ShowSecondsBit=false;
dots=12;
dgts='1 2 3 4 5 6 7 8 9 10 11 12';
dgts='I_II_III_IIII_V_VI_VII_VIII_IX_X_XI_XII';
dgts=dgts.split('_');
firstdisplay=true;
document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i=1; i < dots+1; i++){
//  document.write('<div id="ieDigits'+i+'" style="position:absolute;top:0px;left:0px;width:30px;height:30px;font-family:Verdana;font-size:'+facefont+'px;color:'+fCol+';text-align:center;padding-top:10px;font-weight:bold">'+dgts[i-1]+'</div>');
  document.write('<div id="ieDigits'+i+'"></div>');
}
document.write('</div></div>')
document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i=0; i < M.length; i++){
  document.write('<div id="y'+i+'" style="position:absolute;width:2px;height:2px;font-size:2px;background-color:'+mCol+'"></div>');
}
document.write('</div></div>')
document.write('</div></div>')
document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i=0; i < H.length; i++){
  document.write('<div id="z'+i+'" style="position:absolute;width:3px;height:3px;font-size:2px;background-color:'+hCol+'"></div>');
}
document.write('</div></div>')
if (ShowSecondsBit) {
  document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
  for (i=0; i < S.length; i++){
    document.write('<div id="x'+i+'" style="position:absolute;width:2px;height:2px;font-size:2px;background-color:'+sCol+'"></div>');
  }
  document.write('</div></div>')
}
document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');
document.write('<div id="cpin" style="position:absolute;width:3px;height:3px;font-size:2px;background-color:'+cCol+'"></div>');
document.write('</div></div>')
}

function displayOClock(){
  time = new Date ();
  secs = time.getSeconds();
  sec = -1.57 + Math.PI * secs/30;
  mins = time.getMinutes();
  min = -1.57 + Math.PI * mins/30;
  hr = time.getHours();
  hrs = -1.57 + Math.PI * hr/6 + Math.PI*parseInt(time.getMinutes())/360;

  Ypos=document.getElementById("clocktable").offsetTop+207;
  Xpos=document.getElementById("clocktable").offsetLeft+77;

  for (i=0; i < dots; ++i){
    newYpos=Ypos-14+facewidth*Math.sin(-0.49+dots+i/1.89);
    newXpos=Xpos-14+facewidth*Math.cos(-0.49+dots+i/1.89);
    var tElmt=document.getElementById("ieDigits"+(i+1));
    tElmt.style.top=newYpos+"px";
    tElmt.style.left=newXpos+"px";
  }
  if (ShowSecondsBit) {
    for (i=0; i < S.length; i++){
      newYpos=Ypos-1+i*Ybase*Math.sin(sec);
      newXpos=Xpos+i*Xbase*Math.cos(sec);
      var tElmt=document.getElementById("x"+i);
      tElmt.style.top=newYpos+"px";
      tElmt.style.left=newXpos+"px";
    }
  }
  for (i=0; i < M.length; i++){
    newYpos=Ypos-1+i*Ybase*Math.sin(min);
    newXpos=Xpos+i*Xbase*Math.cos(min);
    var tElmt=document.getElementById("y"+i);
    tElmt.style.top=newYpos+"px";
    tElmt.style.left=newXpos+"px";
  }
  for (i=0; i < H.length; i++){
    newYpos=Ypos-1+i*Ybase*Math.sin(hrs);
    newXpos=Xpos+i*Xbase*Math.cos(hrs);
    var tElmt=document.getElementById("z"+i);
    tElmt.style.top=newYpos+"px";
    tElmt.style.left=newXpos+"px";
  }
  newYpos=Ypos-1
  newXpos=Xpos
  var tElmt=document.getElementById("cpin");
  tElmt.style.top=newYpos-1+"px";
  tElmt.style.left=newXpos-1+"px";
  setTimeout('displayOClock()','150')
}

var DH = 0;var an = 0;var al = 0;var ai = 0;if (document.getElementById) {ai = 1; DH = 1;}else {if (document.all) {al = 1; DH = 1;} else { browserVersion = parseInt(navigator.appVersion); if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {an = 1; DH = 1;}}} function fd(oi, wS) {if (ai) return wS ? document.getElementById(oi).style:document.getElementById(oi); if (al) return wS ? document.all[oi].style: document.all[oi]; if (an) return document.layers[oi];}

function pw() {return window.innerWidth != null? window.innerWidth: document.body.clientWidth != null? document.body.clientWidth:null;}

function mouseX(evt) {if (evt.pageX) return evt.pageX; else if (evt.clientX)return evt.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft); else return null;}

function mouseY(evt) {if (evt.pageY) return evt.pageY; else if (evt.clientY)return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); else return null;}

function popUp(evt,oi) {if (DH) {var wp = pw(); ds = fd(oi,1); dm = fd(oi,0); st = ds.visibility; if (dm.offsetWidth) ew = dm.offsetWidth; else if (dm.clip.width) ew = dm.clip.width; if (st == "visible" || st == "show") { ds.visibility = "hidden"; } else {tv = mouseY(evt) + 20; lv = mouseX(evt) - (ew/4); if (lv < 2) lv = 2; else if (lv + ew > wp) lv -= ew/2; if (!an) {lv += 'px';tv += 'px';} ds.left = lv; ds.top = tv; ds.visibility = "visible";}}}

/* --- BoxOver ---
/* --- v 1.9 12 December 2005
By Oliver Bryant with help of Matthew Tagg
http://boxover.swazz.org */

if (typeof document.attachEvent!='undefined') {
   window.attachEvent('onload',init);
   document.attachEvent('onmousemove',moveMouse);
   document.attachEvent('onclick',checkMove); }
else {
   window.addEventListener('load',init,false);
   document.addEventListener('mousemove',moveMouse,false);
   document.addEventListener('click',checkMove,false);
}

var oDv=document.createElement("div");
var dvHdr=document.createElement("div");
var dvBdy=document.createElement("div");
var windowlock,boxMove,fixposx,fixposy,lockX,lockY,fixx,fixy,ox,oy,boxLeft,boxRight,boxTop,boxBottom,evt,mouseX,mouseY,boxOpen,totalScrollTop,totalScrollLeft;
boxOpen=false;
ox=10;
oy=10;
lockX=0;
lockY=0;

function init() {
	oDv.appendChild(dvHdr);
	oDv.appendChild(dvBdy);
	oDv.style.position="absolute";
	oDv.style.visibility='hidden';
	document.body.appendChild(oDv);	
}

function defHdrStyle() {
}

function defBdyStyle() {
}

var cnt=0;

function checkElemBO(txt) {
   if ((txt.indexOf('header')>-1)&(txt.indexOf('body')>-1)&(txt.indexOf('[')>-1)&(txt.indexOf('[')>-1))
      return true;
   else
      return false;
}

function scanDOM(curNode) {
	cnt++;
	while(curNode)	{
		if (curNode.title) {
		  if (checkElemBO(curNode.title)) {
   			curNode.boHDR=getParam('(?:[^a-zA-Z]header|^header)',curNode.title);
   			curNode.boBDY=getParam('(?:[^a-zA-Z]body|^body)',curNode.title);
   			curNode.boCSSBDY=getParam('cssbody',curNode.title);			
   			curNode.boCSSHDR=getParam('cssheader',curNode.title);
   			curNode.IEbugfix=(getParam('hideselects',curNode.title)=='on')?true:false;
   			curNode.fixX=parseInt(getParam('fixedrelx',curNode.title));
   			curNode.fixY=parseInt(getParam('fixedrely',curNode.title));
   			curNode.absX=parseInt(getParam('fixedabsx',curNode.title));
   			curNode.absY=parseInt(getParam('fixedabsy',curNode.title));
   			curNode.offY=(getParam('offsety',curNode.title)!='')?parseInt(getParam('offsety',curNode.title)):10;
   			curNode.offX=(getParam('offsetx',curNode.title)!='')?parseInt(getParam('offsetx',curNode.title)):10;
   			curNode.fade=(getParam('fade',curNode.title)=='on')?true:false;
   			curNode.fadespeed=(getParam('fadespeed',curNode.title)!='')?getParam('fadespeed',curNode.title):0.04;
   			curNode.delay=(getParam('delay',curNode.title)!='')?parseInt(getParam('delay',curNode.title)):0;
   			if (getParam('requireclick',curNode.title)=='on') {
   				curNode.requireclick=true;
   				document.all?curNode.attachEvent('onclick',showHideBox):curNode.addEventListener('click',showHideBox,false);
   				document.all?curNode.attachEvent('onmouseover',hideBox):curNode.addEventListener('mouseover',hideBox,false);
   			}
   			else {// Note : if requireclick is on the stop clicks are ignored   			
	   			if (getParam('doubleclickstop',curNode.title)!='off') {
	   				document.all?curNode.attachEvent('ondblclick',pauseBox):curNode.addEventListener('dblclick',pauseBox,false);
	   			}	
	   			if (getParam('singleclickstop',curNode.title)=='on') {
	   				document.all?curNode.attachEvent('onclick',pauseBox):curNode.addEventListener('click',pauseBox,false);
	   			}
	   		}
   			curNode.windowLock=getParam('windowlock',curNode.title).toLowerCase()=='off'?false:true;
   			curNode.title='';
   			curNode.hasbox='true';
   	   }
		}
		scanDOM(curNode.firstChild);
		curNode=curNode.nextSibling;
	}
}

function getParam(param,list) {
	var reg = new RegExp(param+'\\s*=\\s*\\[\\s*(((\\[\\[)|(\\]\\])|([^\\]\\[]))*)\\s*\\]');
	var res = reg.exec(list);
	var returnvar;
	if(res)
		return res[1].replace('[[','[').replace(']]',']');
	else
		return '';
}

function Left(elem){	
	var x=0;
	if (elem.calcLeft)
		return elem.calcLeft;
	var oElem=elem;
	while(elem){
		 if ((elem.currentStyle)&& (!isNaN(parseInt(elem.currentStyle.borderLeftWidth)))&&(x!=0))
		 	x+=parseInt(elem.currentStyle.borderLeftWidth);
		 x+=elem.offsetLeft;
		 elem=elem.offsetParent;
	  } 
	oElem.calcLeft=x;
	return x;
	}

function Top(elem){
	 var x=0;
	 if (elem.calcTop)
	 	return elem.calcTop;
	 var oElem=elem;
	 while(elem){		
	 	 if ((elem.currentStyle)&& (!isNaN(parseInt(elem.currentStyle.borderTopWidth)))&&(x!=0))
		 	x+=parseInt(elem.currentStyle.borderTopWidth); 
		 x+=elem.offsetTop;
	         elem=elem.offsetParent;
 	 } 
 	 oElem.calcTop=x;
 	 return x;
 	 
}

var ah,ab;
function applyStyles() {
	if(ab)
		oDv.removeChild(dvBdy);
	if (ah)
		oDv.removeChild(dvHdr);
	dvHdr=document.createElement("div");
	dvBdy=document.createElement("div");
	CBE.boCSSBDY?dvBdy.className=CBE.boCSSBDY:defBdyStyle();
	CBE.boCSSHDR?dvHdr.className=CBE.boCSSHDR:defHdrStyle();
	dvHdr.innerHTML=CBE.boHDR;
	dvBdy.innerHTML=CBE.boBDY;
	ah=false;
	ab=false;
	if (CBE.boHDR!='') {		
		oDv.appendChild(dvHdr);
		ah=true;
	}	
	if (CBE.boBDY!=''){
		oDv.appendChild(dvBdy);
		ab=true;
	}	
}

var CSE,iterElem,LSE,CBE,LBE, totalScrollLeft, totalScrollTop, width, height ;
var ini=false;

// Customised function for inner window dimension
function SHW() {
   if (document.body && (document.body.clientWidth !=0)) {
      width=document.body.clientWidth;
      height=document.body.clientHeight;
   }
   if (document.documentElement && (document.documentElement.clientWidth!=0) && (document.body.clientWidth + 20 >= document.documentElement.clientWidth)) {
      width=document.documentElement.clientWidth;   
      height=document.documentElement.clientHeight;   
   }   
   return [width,height];
}


var ID=null;
function moveMouse(e) {
   if (!ini) {      
      scanDOM(document.body.firstChild);
      ini=true;
   }
	e?evt=e:evt=event;	
	//evt=event;
		
	CSE=evt.target?evt.target:evt.srcElement;
	if ((CSE!=LSE)&&(!isChild(CSE,dvHdr))&&(!isChild(CSE,dvBdy))){
		
		if (!CSE.boxItem) {
			iterElem=CSE;
			while ((!iterElem.hasbox)&&(iterElem.parentNode))
					iterElem=iterElem.parentNode; 
			CSE.boxItem=iterElem;
			}
		iterElem=CSE.boxItem;
		if (CSE.boxItem.title)
		  if (checkElemBO(CSE.boxItem.title)) {		      
		      ini=false;
		   }
		if (CSE.boxItem&&CSE.boxItem.hasbox)  {
			LBE=CBE;
			CBE=iterElem;
			if (CBE!=LBE) {
				applyStyles();
				if (!CBE.requireclick)
					if (CBE.fade) {
						if (ID!=null)
							clearTimeout(ID);
						ID=setTimeout("fadeIn("+CBE.fadespeed+")",CBE.delay);
					}
					else {
						if (ID!=null)
							clearTimeout(ID);
						COL=1;
						ID=setTimeout("oDv.style.visibility='visible';ID=null;",CBE.delay);						
					}
				if (CBE.IEbugfix) {hideSelects();} 
				fixposx=!isNaN(CBE.fixX)?Left(CBE)+CBE.fixX:CBE.absX;
				fixposy=!isNaN(CBE.fixY)?Top(CBE)+CBE.fixY:CBE.absY;			
				lockX=0;
				lockY=0;
				boxMove=true;
				ox=CBE.offX?CBE.offX:10;
				oy=CBE.offY?CBE.offY:10;
			}
		}
		else if (!isChild(CSE,dvHdr) && !isChild(CSE,dvBdy) && (boxMove))	{
			// The conditional here fixes flickering between tables cells.
			if ((!isChild(CBE,CSE)) || (CSE.tagName!='TABLE')) {   			
   			CBE=null;
   			fadeOut();
   			showSelects();
			}
		}
		LSE=CSE;
	}
	else if (((isChild(CSE,dvHdr) || isChild(CSE,dvBdy))&&(boxMove))) {
		totalScrollLeft=0;
		totalScrollTop=0;
		
		iterElem=CSE;
		while(iterElem) {
			if(!isNaN(parseInt(iterElem.scrollTop)))
				totalScrollTop+=parseInt(iterElem.scrollTop);
			if(!isNaN(parseInt(iterElem.scrollLeft)))
				totalScrollLeft+=parseInt(iterElem.scrollLeft);
			iterElem=iterElem.parentNode;			
		}
		if (CBE!=null) {
			boxLeft=Left(CBE)-totalScrollLeft;
			boxRight=parseInt(Left(CBE)+CBE.offsetWidth)-totalScrollLeft;
			boxTop=Top(CBE)-totalScrollTop;
			boxBottom=parseInt(Top(CBE)+CBE.offsetHeight)-totalScrollTop;
			doCheck();
		}
	}
	
	if (boxMove&&CBE) {
		// This added to alleviate bug in IE6 w.r.t DOCTYPE
		bodyScrollTop=document.documentElement&&document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;
		bodyScrollLet=document.documentElement&&document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft;
		mouseX=evt.pageX?evt.pageX-bodyScrollLet:evt.clientX-document.body.clientLeft;
		mouseY=evt.pageY?evt.pageY-bodyScrollTop:evt.clientY-document.body.clientTop;
		if ((CBE)&&(CBE.windowLock)) {
			mouseY < -oy?lockY=-mouseY-oy:lockY=0;
			mouseX < -ox?lockX=-mouseX-ox:lockX=0;
			mouseY > (SHW()[1]-oDv.offsetHeight-oy)?lockY=-mouseY+SHW()[1]-oDv.offsetHeight-oy:lockY=lockY;
			mouseX > (SHW()[0]-dvBdy.offsetWidth-ox)?lockX=-mouseX-ox+SHW()[0]-dvBdy.offsetWidth:lockX=lockX;			
		}
		oDv.style.left=((fixposx)||(fixposx==0))?fixposx:bodyScrollLet+mouseX+ox+lockX+"px";
		oDv.style.top=((fixposy)||(fixposy==0))?fixposy:bodyScrollTop+mouseY+oy+lockY+"px";		
		
	}
}

function doCheck() {	
	if (   (mouseX < boxLeft)    ||     (mouseX >boxRight)     || (mouseY < boxTop) || (mouseY > boxBottom)) {
		if (!CBE.requireclick)
			fadeOut();
		if (CBE.IEbugfix) {showSelects();}
		CBE=null;
	}
}

function pauseBox(e) {
   e?evt=e:evt=event;
	boxMove=false;
	evt.cancelBubble=true;
}

function showHideBox(e) {
	oDv.style.visibility=(oDv.style.visibility!='visible')?'visible':'hidden';
}

function hideBox(e) {
	oDv.style.visibility='hidden';
}

var COL=0;
var stopfade=false;
function fadeIn(fs) {
		ID=null;
		COL=0;
		oDv.style.visibility='visible';
		fadeIn2(fs);
}

function fadeIn2(fs) {
		COL=COL+fs;
		COL=(COL>1)?1:COL;
		oDv.style.filter='alpha(opacity='+parseInt(100*COL)+')';
		oDv.style.opacity=COL;
		if (COL<1)
		 setTimeout("fadeIn2("+fs+")",20);		
}


function fadeOut() {
	oDv.style.visibility='hidden';
	
}

function isChild(s,d) {
	while(s) {
		if (s==d) 
			return true;
		s=s.parentNode;
	}
	return false;
}

var cSrc;
function checkMove(e) {
	e?evt=e:evt=event;
	cSrc=evt.target?evt.target:evt.srcElement;
	if ((!boxMove)&&(!isChild(cSrc,oDv))) {
		fadeOut();
		if (CBE&&CBE.IEbugfix) {showSelects();}
		boxMove=true;
		CBE=null;
	}
}

function showSelects(){
   var elements = document.getElementsByTagName("select");
   for (i=0;i< elements.length;i++){
      elements[i].style.visibility='visible';
   }
}

function hideSelects(){
   var elements = document.getElementsByTagName("select");
   for (i=0;i< elements.length;i++){
   elements[i].style.visibility='hidden';
   }
}
