function Erscheinung (liste)
{
this.aktuell         = 0;
this.liste           = liste;
this.attribut        = 1;
this.backwards       = backwards;
this.forwards       = forwards;
this.bcount          = 0;
this.fcount          = 0;

this.playlist        = playlist;
this.pcount          = 0;

this.playlist_rev    = playlist_rev;
this.prcount         = prcount = 0;

this.to_and_fro      = to_and_fro;
this.downcount       = 0;
this.upcount         = 0;
this.random          = random;
this.randomfaktor    = 1;
this.randomize       = randomize;

this.layer           = "";

//// Layeroperationen ///////

this.magnetism       = magnetism;
this.follower        = follower;
this.circles         = circles;
this.offsetter       = 0;               // für Kreise wichtig
this.satellite        = satellite;
this.movement         = movement;
this.center_movement  = center_movement;
this.distanz_movement = distanz_movement;

this.distancia       = distancia;

this.formula        = new formel(0,0,0,0)

this.colormix        = colormix;
this.farbverlauf     = farbverlauf;
this.farbzuweisung   = farbzuweisung;
this.hexa            = hexa;
this.color_abs       = 0;
this.color_hex       = null;

this.rot             = 1;
this.gruen           = 1;
this.blau            = 1;
/************** Mausoperationen ************/

this.screendistance  = screendistance;  // erzeugt den Abstand
this.abstand         = 1000;
this.mausverfolger   = mausverfolger;
this.msInd            = 2;             // Mausindex
this.bfInd            = 0;
this.mouse_smooth     = mouse_smooth;
this.mSmooth          = mSmooth;
this.mouseSynth       = mouseSynth;      // Mausverfolger mit Interpolation
this.mouseSynthC      = mouseSynthC;     // dito, lediglich Berechnung
this.mouseSynthesize  = mouseSynthesize;

this.xInd             = 0;               // Index für InterX-Array
this.yInd             = 0;               // Index für InterY-Array

this.smInd            = 0;
this.smInit           = 0;
this.bigXY            = new Boolean(false);  // für Smooth. Indiziert, ob x oder y größer ist

this.dirX             = new Boolean(true);  // true zielt nach oben, false nach unten
this.dirY             = new Boolean(true);
this.interpol         = 0;
this.interpArray      = new Array();   // hier werden die Differenzen notiert
this.interX           = new Array();
this.interY           = new Array();
this.proporz          = 1;                // InterpolaltionsSchritte

this.mouseXArray        = new Array();    // komplettes interpoliertes Array
this.mouseYArray        = new Array();

this.mouseMover         = mouseMover;     // damit können Fahrten gemacht werden
this.moveInd            = 0;              // Index

/************ Filteroperationen ******************/

this.surfer              = surfer;   // verändert die Wellenbewegung eines Wave-Filters
this.surferInit          = new Boolean(false);

}

////////////////////////////

function surfer(typus, par1, par2, par3, par4)
{

if (typus == 0)
   {
   window.status = "Das ist AlphaFilter";
      if (this.surferInit == false)
         {
          if (par1 == 1)
             {
             this.layer.FilterParameter1 = "this.layer.filters.Alpha.opacity = tempoAbs/3;";
             }
          if (par2 == 1)
             {
             this.layer.FilterParameter2 = "this.layer.filters.Alpha.finishOpacity = tempoAbs/2;";
             }


         this.surferInit = true;
         }

   if (par1 == 1)
      {
      eval(this.layer.FilterParameter1);
      }

   if (par2 == 1)
      {
      eval(this.layer.FilterParameter2);
      }

   }


if (typus == 1)
   {

   if (this.surferInit == false)
   {

   if (par1 == 1)
      {
      this.layer.FilterParameter1 = "this.layer.filters.Wave.phase = tempoAbs;";
      window.status = this.layer.filters.Wave.freq = 2;
      }

   if (par2 == 1)
      {
      this.layer.FilterParameter2 = "this.layer.filters.Wave.freq = Math.floor(tempoAbs/4);";
      }

   if (par3 == 1)
      {
      this.layer.FilterParameter3 = "this.layer.filters.Wave.strength = tempoAbs;";
      }


   this.surferInit = true;
   }

   if (par1 == 1)
   {
   eval(this.layer.FilterParameter1);
   }




   // window.status = Wave.filters.Wave.freq = 0;

   if (par1 == 1)
      {
      eval(this.layer.FilterParameter1);
      }

   if (par2 == 1)
      {
      eval(this.layer.FilterParameter2);
      }

   if (par3 == 1)
      {
      eval(this.layer.FilterParameter3);
      }

   }

}



///////////
function mouseMover(buffer, tempo, loop)
{
if (this.moveInd < this.mouseXArray.length-1)
   {
   this.style.left = this.mouseXArray[this.moveInd];
   this.style.top =  this.mouseYArray[this.moveInd];
   this.moveInd  = this.moveInd + tempo;
   window.status = "Jetzt läuft der Mover. Index ist  " + this.moveInd;
   }
else {
     window.status = "Mover zuende";
     if (loop == 0)
        {
        this.moveInd = 0;
        }
     }
}


function mouseSynthesize(buffer)
{
while (this.smInd <mtr[buffer].length-2)
    {
    this.mouse_smooth(buffer, this.smInd);
    this.smInd = this.smInd+2;
    }
}


//////// das funktioniert nicht richtig


function mouseSynthC(buffer)
{
}





function mouseSynth(buffer)                 // wenn rechnung 0, wird es nicht performt
{
if (this.smInd < mtr[buffer].length-1)
   {

if (this.smInit == 0)
   {
   this.style.left = mtr[buffer][this.smInd];
   this.style.top = mtr[buffer][this.smInd + 1];
   this.mSmooth(buffer);
   this.smInit = 1;
   }

if (this.xInd < this.interX.length)
   {
   this.style.left = this.interX[this.xInd];
   this.style.top =  this.interY[this.yInd];
   this.xInd++;
   this.yInd++;
   }
else {
     this.xInd = 0;
     this.yInd = 0;
     this.style.left = mtr[buffer][this.smInd];
     this.style.top = mtr[buffer][this.smInd +1];
     if (this.smInd == mtr[buffer].length-2)    // wenn en Flag hinzufügen
        {
        this.smInd = mtr[buffer].length;
        }
     else {
          this.mSmooth(buffer);
          }
     }
   }
this.mouseXArray.length;
}



function mSmooth(buffer)
{
if (this.smInd <mtr[buffer].length-2)
    {
    this.mouse_smooth(buffer, this.smInd);
    this.smInd = this.smInd+2;
    }
}



function mouse_smooth(buffer, eingabe)
{

if ((eingabe) + 1 > mtr[buffer].length)
   {
   alert ("Gibts nicht mehr");
   }
else
    {

    if (this.interX.length>0)
       {
       this.interX.old = this.interX.length;
       }

    diffX = mtr[buffer][eingabe]-mtr[buffer][eingabe+2];
    diffY = mtr[buffer][eingabe+1]-mtr[buffer][eingabe+3];
    bigger = Math.max(Math.abs(diffX), Math.abs(diffY));

    if (diffX < 0)
          {
          this.dirX = true;
          }
      else {
           this.dirX = false;
           }

    if (diffY < 0)
        {

        this.dirY = true;
        }
      else {
           this.dirY = false;
           }

    if ( (Math.abs(diffX)) > (Math.abs(diffY))  )
       {
       this.bigXY = true;
       this.interpol = Math.abs(diffX);
       this.proporz = Math.abs(diffY) / Math.abs(diffX);

       }
    else
        {
        this.bigXY = false;
        this.interpol = Math.abs(diffY);
        this.proporz = Math.abs(diffX) / Math.abs(diffY);
        }

    for (i=0; i<this.interpol-1; i++ )
             {
             this.interpArray[i] = Math.ceil(i*(this.proporz));
             }

    if (this.bigXY == true)
       {
       k = 0;

       for (j=0; j<(this.interpol-1); j++)
           {
           if (this.dirX == true)
              {
              this.interX[j] = j + 1 + mtr[buffer][eingabe];
              }
           if (this.dirX == false)
              {
              this.interX[j] = mtr[buffer][eingabe]- (j+1);
              }
          if (this.dirY == true)
              {
              this.interY[j] = mtr[buffer][eingabe+1] + this.interpArray[j];
              }
           if (this.dirY == false)
              {
              this.interY[j] = mtr[buffer][eingabe+1]- this.interpArray[j];
              }
           }
       }

    if (this.bigXY == false)
       {
       k = 0;

       for (j=0; j<(this.interpol-1); j++)
           {
           if (this.dirY == true)
              {
              this.interY[j] = j + 1 + mtr[buffer][eingabe+1];
              }
           if (this.dirY == false)
              {
              this.interY[j] = mtr[buffer][eingabe+1]- (j+1);
              }
           if (this.dirX == true)
              {
              this.interX[j] = mtr[buffer][eingabe] + this.interpArray[j];
              }
           if (this.dirX == false)
              {
              this.interX[j] = mtr[buffer][eingabe]- this.interpArray[j];
              }

           }
        }

    if (this.interX.length > this.interpol-1)
       {
       this.interX = this.interX.slice(0, this.interpol-1);
       this.interY = this.interY.slice(0, this.interpol-1);
       }

    this.mouseXArray = this.mouseXArray.concat(this.interX);
    this.mouseYArray = this.mouseYArray.concat(this.interY);
    }

}



function mausverfolger(buffer, loop, smooth)
{
if (mtr[this.bfInd].status == true)
   {
   window.status = "JA BUFFER FREI";
   if (this.msInd > mtr[this.bfInd].length-2)
      {
      window.status = "Buffer durchlaufen";
      this.msInd = 2;
      }

   //n wen Smooth eingeführt wird, ist dieser der ELSE-Teil

   this.style.left = mtr[this.bfInd][this.msInd];
   this.msInd++;
   this.style.top = mtr[this.bfInd][this.msInd];
   this.msInd++;

   ///
   }
   else
       {
       if (mtr.length > this.bfInd+1)
          {
          this.bfInd++;

          if (this.bfInd > buffer)
             {
             this.bfInd = 0;
             }
          }
       window.status = "Jetzt else. Es gibt Buffer  " + mtr.length;
       }
}








function colormix (r, g, b)
{
this.rot = this.hexa(r);
this.gruen = this.hexa(g);
this.blau  = this.hexa(b);

Leerstelle = "#";
Leerstelle2 ="";
this.color = Leerstelle.concat(this.rot, this.gruen, this.blau);
// window.status = this.rot;
}


////


function hexa(eingabe)

{
  this.color_abs = eingabe;
  this.color_hex=0;
  var X = new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");
  var x1 = 0, x2 = 0;
  for(i = 0; i < this.color_abs; ++i)
  {

         this.color_hex =  X[x1]+X[x2];
         x2=x2+1;
         if(x2 % 16==0)

               {
               x2=0;
               x1=x1+1;
               }

        }

                if (this.color_abs=i)
        {return this.color_hex;}
}



function farbzuweisung(option)
{

switch(option)
       {
       case 0:
       this.style.backgroundColor = this.color;
       break;

       case 1:
       this.style.color = this.color;
       break;

       case 2:
       window.document.bgColor = this.color;
       break;

       case 3:
       window.document.fgColor = this.color;
       break;

       case 4:
       window.document.linkColor = this.color;
       break;
   }
}

laufrichtungszuweisung = new Boolean(false);


function farbverlauf(typ, element, rCenter, rAusschlag, gCenter, gAusschlag, bCenter, bAusschlag, geschwind, rRichtung, gRichtung, bRichtung)
{

if (laufrichtungszuweisung == false)
   {
   this.formula.laufrichtung[0] = rRichtung;
   this.formula.laufrichtung[1] = gRichtung;
   this.formula.laufrichtung[2] = bRichtung;
   laufrichtungszuweisung = true;
   }

if (typ == 0)
   {
   this.formula.ellipse(rCenter, gCenter, rAusschlag/3, gAusschlag/3, geschwind, bCenter, bAusschlag);
   this.formula.xNew = Math.floor(this.formula.xNew);
   this.formula.yNew = Math.floor(this.formula.yNew);
   this.formula.zNew = Math.floor(this.formula.zNew);

   this.colormix (this.formula.xNew, this.formula.yNew, this.formula.zNew);
   // window.status =    this.color;
   // this.style.backgroundColor = this.color;
   this.farbzuweisung(element);
   }


if (typ == 1)
   {
   this.formula.floral(rCenter, gCenter, rAusschlag/3, gAusschlag/3, geschwind, bCenter, bAusschlag);
   this.formula.xNew = Math.floor(this.formula.xNew);
   this.formula.yNew = Math.floor(this.formula.yNew);
   this.formula.zNew = Math.floor(this.formula.zNew);

   this.colormix (this.formula.xNew, this.formula.yNew, this.formula.zNew);
   // window.status =   "Hallo Floral";
   this.farbzuweisung(element);
   }


if (typ == 2)
   {
   this.formula.lissajou(rCenter, gCenter, rAusschlag, gAusschlag, geschwind*3, bCenter, bAusschlag);

   this.formula.xNew = Math.floor(this.formula.xNew);
   this.formula.yNew = Math.floor(this.formula.yNew);
   this.formula.zNew = Math.floor(this.formula.zNew);

   this.colormix (this.formula.xNew, this.formula.yNew, this.formula.zNew);
   window.status =    this.color;
   this.farbzuweisung(element);

   }

}







///////////////////////////

function randomize(eingabe)
{
}

function backwards()
   {
    if(this.bcount <  0) this.bcount = this.liste.length-1;
    this.aktuell = this.bcount;
    this.bcount = this.bcount - 1;
   }


function forwards()
   {
    if(this.fcount >  this.liste.length-1) this.fcount = 0;
    this.aktuell = this.fcount;
    window.status = this.aktuell;
    this.fcount = this.fcount + 1;
   }


function playlist(startpunkt, endpunkt)
   {
    while (startpunkt > this.liste.length) {startpunkt = startpunkt-this.liste.length+1;}
    this.playliste = this.liste.slice (startpunkt,endpunkt);
    if(this.pcount >  this.playliste.length-1) this.pcount = 0;
    this.aktuell = this.pcount;
    this.pcount = this.pcount + 1;
   }


function playlist_rev (startpunkt, endpunkt)
   {
    while (startpunkt > this.liste.length) {startpunkt = startpunkt-this.liste.length+1;}
    this.playliste = this.liste.slice (startpunkt,endpunkt);
    if(this.prcount < 0) this.prcount = this.playliste.length-1;
    this.aktuell =  this.playliste[this.prcount];
    alert (this.aktuell);
    this.prcount = this.prcount - 1;
   }


function to_and_fro()
   {

   if (this.upcount > -1 && this.upcount < this.liste.length -1 )
        {
        this.aktuell = this.liste[this.upcount];
        window.status = this.liste[this.upcount];
        this.upcount = this.upcount + 1;
        this.downcount = this.upcount;
      }
        else{
                if (this.downcount > 0)

                        {
                        aktuell = this.liste[this.downcount];
                        window.status = this.liste[this.downcount];

                        this.downcount = this.downcount - 1;
                        }
                        else {this.upcount = this.downcount;}
           }
      }


function random()
   {
   var zufallszahl = Math.random();
   index = Math.floor(this.liste.length*zufallszahl);
   this.aktuell = index;
   }


/////////////

function textobjekt (typ, startbedingung, lifetime, looptyp, absorber, absorber_typ, absorber_takt,event_typ, event_takt, modulator_typ, modulator_lifetime, schwankungsfaktor, aktion)
{
this.typ                      = typ;
this.startbedingung           = startbedingung;
this.lifetime                 = lifetime;
this.looptyp                  = looptyp;
this.absorber                 = absorber;
this.absorber_typ             = absorber_typ;
this.absorber_takt            = absorber_takt;
this.event_typ                = event_typ;
this.event_takt               = event_takt;
this.modulator_typ            = modulator_typ;
this.modulator_lifetime       = modulator_lifetime;
this.schwankungsfaktor        = schwankungsfaktor;
this.aktion                   = aktion;
this.showme                   = showme;
this.layer           = "";
this.testfeld                = testfeld;
this.zeitansage              = zeitansage;
this.geschwind               = geschwind;
this.flughafen               = flughafen;
this.flugcount               = 0;
this.flugzeit                = 0;

this.tippex                  = tippex;
this.cursorP                 = 0;         // das ist der Cursor, wo bin ich im Text

////////////////////////////////
this.pump_groesse             = pump_groesse;
this.merkmalschange           = merkmalschange;
this.fontdistanz              = fontdistanz;
}



function distanz_movement (offset, range, min, max, positivnegativ, merkmal)
{
this.screendistance();

if (merkmal <10)
   {
   if (this.abstand > offset && this.abstand < offset + range)
      {
      if (positivnegativ == 0)
         {
         // this.formula.xNew = (max-min)/(this.abstand-offset)* max;
         this.formula.ellipse(100, 100, range, range, 20);
         }

     if (positivnegativ == 1)
        {
        // this.formula.xNew = (this.abstand-offset)* max/(max-min);

        this.formula.floral(geschwindigkeit, 300, 500, 0, 200);
        }
     // this.style.left = this.formula.xNew;
     this.style.width = geschwindigkeit*2;
     // this.style.top = this.formula.yNew;
     // this.merkmalschange(merkmal);
     }

   }

}



function fontdistanz(offset, range, min, max, positivnegativ, merkmal)
{
this.screendistance();

if (merkmal <10)
   {
   if (this.abstand > offset && this.abstand < offset + range)
   {
   if (positivnegativ == 0)
      {
      this.formula.xNew = (max-min)/(this.abstand-offset)* max;
      }

   if (positivnegativ == 1)
      {
      this.formula.xNew = (this.abstand-offset)* max/(max-min);
      }
   this.merkmalschange(merkmal);
     }

   }

if (merkmal == 11)
   {
   this.center_movement(2, this.abstand, this.formula.xNew, this.abstand/10)
   this.merkmalschange(0);
   this.merkmalschange(2);
   // this.style.fontSize = 2000/(this.abstand/5);
   }

}


function pump_groesse(typ, mitte, ausschlag, veloc, merkmal)
{
window.status = mitte;
if (typ == 0)
   {
   this.formula.ellipse(mitte, 0, ausschlag/3, 10, veloc);
   // this.style.fontSize = this.formula.xNew;
   this.merkmalschange(merkmal);
   }


if (typ == 1)
   {
   this.formula.floral(mitte, 0, ausschlag/3, 10, 22);
   this.style.fontSize = this.formula.xNew;
   }


if (typ == 2)
   {
   this.formula.lissajou(mitte, 0, ausschlag, 10, 22);
   this.style.fontSize = this.formula.xNew;
   }

}



function merkmalschange(eingabe)
{

switch(eingabe)
       {
       case 0:
       this.style.fontSize = this.formula.xNew;
       break;

       case 1:
       this.style.letterSpacing = this.formula.xNew;
       break;

       case 2:
       this.style.marginLeft = this.formula.xNew;
       break;

       case 3:
       this.style.marginTop = this.formula.xNew;
       break;

       case 4:
       this.style.padding = this.formula.xNew;
       break;

       case 5:
       this.style.paddingLeft = this.formula.xNew;
       break;

       case 6:
       this.style.paddingTop = this.formula.xNew;
       break;

       case 7:
       this.style.lineHeight = this.formula.xNew;
       break;


       }

}





function flughafen(pause)
{
if (this.dauer>pause + this.flugzeit)
   {
   this.liste[this.flugcount].merge(this.liste[this.flugcount+1]);
   this.layer.innerHTML = this.liste[0].rekomb_array.converter;
   if (this.liste[0].litteraC.wahrheit == true && this.flugcount < this.liste.length-2)
      {
      this.flugcount++;
      this.flugzeit = this.dauer;
      this.liste[0].litteraC.wahrheit = false;
      }
   if (this.liste[0].litteraC.wahrheit == false && this.flugcount == this.liste.length-2)
      {
      this.flugcount = 0;
      this.flugzeit = 0;
      this.liste[0].litteraC.wahrheit = false
      }
   }
}


function showme(eingabe, start, end)
{

if (eingabe == 0)
   {
   this.forwards();
   }

if (eingabe == 1)
   {
   this.backwards();
   }

if (eingabe == 2)
   {
   this.random();
   }

if (eingabe == 3)
   {
   this.playlist(start, end);
   }

this.layer.innerHTML = this.liste[this.aktuell];
this.style.fontSize = 10 + this.aktuell;
}


function testfeld ()
{
this.layer.innerHTML = "Zeit " + this.dauer + "  Raum  " + this.langstrecke + "  Takt  " + this.event_takt + " Lifetime " + this.lifetime + "  ModLife " + this.modulator_lifetime + "  Humanize " + this.schwankungsfaktor;
}

function geschwind ()
{
this.layer.innerHTML = tempoAbs;
}

function zeitansage()
{
this.layer.innerHTML = this.dauer;
}


function tippex(pause)
{
this.double                   =  this.liste[this.aktuell];         // habe ich für Tippex gedacht
this.terminator               = false;

if (this.dauer>pause + this.flugzeit)
   {
   this.cursorP ++;
   this.layer.innerHTML = this.double.slice(0, this.cursorP);

   if (this.cursorP == this.double.length)
      {
      this.cursorP = 0;
      this.aktuell ++;

      this.flugzeit = this.dauer;

      if (this.aktuell == this.liste.length)
            {
            this.aktuell = 0;
            }
      }
   }


// window.status = "tippex  " + this.aktuell + this.double + this.cursorP + "  " + this.flugzeit;

}






/////////////

function bildobjekt (typ, startbedingung, lifetime, looptyp, absorber, absorber_typ, absorber_takt,event_typ, event_takt, modulator_typ, modulator_lifetime, schwankungsfaktor, aktion)
{
this.typ                      = typ;
this.startbedingung           = startbedingung;
this.lifetime                 = lifetime;
this.looptyp                  = looptyp;
this.absorber                 = absorber;
this.absorber_typ             = absorber_typ;
this.absorber_takt            = absorber_takt;
this.event_typ                = event_typ;
this.event_takt               = event_takt;
this.modulator_typ            = modulator_typ;
this.modulator_lifetime       = modulator_lifetime;
this.schwankungsfaktor        = schwankungsfaktor;
this.aktion                   = aktion;

this.layer           = "";

this.diashow                  = diashow;
}


////////////////////

function diashow(eingabe)
{
}






/********/

gruppenobjekt.prototype = new Erscheinung


function gruppenobjekt()
{
this.XLayers            = XLayers;
this.gruppenliste       = new Array();  // hier wird aus den DIVs eine Liste konstruiert, plus Vererbuing
this.differenz           = differenz;
this.entfernung          = entfernung;
this.merkmalsdifferenz  = merkmalsdifferenz;
this.cleanpx            = cleanpx;
}


function XLayers(eingabe)
{
j = 0;

if (eingabe != 1)
   {

   for (i=0; i<document.all.length; i++ )
    {
    if (document.all[i].tagName == "DIV")
       {

       this.gruppenliste[j] = document.all[i];
       j++;
       }
    }

    this.differenz();
   }

if (eingabe == 1)
   {
   alert ("Das ist jetzt für den Editor wichtig");

   for (i=1; i< myEdit.length; i++ )
    {
    alert ("Es gibt die Objekte " + myEdit[i]);

       for (k=0; k<document.all.length; k++ )
         {
         if (document.all[k].tagName == "DIV" && document.all[k].id == myEdit[i])
            {
            // alert ("bin ein Layer names " + document.all[k].id);
            this.gruppenliste[j] = document.all[k];
            j++;
            }
         }

    this.differenz();

    }

   }

}


function differenz()
{
for (i=0; i<this.gruppenliste.length; i++ )
    {
    this.gruppenliste[i].offset1 = this.cleanpx(this.gruppenliste[i].style.width, 1);
    this.gruppenliste[i].offset2 = this.cleanpx(this.gruppenliste[i].style.height,1);

    links   = this.cleanpx(this.gruppenliste[i].style.left, 2);
    oben   = this.cleanpx(this.gruppenliste[i].style.top, 2);

    links = parseInt(links);
    oben = parseInt(oben);
    this.gruppenliste[i].offset1 = parseInt(this.gruppenliste[i].offset1);
    this.gruppenliste[i].offset2 = parseInt(this.gruppenliste[i].offset2);

    this.gruppenliste[i].mittelpunktX = links + this.gruppenliste[i].offset1;
    this.gruppenliste[i].mittelpunktY = oben +     this.gruppenliste[i].offset2;

    }


}

function entfernung ()
{
for (i=0; i<this.gruppenliste.length; i++ )
    {
    this.gruppenliste[i].entfernungX = Math.abs(xMaus - this.gruppenliste[i].mittelpunktX);
    this.gruppenliste[i].entfernungY = Math.abs(yMaus - this.gruppenliste[i].mittelpunktY);

    this.gruppenliste[i].distX = xMaus - this.gruppenliste[i].mittelpunktX;
    this.gruppenliste[i].distY = yMaus - this.gruppenliste[i].mittelpunktY;

    this.gruppenliste[i].entfernung = (this.gruppenliste[i].entfernungX + this.gruppenliste[i].entfernungY)/2;

    }
}






function merkmalsdifferenz()
{
}




/*************/


function gruppencheck(eingabe)
{
for (i=0; i<gruppe.gruppenliste.length; i++ )
    {
    if (gruppe.gruppenliste[i] == eingabe)
       {
       return gruppe.gruppenliste[i];
       }
    }
}



/*****  Funtionen gehen nur, wenn Umwelt getriggert ist*******************/

function magnetism()
{
window.status = this.umwelt.entfernung;
this.style.left = xMaus - this.umwelt.offset1;
this.style.top = yMaus - this.umwelt.offset2;
}



function distancia()
{
this.xpos = cleanpx(this.style.left, 2);
this.xpos = parseInt(this.xpos);

this.ypos = cleanpx(this.style.top, 2);
this.ypos = parseInt(this.ypos);

this.distX = xMaus - this.xpos - this.umwelt.offset1;  // werden Negativ berücksichtigt
this.distY = yMaus - this.ypos - this.umwelt.offset2;

this.distance = ( Math.abs(this.xpos) +  Math.abs(this.ypos))/2;
}




function follower (geschwindigkeit)
{
this.distancia();

this.trajektX = (this.distX /  this.distance) *geschwindigkeit;
this.trajektY = (this.distY /  this.distance) *geschwindigkeit;

if (this.distance>50)
        {
        this.style.left = this.xpos + this.trajektX;
        this.style.top = this.ypos + this.trajektY;
        }
}



function transparenz()
{
this.distancia();
}







var ego_masse = 200;
var gravitationskonstante = 5;



pi = Math.PI;


function circles (radiusX, radiusY, kruemmer)
{
        this.r= radiusX;
        this.s=radiusY;
        this.k=kruemmer;

        this.offsetter++;

        this.xPos =(this.r * Math.cos((this.offsetter+180)*(pi/180*this.k)))+ xMaus;
        this.yPos =(this.s * Math.sin((this.offsetter+180)*(pi/180*this.k))) + yMaus;

        this.style.left = this.xPos;
        this.style.top = this.yPos;
}



function satellite (sonne, radiusX, radiusY, kruemmer)
{
        gruppe.XLayers();
        // window.status = gruppe.gruppenliste[0].mittelpunktX;
        this.centerX = gruppe.gruppenliste[sonne].mittelpunktX;
        this.centerY = gruppe.gruppenliste[sonne].mittelpunktY;

        this.r= radiusX;
        this.s=radiusY;
        this.k=kruemmer;

        this.offsetter++;

        this.xPos =(this.r * Math.cos((this.offsetter+180)*(pi/180*this.k)))+ this.centerX;
        this.yPos =(this.s * Math.sin((this.offsetter+180)*(pi/180*this.k))) + this.centerY;

        this.style.left = this.xPos;
        this.style.top = this.yPos;
}



function movement(typ, sonne, radiusX, radiusY, tempo)
{
gruppe.XLayers();
window.status = gruppe.gruppenliste[0].mittelpunktX;
this.centerX = gruppe.gruppenliste[sonne].mittelpunktX;
this.centerY = gruppe.gruppenliste[sonne].mittelpunktY;
if (typ == 0)
   {
   this.formula.floral(this.centerX, this.centerY, radiusX, radiusY, tempo);
   }

if (typ == 1)
   {
   this.formula.ellipse(xMaus, yMaus, radiusX, radiusY, tempo);
   }

if (typ == 2)
   {
   this.formula.lissajou(xMaus, yMaus, radiusX, radiusY, tempo);
   }

this.style.left = this.formula.xNew;
this.style.top  = this.formula.yNew;

}

function center_movement(typ, radiusX, radiusY, tempo)
{
if (typ == 0)
   {
   this.formula.floral(xMaus, yMaus, radiusX, radiusY, tempo);
   }

if (typ == 1)
   {
   this.formula.ellipse(xMaus, yMaus, radiusX, radiusY, tempo);
   }

if (typ == 2)
   {
   this.formula.lissajou(xMaus, yMaus, radiusX, radiusY, tempo);
   }

this.style.left = this.formula.xNew;
this.style.top  = this.formula.yNew;
}


/////////////////////////// Formel - Objekt ///////////////////////////////////////////

function formel ()
{

this.k        = 0;       // das ist der Counter;
this.k2       = 0;       // 2. Counter
this.l        = 0;       // das ist der Counter für die Gegenichtung
this.l2       = 0;

this.xOld     = 0;
this.yOld     = 0;
this.zOld     = 0;

this.xNew     = 0;
this.yNew     = 0;
this.zNew     = 0;

this.laufrichtung = new Array(0,0,0);     // damit wird die Laufrichtung für xzy bestimmt

this.lissajou   = lissajou;
this.ellipse    = ellipse;
this.floral     = floral;
}



//////////////////////////////////////////////////////////////////////

function lissajou (zentrumX, zentrumY, radiusX, radiusY, tempo, zentrumZ, radiusZ)
{
this.xOld = this.xNew;
this.yOld = this.yNew;

if (this.laufrichtung[0] == 0)
   {
   this.xNew = (Math.sin(2*this.k/tempo));
   this.xNew = (this.xNew* radiusX)+ zentrumX;
   }

if (this.laufrichtung[0] == 1)
   {
   this.xNew = (Math.sin(2*this.l/tempo));
   this.xNew = (this.xNew* radiusX)+ zentrumX;
   }

if (this.laufrichtung[1] == 0)
   {
   this.yNew = (Math.cos(3*this.k/tempo));
   this.yNew = (this.yNew* radiusY)+ zentrumY;
   }
if (this.laufrichtung[1] == 1)
   {
   this.yNew = (Math.cos(3*this.l/tempo));
   this.yNew = (this.yNew* radiusY)+ zentrumY;
   }


if (zentrumZ != -1)
   {
   if (this.laufrichtung[2] == 0)
      {
      this.zNew = (Math.cos(3*this.k/tempo));
      this.zNew = (this.zNew* radiusZ)+ zentrumZ;
      }

   if (this.laufrichtung[2] == 1)
      {
      this.zNew = (Math.cos(3*this.l/tempo));
      this.zNew = (this.zNew* radiusZ)+ zentrumZ;
      // window.status = "ZLaufrichtung links";
      }
   }



this.k++;
this.l--;
}

/************************************************************************/

function ellipse (zentrumX, zentrumY, radiusX, radiusY, tempo, zentrumZ, radiusZ)
{
this.xOld =  this.xNew;
this.yOld =  this.yNew;

this.k2   = Math.PI/6;
this.l2   = (Math.PI/6)*(-1);

if (zentrumZ != -1)
   {
   this.zOld  = this.zNew;
   if (this.laufrichtung[2] == 0)
      {
      this.zNew = 2*(Math.sin(this.k  /  tempo));
      this.zNew = ((this.zNew * radiusZ)/2) + zentrumZ ;
      }
  if (this.laufrichtung[2] == 1)
      {
      this.zNew = 2*(Math.sin(this.l  /  tempo));
      this.zNew = ((this.zNew * radiusZ)/2) + zentrumZ ;
      }

   }

if (this.laufrichtung[0] == 0)
   {
   window.status = "die xKoordinate läuft nach rechts";
   this.xNew = (3*(Math.cos((-this.k   +  this.k2)/ tempo)));
   this.xNew = (this.xNew * radiusX) + zentrumX;
   }

if (this.laufrichtung[0] == 1)
   {
   window.status = "die xKoordinate läuft nach links";
   this.xNew = (3*(Math.cos((-this.l   +  this.l2)/ tempo)));
   this.xNew = (this.xNew * radiusX) + zentrumX;
   }

if (this.laufrichtung[1] == 0)
   {
   this.yNew = 2*(Math.sin(this.k  /  tempo));
   this.yNew = (this.yNew * radiusY) + zentrumY;
   }

if (this.laufrichtung[1] == 1)
   {
   this.yNew = 2*(Math.sin(this.l  /  tempo));
   this.yNew = (this.yNew * radiusY) + zentrumY;
   }

// window.status = "XNew ist   " + this.xNew + "  YNew ist   " + this.yNew;
this.k++;
this.l--;

}


/**************/


function floral (zentrumX, zentrumY, radiusX, radiusY, tempo, zentrumZ, radiusZ)
{
this.xOld =  this.xNew;
this.yOld =  this.yNew;


if (zentrumZ != -1)
   {
   window.status = "FLORAL";
   this.zOld  = this.zNew;

   if (this.laufrichtung[2] == 0)
      {
      this.zNew = (Math.sin(5*  this.k / tempo))-(Math.sin (3* this.k / tempo));
      this.zNew = ((this.zNew * radiusZ)/2)+ zentrumZ;
      }
   if (this.laufrichtung[2] == 1)
      {
      this.zNew = (Math.sin(5*  this.l / tempo))-(Math.sin (3* this.l / tempo));
      this.zNew = ((this.zNew * radiusZ)/2)+ zentrumZ;
      }

   // window.status = this.zNew;
   }


if (this.laufrichtung[0] == 0)
{
window.status = "XLaufrichtung rechts";
this.xNew = (Math.sin(5*  this.k / tempo))-(Math.sin (3* this.k / tempo));
this.xNew = (this.xNew * radiusX)+ zentrumX;
}


if (this.laufrichtung[0] == 1)
{
this.xNew = (Math.sin(5*  this.l / tempo))-(Math.sin (3* this.l / tempo));
this.xNew = (this.xNew * radiusX)+ zentrumX;
}

////

if (this.laufrichtung[1] == 0)
{
this.yNew = (Math.sin(7*  this.k / tempo))+(Math.cos (this.k / tempo));
this.yNew = (this.yNew * radiusY)+ zentrumY;

}
if (this.laufrichtung[1] == 1)
{
this.yNew = (Math.sin(7*  this.l / tempo))+(Math.cos (this.l / tempo));
this.yNew = (this.yNew * radiusY)+ zentrumY;
}



this.k++;
this.l++;
}

/****************/

function screendistance()
{
this.distanciaX = Math.abs(this.umwelt.mittelpunktX - xMaus);
this.distanciaY = Math.abs(this.umwelt.mittelpunktY - yMaus);
this.abstand = (this.distanciaX + this.distanciaY)/2;
}
