/*  Basiert auf dem Code von www.jojoxx.net
 *
 *  The code contained in this  file is copyrighted by www.jojoxx.net
 *  The file may be used for none commercial applications and distributed
 *  as long as these lines remain intact.  The file or part of it may not
 *  be sold  or  included  in any  other commercial  application  without
 *  agreement from the author. If you have questions or comments, contact
 *  the author at http://www.jojoxx.net
 *
 *  © Copyright - www.jojoxx.net - 2004
 */


function fade(m,n,diff,opacity)
{
  divId = divs[m][n];
  //alert("divId is "+divId);
  //alert(document.getElementById(divId).style.MozOpacity);

  opacity = (opacity) ? opacity : (diff < 0) ? 100 : 0; opacity += diff;

  // diese Browserweiche ist problematisch, da Mozilla inzwischen
  // auch klammheimlich das document.all Modell unterstuetzt
  if (document.getElementById && document.all)
  {
    // Internet Explorer
    document.getElementById(divId).style.filter = "alpha(opacity=" + opacity + ")";
  }
  else
  {
    // Mozilla (Gecko)
    if(document.getElementById && !document.all)
    {
      document.getElementById(divId).style.MozOpacity = opacity/100;
    }
  }

  document.getElementById(divId).style.visibility = "visible";

  if(opacity >= 99)
  {
    zindex[m]++;
    document.getElementById(divId).style.zIndex = zindex[m];
    setTimeout("fade("+ m + "," + n + ",-" + diff + "," + opacity + ");",1000);
    nn = (n == divs[m].length-1) ? 0 : n+1;
    setTimeout("fade("+ m + "," + nn + "," + diff + ");",1000);
  }
  else
  {
    if(opacity > 0)
    {
      setTimeout("fade("+ m + "," + n + "," + diff + "," + opacity + ");",30);
    }
  }
}


function init()
{
  // Assoziatives Array fuer die Bilderlisten
  divs   = new Array();
  zindex = new Array();

  // erste ID-Liste der zu fadenden DIVs
  divs[0] = new Array();
  divs[0][0] = "div1-1";
  divs[0][1] = "div1-2";
  divs[0][2] = "div1-3";
  divs[0][3] = "div1-4";
  divs[0][4] = "div1-5";
  divs[0][5] = "div1-6";
    divs[0][6] = "div1-7";
  zindex[0] = 0;

  // zweite ID-Liste der zu fadenden DIVs
  divs[1] = new Array();
  divs[1][0] = "div2-1";
  divs[1][1] = "div2-2";
  divs[1][2] = "div2-3";
  divs[1][3] = "div2-4";
  divs[1][4] = "div2-5";
  divs[1][5] = "div2-6";
    divs[1][6] = "div2-7";
  zindex[1] = 0;

  // ... etc ...


  // das Ueberblenden starten
  fade(0,0,1);
  fade(1,0,1);
}

