<?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
     Web:     http://www.dgroth.de/
     License: http://creativecommons.org/licenses/by/1.0/

     System        : TABBOX_XML : 
     Object Name   : $RCS_FILE$
     Revision      : $REVISION$
     Date          : Thu Feb 5 19:44:41 2004
     Created By    : Dr. Detlef Groth, MPIMG Berlin, Germany
     Created       : Thu Feb 5 19:44:41 2004

     Last Modified : <040223.1240>
     ID            : $Id: tabbox.htc,v 1.1.1.1 2004/02/09 14:02:48 dgroth Exp $
     Source        : $Source: /cygdrive/d/cvs/myhtc/js/tabbox.htc,v $
     Description	
     Notes
     $Log: tabbox.htc,v $
     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="raiseTab()" />
  <public:attach event="onload" for="window" handler="init"/>
  <public:attach event="ondocumentready" handler="documentready" />
  <public:attach event="oncontentready" handler="initready"/>
 <script type="text/javascript">
   //<![CDATA[
  
 
   function initready () {
       // it is better to get the first child only
       if (element.nodeName == "DIV" && element.className == "tabbox") {
           showPanel(element, 0);
          
           
       }
   }
   function init() {
       if (element.nodeName == "DIV" && element.className == "tabpanel") {
           // element.style.display = "none" ;
       }
   }
   function getNodeUp (node, nodeType) {
       while (node.nodeName != nodeType) {
           node=node.parentNode;
       }
       return node ;
   }
   function showPanel (parent,index) {
       var child = parent.firstChild ;
     
      
       var  curr = 0 ; 
       while (child != null) {
         
           if (child.className == "tabpanel") {
               if (index == curr) {
                   child.style.display = "block" ;
               } else {
                   child.style.display = "none" ;
               }
               curr++ ;
           }
           child = child.nextSibling ;
       }
   }
   function getIndex (el) {
       var idx = 0 ;
       var sibling  = el.previousSibling ; 
  
       while (sibling != null)  {
           if (sibling.nodeName == el.nodeName) {
               idx++ ;
           }
           sibling = sibling.previousSibling ;
       }
       return idx ;
   }
   function raiseTab (e) {
       e=e||window.event;
       var node = e.srcElement ;
       var parent = node.parentNode.parentNode ;
       if (parent.parentNode.className != "tabs") { return }
       var a= parent.getElementsByTagName("A");
       
       for (var x = 0 ; x < a.length ; x++) {
           a[x].className = "" ;
       }
       node.className= "current"
       showPanel(node.parentNode.parentNode.parentNode.parentNode, getIndex(node.parentNode));
      
    }
    //]]>
</script>
</public:component>
