<?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 : <040205.2252>
     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" />
 <script type="text/javascript">
   //<![CDATA[
   loaded = 0 ;
   var startText = "" ;
   var ie = (navigator.appName == "Microsoft Internet Explorer");
   var v50 = navigator.appVersion.match(/5\.0/);
   function init() {
       if (element.className == "Tabbox" && !navigator.appVersion.match(/MSIE 5\.0/)) {
           // no IE5.0
           element.style.cursor = "pointer" ;
       } else if (element.className == "Tabpanel") {
           element.style.display ="none" ;
       } else if (element.className == "Tabdisplay") {
           var node =   element.nextSibling ;
           while (node.nodeName != "DIV") {
               node = node.nextSibling;
           }
           element.innerHTML = node.innerHTML;
           // now colour the th
           var table = getNodeUp(element, "TABLE") ;
           var th = table.getElementsByTagName("TH");
           for (var i = 1 ; i< th.length;i++) {
               th[i].style.backgroundColor = "white" ;
           }
       }
   }
   function getNodeUp (node, nodeType) {
       while (node.nodeName != nodeType) {
           node=node.parentNode;
       }
       return node ;
   }
   function documentready() {
       
   }
   function raiseTab () {
       var node = element ;
       var table = node ;
       // get the th walking up the tree
       // that's why we can't bind to th, td, tr, table in mozilla
       while (node.nodeName != "TH") {
           node = node.parentNode;
       }
       while (table.nodeName != "TABLE") {
           table = table.parentNode ;
       }
       var newCol = node.cellIndex ;
       var headers = node.parentNode.getElementsByTagName("TH");
       for (var i = 0 ; i<headers.length; i++) {
           headers[i].style.backgroundColor = "white" ;
       }
       headers[newCol].style.backgroundColor = table.style.backgroundColor ;
       var ix = 1 ;
       if (ie) {
           ix = 0 ;
       }
       var allTR = node.parentNode.parentNode.parentNode.childNodes[ix].getElementsByTagName("TR") ; //childNodes
       var divs = allTR[1].getElementsByTagName("DIV");
       divs[0].innerHTML = divs[newCol+1].innerHTML ;
    }
    //]]>
</script>
</public:component>
