//
/*=========================================================
   Copyright © 2000-2005 Vadim Werbitzky
   All rights reserved.
   JsGui: Basics (alpha 01.08)
  =========================================================
//a_01_07 22.10.2004
//BASIC JSGUI API
//INCLUDES: BASICS, BUTTONS and TABS
//REQUIRED: /scripts/transparent.gif
in version alpha 01.07 added: 
	- labelPanel functionality: now you can add mouseover/mouseout to TAB objects for alternating text and css-class assignment to the labelPanel(s) of an object
	- panels now have an myIdx property, for more simple handling in compound objects like TABS: the myIdx is like an object-local id ...
	- added automatic hor. align method alignToCenter() to center TABs object in windows/frames
	- browser sniffing: w3c now default (may be somehow idealistic...) and some other lazy oddities...sorry!
	- visibility: now implemented for EP, IP and TP, and as setVisible() method fot the TAB object
//a_01_08 12.04.2005
in version alpha 01.08 added: 
	- enabling capturing mouse-move events by calling onloadInitEventCapture() onload
        and storing the mouse coordinates in the global variables gMouseCoordinates["x"] and gMouseCoordinates["y"] 
        using the function innerWriteMouseCoors(e) (this function is called automatically after mousemove capturing
	  has been enabled)
	- function jsBF_getMouseCoors() retreives the actual position by returning the tuple
  =========================================================
*/
 /*---------------------------------*\
  * GLOBALS
 \*---------------------------------*/
  var gIsIE=false;//IE<7 (or Opera<7.x:no warranty!)
  var gIsNN=false;//NN 4.x
  var gIsW3C=true;//The hopefully Standards Compliant Browsers: NN>=6.x or Mozilla, Opera>=7.x ...

  var gScreenSizes = new Array();

  var gAllObject = "";
  var gStyleObject = "";

  var transparentGifURL = "scripts/transparent.gif";


  function init_globals()
  {
    if (navigator.appName.toLowerCase().indexOf("netscape")!=-1)//NETSCAPE-MOZILLA
    {
      if (parseInt(navigator.appVersion)==4)
      {
        gIsNN=true;
	  gIsW3C=false;
      }
      else if (parseInt(navigator.appVersion)>=5)
      {
        gIsW3C=true;
      }

    }
    else if(window.opera){//OPERA
	if(!(navigator.userAgent.toLowerCase().indexOf('opera 7')>-1) && 
	!(navigator.userAgent.toLowerCase().indexOf('opera/7')>-1)){
	  gIsIE=true;//like IE<6
	  gIsW3C=false;	
	}
    }
    else if (navigator.appName.toLowerCase().indexOf("microsoft")!=-1)//IE
    {
      
      if ((navigator.appVersion.indexOf("MSIE 5")>-1)||(navigator.appVersion.indexOf("MSIE 6")>-1))
      {
        gIsIE=true;
	  gIsW3C=false;
      } 
    }
    //alert("Is IE?: " + gIsIE);
    //
    gScreenSizes['width'] = window.screen.width;
    gScreenSizes['height'] = window.screen.height;
  }

  function onloadInitEventCapture(){
    //capturing mouse-move events -----------------------------
    if(window.Event){
	if(navigator.userAgent.indexOf("Konqueror") == -1 &&
		navigator.userAgent.indexOf("Safari") == -1){
	document.captureEvents(Event.MOUSEMOVE);
    	}else {
	window.captureEvents(Event.MOUSEMOVE);}
    }

    document.onmousemove = innerWriteMouseCoors;
    //------------------------------------------------------
  }
  //=_=_=_=_=_=_=_=_=_=_
  // the following variable and function
  // make the coordinates of the mouse-position globally available
  // as an array, where the ["x"] contains the x-coordinate and ["y"] ...
  gMouseCoordinates = new Array();
  function innerWriteMouseCoors(e){
	if(gIsNN ){
		gMouseCoordinates ["x"] = e.pageX;
		gMouseCoordinates ["y"] = e.pageY;
	} else if (gIsIE){
		gMouseCoordinates ["x"] = event.clientX;
		gMouseCoordinates ["y"] = event.clientY;
	} else if (gIsW3C) {
		gMouseCoordinates ["x"] = e.clientX;
		gMouseCoordinates ["y"] = e.clientY;
	}
      window.status = "x: " + gMouseCoordinates ["x"] + "/ y: " + gMouseCoordinates ["y"];
      return true;
  }

 //=============
 // INIT
 //=============
 init_globals();

 /*---------------------------------*\
  * API - BASICS
 \*---------------------------------*/
  //################
  //jsBO: js basic objects
  //################
  var jsBO_LayerToObjectTable = new Array();//layer names as indices
  var jsBO_ClassInstanceList = new Array();//instance names as indices
  //
  var jsBO_ObjectCounter=0;
  //
  //............
  //first ten reserved;
  //10 zIndex levels per jsgui-Object: (1-10, 11-20 ...)=metalevels(1, 2 ...)
  //............
  var jsBO_zReservationPerObject = 10;
  var jsBO_CurrentMaxMetaZindexLevel=11;
  //
  var jsBO_JsGuiConstantImages = new Array();

  jsBO_JsGuiConstantImages["transparent"] = new Image();
  jsBO_JsGuiConstantImages["transparent"].src = transparentGifURL;//transparent.gif tabEndaSel.jpg butOkAct.gif
  //

//################
//jsBF: js basic function
//################
  //#########################
  //works only "onload" in IE(after the page has been loaded)
  //#########################
  function jsBF_getSizesOfWindow(windowOrFrameRef)
  {
    var sizes = new Array();
    if(gIsNN || gIsW3C)
    {
      sizes["width"]=windowOrFrameRef.innerWidth;
      sizes["height"]=windowOrFrameRef.innerHeight;
    }
    else if(gIsIE)
    {
      sizes["width"]=windowOrFrameRef.document.all.tags("body")[0].offsetWidth;
      sizes["height"]=windowOrFrameRef.document.all.tags("body")[0].offsetHeight;
    }
    return sizes;
  }

  //-----------------
  // returns mouse coordinates as array[2], 
  // where the ["x"] contains the x-coordinate and ["y"] ...???
  //-----------------
  function jsBF_getMouseCoors()
  {
	return gMouseCoordinates ;
  }


  function jsBF_getTagObjectByName(objName)
  {
    var theObj;
    var strAll = "";
    if(gIsIE)strAll="all.";
    else if(gIsNN)strAll="ids.";//layers.
    if(gIsNN || gIsIE)
      theObj = eval("document." + strAll + objName);
    else if(gIsW3C)
      theObj = document.getElementById(objName);
    return theObj;
  }

  function jsBF_getLayerObjectByName(objName)
  {
    var theObj;
    var strAll = "";
    if(gIsIE)strAll="all.";
    else if(gIsNN)strAll="layers.";
    if(gIsNN || gIsIE)
      theObj = eval("document." + strAll + objName);
    else if(gIsW3C)
      theObj = document.getElementById(objName);
    return theObj;
  }

  function jsBF_getLayerObjectInFrame(frameRef, theObject)
  {
    var theObj;

    if(typeof theObject == "string")
    {
      if (gIsW3C)
      {
        theObj = frameRef.document.getElementById(theObject);
        //alert("theObj: " + theObj);
      }
      else if (gIsIE)
      {
        theObj = frameRef.document.all[theObject];
      }
      else if(gIsNN)
      {
        theObj = frameRef.document.layers[theObject]
      }
    }
    else
    {
      theObj = theObject;
    }
    return theObj;
  }

  //lyrToBeVisible: boolean
  function jsBF_setLayerObjectVisible(lyrRef, lyrToBeVisible)
  {
    var lyrStyle = jsBF_getObjectStyleReference(lyrRef);
    if(gIsW3C || gIsIE)
    {
      if(lyrToBeVisible)lyrStyle.visibility = "visible";
      else lyrStyle.visibility = "hidden";
    }
    else if(gIsNN)
    {
      if(lyrToBeVisible)lyrStyle.visibility = "show";
      else lyrStyle.visibility = "hide";
    }
//alert(lyrRef.id + " : " + lyrStyle.visibility);
  }

  //returns Array of x and y
  function jsBF_getLayerObjectPos(lyrRef)
  {
	var lyrStyle = jsBF_getObjectStyleReference(lyrRef);
	var thePosition = new Array();
    	var propLeft = "left";
   	var propTop = "top";
    	if(gIsIE){propLeft = "pixelLeft";propTop = "pixelTop";}

      thePosition ["x"] = parseInt(lyrStyle[propLeft]);
      thePosition ["y"] = parseInt(lyrStyle[propTop]);

	return thePosition;
  }

  //returns Array of width and height
  function jsBF_getLayerObjectSize(lyrRef)
  {
    var lyrStyle = jsBF_getObjectStyleReference(lyrRef);
    if(gIsNN)lyrStyle = document.ids[lyrRef.id];
    var theSize = new Array();
    var propWidth = "width";
    var propHeight = "height";

    theSize["width"] = parseInt(lyrStyle[propWidth]);
    theSize["height"] = parseInt(lyrStyle[propHeight]);

    return theSize;
  }
/*
TO DO: resizing predefined lyrs with(a) image content: reloading image tag! (b) txt content: reclipping!
  function jsBF_setLayerObjectSize(lyrRef, objWidth, objHeight)
  {
alert("lyrRef.id: " + lyrRef.id);
    var lyrStyle = jsBF_getObjectStyleReference(lyrRef);
    var px = "";
    if(gIsNN)px = "";
    var propWidth = "width";
    var propHeight = "height";

    lyrStyle[propWidth] = objWidth;
    lyrStyle[propHeight] = objHeight;
  }*/

  function jsBF_moveLayerObjectTo(lyrRef, xPos, yPos)
  {
    var lyrStyle = jsBF_getObjectStyleReference(lyrRef);
    var pix ="";
    if(gIsW3C)pix = "px";
    var propLeft = "left";
    var propTop = "top";
    if(gIsIE){propLeft = "pixelLeft";propTop = "pixelTop";}

    lyrStyle[propLeft]= xPos + pix;
    lyrStyle[propTop]= yPos + pix;
  }

  function jsBF_moveLayerObjectBy(lyrRef, xMove, yMove)
  {
    var lyrStyle = jsBF_getObjectStyleReference(lyrRef);
    var pix ="";
    if(gIsW3C)pix = "px";
    var propLeft = "left";
    var propTop = "top";
    if(gIsIE){propLeft = "pixelLeft";propTop = "pixelTop";}
    var xPos;
    var yPos;

    xPos = parseInt(lyrStyle[propLeft]);
    yPos = parseInt(lyrStyle[propTop]);
    lyrStyle[propLeft]= xPos + xMove + pix;
    lyrStyle[propTop]= yPos + yMove + pix;

  }

  function jsBF_writeToLayer(lyrRef, theText)
  {
    if(gIsW3C || gIsIE)
    {
	lyrRef.innerHTML = theText;
    }
    else if(gIsNN)
    {
	lyrRef.document.open();
	lyrRef.document.write(theText);
	lyrRef.document.close();
    }
  }
  function jsBF_setFlashInTableToLayer(lyrRef, flashUrl, tCellpadding, tCellspacing, tBorder, objWidth, objHeight, bgcolor, cssClassName)
  {
         var htmlTableBeg="<table id='TAB_" + lyrRef.id + "' ";
         var tableBorder="border='" + tBorder + "' width='"+ objWidth +"' height='"+objHeight+"' "
         var tableCellpadding="cellpadding='" + tCellpadding + "' ";
         var tableCellspacing="cellspacing='" + tCellspacing + "'>";
         var tdId="<tr><td id='TD_" + lyrRef.id + "' ";
         var tdClassname="class='" + cssClassName  + "'>";

         var objectDefinitionBeg  = '<object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" ';
	   var objectDefinitionParams = 'width="' + objWidth + '" height="' + objHeight + '"><param name="movie" value="' + flashUrl  + '"><param name="quality" value="high"><param name="bgcolor" value="' + bgcolor + '">';
	   var embedDefinition = '<embed src="' + flashUrl + '" quality="high" bgcolor="' + bgcolor + '" width="' + objWidth  + '" height="' + objHeight + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">';
	   var objectDefinitionEnd = '</object>';
         var htmlTableEnd="</td></tr></table>";


         var txtHtmlDefinition = htmlTableBeg + tableBorder + tableCellpadding + tableCellspacing +
                             tdId + tdClassname + objectDefinitionBeg + objectDefinitionParams + 
				     embedDefinition + objectDefinitionEnd +htmlTableEnd;

	   jsBF_writeToLayer(lyrRef, txtHtmlDefinition);
  }

  function jsBF_setTextInTableToLayer(lyrRef, theText, tCellpadding, tCellspacing, tBorder, objWidth, objHeight, cssClassName)
  {
         var htmlTableBeg="<table ";
         var tableBorder="border='" + tBorder + "' width='"+ objWidth +"' height='"+objHeight+"' "
         var tableCellpadding="cellpadding='" + tCellpadding + "' ";
         var tableCellspacing="cellspacing='" + tCellspacing + "'>";
         var tdId="<tr><td ";
         var tdClassname="class='" + cssClassName  + "'>";
	   var thePassedInText = theText;
         var htmlTableEnd="</td></tr></table>";


         var txtHtmlDefinition = htmlTableBeg + tableBorder + tableCellpadding + tableCellspacing +
                             tdId + tdClassname + thePassedInText + htmlTableEnd;
//alert(txtHtmlDefinition);
	   jsBF_writeToLayer(lyrRef, txtHtmlDefinition);
  }
  //################
  //uses the jsBO_LayerToObjectTable array!
  //################

  function jsBF_getClassInstanceByLayerName(lyName)
  {
    for(nm in jsBO_LayerToObjectTable)
    {
      if(nm == lyName)
      {
        return jsBO_LayerToObjectTable[lyName];
      }
    }
    return null;
  }
  //################
  //uses the jsBO_ClassInstanceList array!
  //################
  function jsBF_getClassInstanceByName(instanceName)
  {
    for(nm in jsBO_ClassInstanceList)
    {
      if(nm == instanceName)
      {
        alert("instanceName: " + instanceName);
        return jsBO_ClassInstanceList[instanceName];
      }
    }
    return null;
  }


  //################
  //objects style references:
  //if necessary call jsBF_getObjectByName("...") first
  //################
  function jsBF_getObjectStyleReference(objReference)
  {
    var theObj = objReference;
    if(gIsNN)return theObj;
    else if(gIsW3C || gIsIE)return theObj.style;
  }

  //################
  //objVisi: true or false
  //################
   function jsBF_createObject(objWidth, objHeight, objLeft, objTop, objVisi, customProps)
   {
     var newObject;
     jsBO_ObjectCounter++;
     var objID = 'newJsGuiObject'+jsBO_ObjectCounter;

     if (gIsNN)
     {
        newObject=new Layer(300);
        newObject.width=objWidth;
        newObject.height=objHeight;
        newObject.left=objLeft;
        newObject.top=objTop;

        newObject.jsGuiId = newObject.id;
        newObject.customProps = customProps;
        //alert("newObject.jsGuiId: " + newObject.jsGuiId);

        newObject.document.open();
        newObject.document.write("&nbsp;");
        newObject.document.close();

        if(objVisi)newObject.visibility="show";
        else newObject.visibility="hide";

        newObject.clip.width=objWidth;
        newObject.clip.height=objHeight;
     }
     else if (gIsIE)
     {
        var stringInnerHTML="<div id='"+ objID + "'>&nbsp;<\/div>";
        document.body.insertAdjacentHTML("BeforeEnd", stringInnerHTML);

        newObject = document.all[objID];
        newObject.jsGuiId = newObject.id;
        newObject.customProps = customProps;
        var newObjectRef = newObject.style;
        //
        newObjectRef.position="absolute";
        newObjectRef.left=objLeft+"px";
        newObjectRef.top=objTop+"px";
        newObjectRef.width=objWidth+"px";
        newObjectRef.height=objHeight+"px";
     }
     else if (gIsW3C)//  The Standards Compliant Way
     {
        newObject=document.createElement("DIV");
        newObject.setAttribute("id", objID);
        newObject.jsGuiId = newObject.getAttribute("id");
        newObject.customProps = customProps;
        //
        var newObjectRef = newObject.style;
        newObjectRef.position="absolute";
        newObjectRef.left=objLeft+"px";
        newObjectRef.top=objTop+"px";
        newObjectRef.width=objWidth+"px";
        newObjectRef.height=objHeight+"px";
        //
        document.body.appendChild(newObject);
     }
     //
     return newObject;
   }//END jsBF_createObject

  //################
  //returns reference to the image object
  //################
   function jsBF_insertImageToObject(targetObject, preloadedImage)
   {
     var imgHtmlDefinition = "";
     var imgWidth;
     var imgHeight;
     var imgRef;

     if(gIsIE||gIsW3C)
     {
      imgWidth = targetObject.style.width;
      imgHeight = targetObject.style.height;
     }
     else if(gIsNN)
     {
      imgWidth = targetObject.width;
      imgHeight = targetObject.height;
     }

     if (gIsNN)
     {
      imgHtmlDefinition +=
        '<img name="' + 'i' + targetObject.jsGuiId + '"src="' + transparentGifURL + '" alt="" width="' + imgWidth + '" height="' + imgHeight + '">';

        targetObject.document.open();
        targetObject.document.write(imgHtmlDefinition);
        targetObject.document.close();
        //
        imgRef = targetObject.document.images[0];
     }
     else if (gIsIE)
     {
      imgHtmlDefinition +=
        '<img name="' + 'i' + targetObject.jsGuiId + '"src="' + transparentGifURL + '" alt="" width="' + imgWidth + '" height="' + imgHeight + '">';

        targetObject.innerHTML = imgHtmlDefinition;
        //
        imgRef = targetObject.children[0];
     }
     else if (gIsW3C)//  The Standards Compliant Way
     {
        //1 emptify targetObject
        if(targetObject.hasChildNodes())targetObject.removeChild(targetObject.firstChild);

        //2 create imageobject and set attribute
        var newImageObject = document.createElement("IMG");
        newImageObject.setAttribute("name", "i" + targetObject.jsGuiId);
        newImageObject.setAttribute("src", transparentGifURL);
        newImageObject.setAttribute("width", imgWidth);
        newImageObject.setAttribute("height", imgHeight);

        //3 hang imageobject into targetObject
        targetObject.appendChild(newImageObject);

        //
        imgRef = targetObject.firstChild;
     }
     imgRef.src = preloadedImage.src;
     return imgRef;
   }//END jsBF_insertImageToObject

   //################
   //eventName: "mouseover" functionName: "makeSomething"
   //################
   function jsBF_addEventListener(targetObject, eventName, functionRef)
   {
     if (gIsNN)
     {
        var evalEvent = eval("Event." + eventName.toUpperCase());
        targetObject.captureEvents(evalEvent);
        targetObject["on"+eventName] = functionRef;
     }
     else if (gIsIE)
     {
        targetObject["on"+eventName] = functionRef;
     }
     else if (gIsW3C)
     {
        targetObject.addEventListener(eventName, functionRef, false);
     }
   }

   //################
   //eventName: "mouseover" functionName: "makeSomething"
   //################
   function jsBF_removeEventListener(targetObject, eventName, functionRef)
   {
     if (gIsNN)
     {
        var evalEvent = eval("Event." + eventName.toUpperCase());
        targetObject.releaseEvents(evalEvent);
        targetObject["on"+eventName] = null;
     }
     else if (gIsIE)
     {
        targetObject["on"+eventName] = null;
     }
     else if (gIsW3C)
     {
        targetObject.removeEventListener(eventName, functionRef, false);
     }
//alert("Listener removed for: " + targetObject.id);
   }

   /*---------------------------------*\
    * API - classes
   \*---------------------------------*/
   //jsC  = js constructor
   //_CL_ = class
   //################
   //eventTargetObject: an object which has ...Performed...methods, which then
   //                   are called from the jsC_CL_EventPanel
   //                   optional, if no such object is used, pass-in null;
   //objName HAS TO BE UNIQUE!
   //################
   function jsC_CL_EventPanel(objName, objWidth, objHeight, objLeft, objTop, objVisi, objMetaZindex, eventTargetObject)
   {
      /*++++++++++++++++++++++++*\
       * Implementations
      \*++++++++++++++++++++++++*/
      //var LOII = new Array();//List of implemented "Interfaces"
      //var OPL = new Array(); //implemented Object Panel Layers:
                               //opl["eventLayer"], opl["textLayer"], opl["graficLayer1"][... optional...], ... ,opl["graficLayerN"][... optional...]
      this.IET = new Array();//Implemented Event Types with Event Type Methods names
      this.IET["mousedown"]  = "mouseDownPerformed";
      this.IET["mouseup"]    = "mouseUpPerformed";
      this.IET["mouseover"]  = "mouseOverPerformed";
      this.IET["mouseout"]   = "mouseOutPerformed";

      /*++++++++++++++++++++++++*\
       * Variables and initializing
      \*++++++++++++++++++++++++*/
      this.name       =   objName;
        jsBO_ClassInstanceList[this.name] = this;
      this.eventTargetObject = eventTargetObject;//see Method Calls

      //
	this.myIdx = 0; //In single-objects myIdx is 0, in compound objects it is used for component indexing
      this.objWidth   =   objWidth;
      this.objHeight  =   objHeight;
      this.objLeft    =   objLeft;
      this.objTop     =   objTop;
      this.objVisi    =   objVisi;
      this.objMetaZindex = objMetaZindex;
        if(jsBO_CurrentMaxMetaZindexLevel<this.objMetaZindex)jsBO_CurrentMaxMetaZindexLevel = this.objMetaZindex;
      this.objAbsoluteZindex = this.objMetaZindex*jsBO_zReservationPerObject;//the eventPanel-layer is always the "top-est" of the meta-index-set
      //
      //
      var customProps = new Array();
      customProps[0] = "EVENT_PANEL";
      this.imgContainer = jsBF_createObject(objWidth, objHeight, objLeft, objTop, objVisi, customProps);//layer containing images
      //SETTING LEVEL:
      this.imgContainerRef = jsBF_getObjectStyleReference(this.imgContainer);
      this.imgContainerRef.zIndex = this.objAbsoluteZindex;
      //SETTING VISIBILITY:
      jsBF_setLayerObjectVisible(this.imgContainer, objVisi);

      //++++++++++++++++
      //layer registration in a global list
      //++++++++++++++++
      jsBO_LayerToObjectTable[this.imgContainer.id] = this;

      this.currentImage = jsBF_insertImageToObject(this.imgContainer, jsBO_JsGuiConstantImages["transparent"]);//the image object through which images can be loaded (.src=...)
      //
      this.listeners = new Array();
        for(eventTypeName in this.IET)
        {
          this.listeners[eventTypeName] = new Array();
        }

      /*++++++++++++++++++++++++*\
       * Methods Declarations
      \*++++++++++++++++++++++++*/
      this.setMetaZindex = setMetaZindex;
      //
      this.handleFunction = handleFunction;
      //
      this.addListener = addListener;
      this.removeListener = removeListener;
      //

      /*++++++++++++++++++++++++*\
       * Methods Definitions
      \*++++++++++++++++++++++++*/
      function setMetaZindex(metaZindex)
      {
        this.objMetaZindex = metaZindex;
        if(jsBO_CurrentMaxMetaZindexLevel<this.objMetaZindex)jsBO_CurrentMaxMetaZindexLevel = this.objMetaZindex;
        this.objAbsoluteZindex = this.objMetaZindex*jsBO_zReservationPerObject;//the "toppest" level!
        //SETTING LEVEL:
        this.imgContainerRef.zIndex = this.objAbsoluteZindex;
      }
      //------
      //EVENTS
      //------


      function handleFunction(e)
      {
//alert("handleFunction called!");
        var targetObject;
        var eventType;
        if(gIsNN || gIsW3C)
        {
          targetObject = e.target;
          eventType = e.type;
        }
        else if(gIsIE)
        {
          targetObject = window.event.srcElement;
          eventType = window.event.type;
        }

        var theClass = jsBF_getClassInstanceByLayerName(targetObject.name.substring(1));

        for(eventTypeName in theClass.IET)
        {
          if(eventTypeName == eventType)
          {
            for(listenObj in theClass.listeners[eventTypeName])
            {
              //eval("theClass.listeners["+eventTypeName+"]["+listenObj+"]." + theClass.IET[eventTypeName] + "(e)");
              theClass.listeners[eventTypeName][listenObj][theClass.IET[eventTypeName]](e);
            }
          }
        }



        //FOLLOWING LINES IMPORTANT FOR EVENT BEHAVIOUR!
        //if(gIsIE)window.event.cancelBubble = true;
        if (gIsW3C)e.preventDefault();
        return false;//NN
      }


      function addListener(listenerObject)
      {
        for(eventTypeName in this.IET)
        {
		var listenerAlreadyExists = false;
		for(var i=0; i<this.listeners[eventTypeName].length;i++)
		{
			if(this.listeners[eventTypeName][i] == listenerObject)
			{
				listenerAlreadyExists = true;
				break;
			}
		}
//alert("listenerAlreadyExists: " + listenerAlreadyExists);
		if(listenerAlreadyExists)break;
            if(listenerObject!=null&&listenerObject[this.IET[eventTypeName]]&&listenerObject[this.IET[eventTypeName]]!=null)
            {
//alert("listener added: " + listenerObject.name + " for " + this.name);
              this.listeners[eventTypeName][this.listeners[eventTypeName].length] = listenerObject;
              jsBF_addEventListener(this.imgContainer, eventTypeName, this.handleFunction);
            }
        }
      }
	
	function removeListener(listenerObject)
	{
		//jsBF_removeEventListener(targetObject, eventName, functionRef)
	  var listenersClone = new Array();
        for(eventTypeName in this.IET)
        {		
		listenersClone[eventTypeName] = new Array();
		for(var i=0; i<this.listeners[eventTypeName].length;i++)
		{
			if(this.listeners[eventTypeName][i] != listenerObject)
			{
				listenersClone[eventTypeName][listenersClone[eventTypeName].length] = listenerObject;
			}
			else jsBF_removeEventListener(this.imgContainer, eventTypeName, this.handleFunction);
		}
        }
	  this.listeners = listenersClone;
	}

      /*++++++++++++++++++++++++*\
       * Methods Calls
      \*++++++++++++++++++++++++*/
      if(this.eventTargetObject!=null)this.addListener(this.eventTargetObject);
      //

   }//END EVENT PANEL

  //################
  //simple table with passed-in text
  //objName HAS TO BE UNIQUE!
  //################
   function jsC_CL_LabelPanel(objName, objWidth, objHeight, objLeft, objTop, objVisi, objMetaZindex, textString, tdElementId, cssClassName, tBorder, tCellpadding, tCellspacing)
   {
      /*++++++++++++++++++++++++*\
       * Implementations
      \*++++++++++++++++++++++++*/
      //var LOII = new Array();//List of implemented "Interfaces"

      /*++++++++++++++++++++++++*\
       * Variables and initializing
      \*++++++++++++++++++++++++*/
      this.name       =   objName;
        jsBO_ClassInstanceList[this.name] = this;

      //
      this.myIdx = 0; //In single-objects myIdx is 0, in compound objects it is used for component indexing
      this.objWidth   		=   	objWidth;
      this.objHeight  		=   	objHeight;
      this.objLeft    		=   	objLeft;
      this.objTop     		=   	objTop;
      this.objVisi    		=   	objVisi;
      this.objMetaZindex 	= 	objMetaZindex;
	this.textString		=	textString;
	this.tdElementId		=	tdElementId;
	this.cssClassName		=	cssClassName;
	this.tBorder		=	tBorder;
	this.tCellpadding		=	tCellpadding;
	this.tCellspacing		=	tCellspacing;

        if(jsBO_CurrentMaxMetaZindexLevel<this.objMetaZindex)jsBO_CurrentMaxMetaZindexLevel = this.objMetaZindex;
      this.objAbsoluteZindex = this.objMetaZindex*jsBO_zReservationPerObject-1;//the labelPanel-layer is always the "topopest-1" of the meta-index-set
      //
      //
      var customProps = new Array();
      customProps[0] = "LABEL_PANEL";
      this.txtContainer = jsBF_createObject(objWidth, objHeight, objLeft, objTop, objVisi, customProps);//layer containing texttable
      this.txtContainerRef = jsBF_getObjectStyleReference(this.txtContainer);
      this.txtContainerRef.clip = "rect(0px "+ objWidth +" "+ objHeight +" 0px)";
      //SETTING LEVEL:
      this.txtContainerRef.zIndex = this.objAbsoluteZindex;
//alert("txtContainerRef.clip: " + txtContainerRef.clip);
	jsBF_setTextInTableToLayer(this.txtContainer, this.textString, this.tCellpadding, this.tCellspacing, this.tBorder, this.objWidth, this.objHeight, this.cssClassName);
      //SETTING VISIBILITY:
      jsBF_setLayerObjectVisible(this.txtContainer, objVisi);
     
     this.txtHtmlDefinition = "";
     
     this.txtRef = jsBF_getTagObjectByName("TD_" + tdElementId);

      /*++++++++++++++++++++++++*\
       * Methods Declarations
      \*++++++++++++++++++++++++*/
      this.setMetaZindex = setMetaZindex;
      this.setTextStyleAttribute = setTextStyleAttribute;
      this.setNewLabelText = setNewLabelText;
      //

      /*++++++++++++++++++++++++*\
       * Methods Definitions
      \*++++++++++++++++++++++++*/
      function setMetaZindex(metaZindex)
      {
        this.objMetaZindex = metaZindex;
        if(jsBO_CurrentMaxMetaZindexLevel<this.objMetaZindex)jsBO_CurrentMaxMetaZindexLevel = this.objMetaZindex;
        this.objAbsoluteZindex = this.objMetaZindex*jsBO_zReservationPerObject-1;//the "toppest-1" level!
        //SETTING LEVEL:
        txtContainerRef.zIndex = this.objAbsoluteZindex;
      }

      function setTextStyleAttribute(cssAttributeName, cssAttributeValue)
      {
        var styleRef = this.txtRef;
        if(gIsW3C || gIsIE)styleRef = styleRef.style;
        if(gIsNN)
        {
            styleRef[cssAttributeName] = cssAttributeValue;
            //
            this.txtContainer.document.open();
            this.txtContainer.document.write(this.txtHtmlDefinition);
            this.txtContainer.document.close();
        }
        else if(gIsW3C || gIsIE)
        {
            styleRef[cssAttributeName] = cssAttributeValue;
        }
      }

	function setNewLabelText(theNewText, theNewCSSclassName)
	{
		//jsBF_setTextInTableToLayer(lyrRef, theText, tCellpadding, tCellspacing, tBorder, objWidth, objHeight, 			//cssClassName)
		if(theNewText)		this.textString		=	theNewText;
		if(theNewCSSclassName)	this.cssClassName 	= 	theNewCSSclassName;
		jsBF_setTextInTableToLayer(this.txtContainer, this.textString, this.tCellpadding, this.tCellspacing, this.tBorder, this.objWidth, this.objHeight, this.cssClassName);

	}//END setNewLabelText()

   }//END LABEL PANEL

  //################
  //objMetaLevel: >= 2: Level 0 is reserved for event panels, level 1 for label panels
  //objPreloadedImage: if you pass-in null, you have to call later the method setPreloadedImage(newPreloadedImage)
  //objName HAS TO BE UNIQUE!
  //################
   function jsC_CL_ImagePanel(objName, objWidth, objHeight, objLeft, objTop, objVisi, objMetaZindex, objMetaLevel, objPreloadedImage)
   {
      /*++++++++++++++++++++++++*\
       * Implementations
      \*++++++++++++++++++++++++*/
      //var LOII = new Array();//List of implemented "Interfaces"

      /*++++++++++++++++++++++++*\
       * Variables and initializing
      \*++++++++++++++++++++++++*/
      this.name       =   objName;
        jsBO_ClassInstanceList[this.name] = this;

      var customProps = new Array();
      customProps[0] = "IMAGE_PANEL";

      this.imgContainer = jsBF_createObject(objWidth, objHeight, objLeft, objTop, objVisi, customProps);//layer containing image
      jsBO_LayerToObjectTable[this.imgContainer.id] = this;

      //
      this.myIdx = 0; //In single-objects myIdx is 0, in compound objects it is used for component indexing
      this.objWidth   =   objWidth;
      this.objHeight  =   objHeight;
      this.objLeft    =   objLeft;
      this.objTop     =   objTop;
      this.objVisi    =   objVisi;
      this.objMetaZindex = objMetaZindex;
      this.objMetaLevel = objMetaLevel;
        if(jsBO_CurrentMaxMetaZindexLevel<this.objMetaZindex)jsBO_CurrentMaxMetaZindexLevel = this.objMetaZindex;
      this.objAbsoluteZindex = this.objMetaZindex*jsBO_zReservationPerObject-this.objMetaLevel;//the imagePanel-layers are always on level>=2 of the meta-index-set

      //SETTING LEVEL:
      this.imgContainerRef = jsBF_getObjectStyleReference(this.imgContainer);
      this.imgContainerRef.zIndex = this.objAbsoluteZindex;
      //SETTING VISIBILITY:
      jsBF_setLayerObjectVisible(this.imgContainer, objVisi);      
      //
      this.objPreloadedImage = objPreloadedImage;
      this.currentImage=null;
      if(this.objPreloadedImage!=null)this.currentImage = jsBF_insertImageToObject(this.imgContainer, this.objPreloadedImage);

      /*++++++++++++++++++++++++*\
       * Methods Declarations
      \*++++++++++++++++++++++++*/
      this.setMetaZindex = setMetaZindex;
      this.setPreloadedImage = setPreloadedImage;
      this.stepDownMetaLevel = stepDownMetaLevel;
      this.stepUpMetaLevel = stepUpMetaLevel;
      //

      /*++++++++++++++++++++++++*\
       * Methods Definitions
      \*++++++++++++++++++++++++*/
      function setMetaZindex(metaZindex)
      {
        this.objMetaZindex = metaZindex;
        if(jsBO_CurrentMaxMetaZindexLevel<this.objMetaZindex)jsBO_CurrentMaxMetaZindexLevel = this.objMetaZindex;
        this.objAbsoluteZindex = this.objMetaZindex*jsBO_zReservationPerObject-this.objMetaLevel;
        this.imgContainerRef.zIndex = this.objAbsoluteZindex;
      }

      //works only within meta-level-range!
      function stepDownMetaLevel()
      {
        if(this.objAbsoluteZindex%jsBO_zReservationPerObject==jsBO_zReservationPerObject-1)
        {
          alert("stepDownMetaLevel not possible!");
          return;
        }
        else
        {
          this.objAbsoluteZindex--;
          this.objMetaLevel++;
          this.imgContainerRef.zIndex = this.objAbsoluteZindex;
        }
      }

      //works only within meta-level-range!
      function stepUpMetaLevel()
      {
        if(this.objAbsoluteZindex%jsBO_zReservationPerObject==0)
        {
          alert("stepUpMetaLevel not possible!");
          return;
        }
        else
        {
          this.objAbsoluteZindex++;
          this.objMetaLevel--;
          this.imgContainerRef.zIndex = this.objAbsoluteZindex;
        }
      }

      function setPreloadedImage(newPreloadedImage)
      {
        if(newPreloadedImage==null)return;
        this.objPreloadedImage = newPreloadedImage;
        //if not yet initialized
        if(this.currentImage==null)this.currentImage = jsBF_insertImageToObject(this.imgContainer, this.objPreloadedImage);
        this.currentImage.src = this.objPreloadedImage.src;
      }

   }//END IMAGE PANEL

   //################
   //objLabel: optional, if no such object is used, pass-in null;
   //objName HAS TO BE UNIQUE!
   //################
   function jsC_CL_Button(objName, objWidth, objHeight, objLeft, objTop, objVisi, objMetaZindex, objLabel)
   {
      /*++++++++++++++++++++++++*\
       * Implementations
      \*++++++++++++++++++++++++*/
      //var LOII = new Array();
      /*++++++++++++++++++++++++*\
       * Variables
      \*++++++++++++++++++++++++*/
      this.name     =   objName;
      this.objLabel =   objLabel;
      this.myIdx = 0; //In single-objects myIdx is 0, in compound objects it is used for component indexing
      //
      //var customProps = new Array();
      //customProps[0] = "BUTTON";

      //jsC_CL_ImagePanel(objName, objWidth, objHeight, objLeft, objTop, objVisi, objMetaZindex, objMetaLevel, objPreloadedImage)
      this.imagePanel =
        new jsC_CL_ImagePanel(objName+"IP", objWidth, objHeight, objLeft, objTop, objVisi, objMetaZindex, 2, null);

      this.labelPanel;
      if(this.objLabel!=null)
      {
          this.labelPanel =
            new jsC_CL_LabelPanel(objName+"LP", objWidth, objHeight, objLeft, objTop, objVisi, objMetaZindex, this.objLabel, objName+"LP", objName+"LP", 0, 0, 0);
//this.labelPanel.setTextStyleAttribute("text-align", "center");
//this.labelPanel.setTextStyleAttribute("color", "white");
      }

      //jsBO_LayerToObjectTable[this.imgContainer.id] = this;

      this.eventPanel; //FOR INITIALIZATION SEE BOTTOM OF CLASS DEF!

      //PRELOADED BUTTON IMAGES
      this.imgDown  =   null;
      this.imgUp    =   null;
      this.imgOver  =   null;
      this.imgOut   =   null;

      /*++++++++++++++++++++++++*\
       * Methods Declarations
      \*++++++++++++++++++++++++*/

      this.setPreloadedImages = setPreloadedImages;
      this.addListener = addListener;
	this.removeListener = removeListener;
      //
      this.mouseDownPerformed = mouseDownPerformed;
      this.mouseUpPerformed = mouseUpPerformed;
      this.mouseOverPerformed = mouseOverPerformed;
      this.mouseOutPerformed = mouseOutPerformed;
      /*++++++++++++++++++++++++*\
       * Methods Definitions
      \*++++++++++++++++++++++++*/
      //PRELOADED IMAGES!
      //imgOut is the DEFAULT IMAGE!
      function setPreloadedImages(imgDown, imgUp, imgOver, imgOut)
      {
        this.imgDown  =   imgDown;
        this.imgUp    =   imgUp;
        this.imgOver  =   imgOver;
        this.imgOut   =   imgOut;
        this.imagePanel.setPreloadedImage(this.imgOut);
        //this.currentImage = jsBF_insertImageToObject(this.imgContainer, this.imgOut);
      }
      function addListener(listenerObject)
      {
        this.eventPanel.addListener(listenerObject);
      }
//this.leftUpButton.removeListener(this);
      function removeListener(listenerObject)
      {
        this.eventPanel.removeListener(listenerObject);
      }
      //------
      //EVENTS
      //------
      /*Workarround for IE: IE is too slow in event handling!*/
      this.labelPosition;
      this.xUpPos;
      this.yUpPos;
      this.xDownPos;
      this.yDownPos;
      if(this.labelPanel!=null)
      {
              this.labelPosition = jsBF_getLayerObjectPos(this.labelPanel.txtContainer);

              this.xUpPos = this.labelPosition["x"];
              this.yUpPos = this.labelPosition["y"];
              this.xDownPos = this.xUpPos+2;
              this.yDownPos = this.yUpPos+2;
      }

      function mouseDownPerformed(e)
      {
        this.imagePanel.setPreloadedImage(this.imgDown);
        if(this.labelPanel!=null)jsBF_moveLayerObjectTo(this.labelPanel.txtContainer, this.xDownPos, this.yDownPos);
        //window.status = "button: mousedown";
      }

      function mouseUpPerformed(e)
      {
        this.imagePanel.setPreloadedImage(this.imgUp);
        if(this.labelPanel !=null)jsBF_moveLayerObjectTo(this.labelPanel.txtContainer, this.xUpPos, this.yUpPos);
        //window.status = "button: mouseup";
      }

      function mouseOverPerformed(e)
      {
        this.imagePanel.setPreloadedImage(this.imgOver);
        //window.status = "button: mouseover";
      }

      function mouseOutPerformed(e)
      {
        this.imagePanel.setPreloadedImage(this.imgOut);
        //window.status = "button: mouseout";
      }

      this.eventPanel = new jsC_CL_EventPanel(objName+"EP", objWidth, objHeight, objLeft, objTop, objVisi, objMetaZindex, this);
   }//END BUTTON


   //################
   //objLabel: optional, if no such object is used, pass-in null;
   //tabDirection: "VERTICAL" or "HORIZONTAL" or "STEPDOWN"
   //useLabelPanels:  true or false; if true, you have to set the labels using the
   //                 initTabSurface() method
   //objName HAS TO BE UNIQUE!
   //################
    function jsC_CL_Tabs(objName, objLeft, objTop, tabWidth, tabHeight, tabDirection, tabDist, numberOfTabs, activeTabIdx, objVisi, useLabelPanels, objMetaZindex)
    {
      /*++++++++++++++++++++++++*\
       * Implementations
      \*++++++++++++++++++++++++*/
      //var LOII = new Array();
      /*++++++++++++++++++++++++*\
       * Variables
      \*++++++++++++++++++++++++*/
      this.name     =   objName;
      //
	//?this.myIdx = 0; //In single-objects myIdx is 0, in compound objects it is used for component indexing
      this.imagePanels = new Array();
      this.labelPanels;
	this.useLabelPanels = useLabelPanels;
      if(this.useLabelPanels)this.labelPanels = new Array();
      this.eventPanels = new Array(); //FOR INITIALIZATION SEE BOTTOM OF CLASS DEF!
      //
      this.numberOfTabs = numberOfTabs;
      this.tabObjY = objTop;//abs. tabObj position
      this.tabObjX = objLeft;//abs. tabObj position
	this.lastXchng = 0;//info about the last horizontal movement of this object
	this.lastYchng = 0;//info about the last vertical  movement of this object
      this.objY;//only inner buffer!
      this.objX;//only inner buffer!
	this.tabWidth = tabWidth;
	this.tabHeight = tabHeight;
	this.tabDist = tabDist;
	this.tabDirection = tabDirection;
      this.tabSurfaceInitialized = new Array();

      for(i = 0; i < this.numberOfTabs; i++)
      {
        //var customProps = new Array();
        //customProps[0] = "TABS";
        //customProps["TAB_IDX"] = i;
        //this.imagePanels[i].imgContainer.customProps["TAB_IDX"] = i;
        this.tabSurfaceInitialized[i] = false;

        switch (tabDirection)
        {
          case "VERTICAL":
            this.objX = objLeft;
            this.objY = objTop + tabHeight*i + tabDist*i;
            break;
          case "HORIZONTAL":
            this.objX = objLeft + tabWidth*i + tabDist*i;
            this.objY = objTop;
            break;
          case "STEPDOWN":
            this.objX = objLeft + tabWidth*i + tabDist*i;
            this.objY = objTop + tabHeight*i + tabDist*i;
            break;
          default:alert("Wrong tabDirection!");
            break;
        }
        this.imagePanels[i] =
          new jsC_CL_ImagePanel(objName+i+"IP", tabWidth, tabHeight, this.objX, this.objY, objVisi, objMetaZindex, 2, null);
	  this.imagePanels[i].myIdx = i;
        //this.imagePanels[i].imgContainer.customProps["TAB_IDX"] = i;

        if(useLabelPanels)
        {
            this.labelPanels[i] =
              new jsC_CL_LabelPanel(objName+i+"LP", tabWidth, tabHeight, this.objX, this.objY, objVisi, objMetaZindex, "Label"+i, objName+"LP", objName+"CSS", 0, 0, 0);
	  	this.labelPanels[i].myIdx = i;
            //this.labelPanels[i].setTextStyleAttribute("align", "center");
        }

        //this.imgContainer[i] = jsBF_createObject(tabWidth, tabHeight, objX, objY, objVisi, customProps);
        //jsBO_LayerToObjectTable[this.imgContainer[i].id] = this;
      }

      this.activeTabIdx     = activeTabIdx;
      //this.currentImages    = new Array();//imageRef for each image container

      this.imgSelected      =   new Array();//for each tab!
      this.imgUnselected    =   new Array();;//for each tab!


      /*++++++++++++++++++++++++*\
       * Methods Declarations
      \*++++++++++++++++++++++++*/
      	this.initTabSurface = initTabSurface;
      	this.addListener = addListener;
      	//
      	this.mouseDownPerformed = mouseDownPerformed;
      	//added 22.10.2004:
      	//this.mouseOverPerformed = mouseHover;
	this.addMouseOverCSSEvent = addMouseOverCSSEvent;//remove not implemented....
	this.alignToCenter = alignToCenter;
	this.moveBy = moveBy;
	this.moveTo = moveTo;
	this.setVisible = setVisible;
      /*++++++++++++++++++++++++*\
       * Methods Definitions
      \*++++++++++++++++++++++++*/
      //PRELOADED IMAGES!
      //imgOut is the DEFAULT IMAGE!
      //labelText now implemented! (22.10.2004)
      //aNewCSSclassName: a new CSS class name is optional, the auto default name is objectname+CSS
      function initTabSurface(preImgSelected, preImgUnselected, labelText, tabIdx, aNewCSSclassName)
      {
        if(this.tabSurfaceInitialized[tabIdx])
        {
          alert("TabSurface already initialized: " + tabIdx);
          return;
        }

        if(this.numberOfTabs <= tabIdx)
        {
          alert("jsC_CL_Tabs.addPreloadedImages(): Index exceeds number of tabs!");
          return;
        }
        this.imgSelected[tabIdx]       =   preImgSelected;
        this.imgUnselected[tabIdx]     =   preImgUnselected;
        if(tabIdx!=this.activeTabIdx)
        {
          this.imagePanels[tabIdx].setPreloadedImage(preImgUnselected);
          this.imagePanels[tabIdx].stepDownMetaLevel();
        }
        else
        {
          this.imagePanels[tabIdx].setPreloadedImage(preImgSelected);
        }

	  //labelText setNewLabelText("newtxt")
        if(this.useLabelPanels)
	  {
		this.labelPanels[tabIdx].setNewLabelText(labelText, aNewCSSclassName);
        }

        this.tabSurfaceInitialized[tabIdx] = true;
      }

      function addListener(listenerObject)
      {
        for(i = 0; i < this.numberOfTabs; i++)
        {
          this.eventPanels[i].addListener(listenerObject);
        }
      }
	
	/*Special optional mouseOver handler, used by addMouseOverCSSEvent()*/
	function mouseOverHandler(newTxtIf_ElseNull, newCSSclassNameIf_ElseNull)
	{
		this.eventPanel;
		this.tabsObject;
		this.idx;
		this.labelPanel;
		this.txtBuffer;
		this.cssNameBuffer;

		this.mouseOverPerformed = mouseOverPerformed;
            this.mouseOutPerformed = mouseOutPerformed;

		function mouseOverPerformed(e)
		{
        		var targetObject;
        		//var eventType;
        		if(gIsNN || gIsW3C)
        		{
          			targetObject = e.target;
          			//eventType = e.type;
        		}
        		else if(gIsIE)
        		{
          			targetObject = window.event.srcElement;
          			//eventType = window.event.type;
        		}			
			
			this.eventPanel = jsBF_getClassInstanceByLayerName(targetObject.name.substring(1));
			//alert("!: " + this.eventPanel);
			this.idx = this.eventPanel.myIdx;
			this.tabsObject = this.eventPanel.eventTargetObject;
			this.labelPanel = this.tabsObject.labelPanels[this.idx];
			//alert("!!: " + this.labelPanel.myIdx);
			this.txtBuffer = this.labelPanel.textString;
			//alert("!!!: " + this.labelPanel.textString);
                  this.cssNameBuffer = this.labelPanel.cssClassName;
			if(this.labelPanel!=null)
			{
				//alert("newTxtIf_ElseNull: " + newTxtIf_ElseNull);
				this.labelPanel.setNewLabelText(newTxtIf_ElseNull, newCSSclassNameIf_ElseNull);
			}
		}
		function mouseOutPerformed(e)
		{
			if(this.labelPanel!=null)
			{
				this.labelPanel.setNewLabelText(this.txtBuffer, this.cssNameBuffer);
			}
		}
	}
	function addMouseOverCSSEvent(newTxtIf_ElseNull, newCSSclassNameIf_ElseNull){
		var newMouseOverHandler = new mouseOverHandler(newTxtIf_ElseNull, newCSSclassNameIf_ElseNull);
		this.addListener(newMouseOverHandler);

	}
	function moveBy(x, y){

		for(i=0; i<this.numberOfTabs; i++)
		{

			jsBF_moveLayerObjectBy(this.eventPanels[i].imgContainer, x, y);
			jsBF_moveLayerObjectBy(this.imagePanels[i].imgContainer, x, y);
			jsBF_moveLayerObjectBy(this.labelPanels[i].txtContainer, x, y);
		}
		this.lastXchng = x;//store horiz. movement information
		this.lastYchng  = y;//store vertical movement information
		this.tabObjX = this.tabObjX + x;
		this.tabObjY = this.tabObjY + y;
	}
	function moveTo(x, y){
		var chngXby = x - this.tabObjX;
		var chngYby = y - this.tabObjY;
		this.moveBy(chngXby, chngYby);
	}	
	/****/
	/* Aligns this TAB-Object horizontally to center in containing window or frame */
	function alignToCenter(windowOrFrameRef){
		      //sizes["width"]=
			//this.imagePanels this.labelPanels this.eventPanels
			//imgContainerRef txtContainerRef
      		//this.tabWidth this.numberOfTabs this.tabDist this.objY; this.objX;


		var sizes = jsBF_getSizesOfWindow(windowOrFrameRef);
		var tabObjWidth;
		var newTabObjX;
		var xChangeBy;

		switch (tabDirection)
        	{
          		case "VERTICAL":
            		tabObjWidth = this.tabWidth;
            		break;
          		case "HORIZONTAL":
          		case "STEPDOWN":
            		tabObjWidth = this.tabWidth * this.numberOfTabs 
					+ this.tabDist * (this.numberOfTabs-1);
            		break;
          		default:alert("alignCenter(): Wrong tabDirection!");
            		break;
        	}
		
		newTabObjX = (sizes["width"] - tabObjWidth)/2;
		/*alert("tabObjWidth: " + tabObjWidth + " sizes : " + sizes["width"]
+ " newTabObjX : " + newTabObjX + " old X : " + this.tabObjX);*/
		xChangeBy = newTabObjX - this.tabObjX;
		//this.lastXchng = xChangeBy;//store horiz. movement information
		//this.tabObjX = newTabObjX;
		//alert("xChangeBy  :" + xChangeBy);
		//jsBF_moveLayerObjectBy(lyrRef, xMove, yMove)
		this.moveBy(xChangeBy, 0);

	}//END alignToCenter()
	function setVisible(trueOrFalse){
		//jsBF_setLayerObjectVisible(this.imgContainer, trueOrFalse);
		for(i=0; i<this.numberOfTabs; i++)
		{
			jsBF_setLayerObjectVisible(this.eventPanels[i].imgContainer, trueOrFalse);
			jsBF_setLayerObjectVisible(this.imagePanels[i].imgContainer, trueOrFalse);
			jsBF_setLayerObjectVisible(this.labelPanels[i].txtContainer, trueOrFalse);
		}
	}
      //------
      //EVENTS
      //------


      function mouseDownPerformed(e)
      {
        var targetObject;
        if(gIsNN || gIsW3C)
        {
          targetObject = e.target;
        }
        else if(gIsIE)
        {
          targetObject = window.event.srcElement;
        }

        var theClass = jsBF_getClassInstanceByLayerName(targetObject.name.substring(1));
//alert("theClass.name: " + theClass.name);

        this.imagePanels[this.activeTabIdx].setPreloadedImage(this.imgUnselected[this.activeTabIdx]);
        this.imagePanels[this.activeTabIdx].stepDownMetaLevel();
        //
        this.activeTabIdx = theClass.imgContainer.customProps["TAB_IDX"];
        //
        this.imagePanels[this.activeTabIdx].setPreloadedImage(this.imgSelected[this.activeTabIdx]);
        this.imagePanels[this.activeTabIdx].stepUpMetaLevel();

      }
      /*++++++++++++++++++++++++*\
       * Post Inits
      \*++++++++++++++++++++++++*/
//new jsC_CL_ImagePanel(objName+i+"IP", tabWidth, tabHeight, this.objX, this.objY, objVisi, objMetaZindex, 2, null);
      for(i = 0; i < this.numberOfTabs; i++)
      {
        switch (tabDirection)
        {
          case "VERTICAL":
            this.objX = objLeft;
            this.objY = objTop + tabHeight*i + tabDist*i;
            break;
          case "HORIZONTAL":
            this.objX = objLeft + tabWidth*i + tabDist*i;
            this.objY = objTop;
            break;
          case "STEPDOWN":
            this.objX = objLeft + tabWidth*i + tabDist*i;
            this.objY = objTop + tabHeight*i + tabDist*i;
            break;
          default:alert("Wrong tabDirection!");
            break;
        }
        this.eventPanels[i] =
            new jsC_CL_EventPanel(objName+i+"EP", tabWidth, tabHeight, this.objX, this.objY, objVisi, objMetaZindex, this);
        this.eventPanels[i].imgContainer.customProps["TAB_IDX"] = i;
	  this.eventPanels[i].myIdx = i;
      }
    }//END TABS

   /*---------------------------------*\
    * TESTING
   \*---------------------------------*/

