<?xml version="1.0" encoding="ISO-8859-1"?>
   <!--
	This work is licensed under a Creative Commons License.
	You are free:
	to copy, distribute, display, and perform the work
	to make derivative works
	to make commercial use of the work

	Under the following conditions:

	Attribution. You must give the original author credit

	Author:  Dr. Detlef Groth 2004
	Web:     http://www.dgroth.de/

	License: http://creativecommons.org/licenses/by/1.0/
        <>
        Revision      : $Revision: 1.2 $
        Date          : $Date: 2004/02/13 14:21:09 $
        Author        : $Author: dgroth $
        Created By    : Dr. Detlef Groth
        Created       : Mon Mar 10 16:41:10 2003
        Last Modified : <040218.1028>
        ID            : $Id: tree.htc,v 1.2 2004/02/13 14:21:09 dgroth Exp $
        Source        : $Source: /cygdrive/d/cvs/myhtc/js/tree.htc,v $
        Description	

        Notes
        $Log: tree.htc,v $
        Revision 1.2  2004/02/13 14:21:09  dgroth
        refactoring, only toplevel div required now, object detection instead of browser sniffing

        Revision 1.1.1.1  2004/02/09 14:02:48  dgroth
        initial cvs import

        -->
<public:component xmlns:public="urn:HTMLComponent" lightweight="true">
  <public:attach event="onclick" onevent="expandcollapse()" />
  <public:attach event="onload" for="window" handler="init"/>

  <script type="text/javascript">
    //<![CDATA[
    // addBehavior("hilight.htc");
    
function init () {
    expandcollapse();
    element.style.color = "#000033" ;
    element.style.cursor = "pointer" ;
}
function expandcollapse(e) {
    e=e||window.event;
    var child ;
    // to avoid closing the upper list-item
    e.cancelBubble = true;
    if (e.stopPropagation) {
      e.stopPropagation();
	  e.returnValue = false;
   	  e.preventDefault();
    }
    // to avoid closing the upper list-item if clicking on a link
//    alert(element.innerHTML);
    try { if(window.event.srcElement.tagName != "LI") return; } catch (ev) {}
    child = element.getElementsByTagName("UL")[0];
    if (!child) {
        // we have mozilla which correctly finds it as s sibling
        child = element.nextSibling ;
        while (child != null) {
            if (child.nodeName == "UL") { break } ; //"[object HTMLUListElement]") { break }
            child = child.nextSibling ;
        }
    }
    if (child) {
        bCollapsed = (child.style.display == "none");
        // Toggle the display and listStyleImage properties depending
        // on the expanded or collapsed state of the list.
        if (bCollapsed) {
            element.style.listStyleImage = "url(img/minus.gif)";
            child.style.display = "";
        } else {
            element.style.listStyleImage = "url(img/plus.gif)";
            child.style.display = "none";
        }
    } else {
        // no child so it is a simple listitem
        element.style.listStyleImage = "url(img/file.gif)";
    }
};
//]]>
</script>
</public:component>