// Also wo bin ich?
// Funktion erkennt, ob die angezeigte Seite in einen Frameset geladen wurde
function wo_bin_ich()
{
if (parent.frames.length == 0) //Gibt es ein Frameset?
  {
    Adresse = String(window.location);
    Woerter = Adresse.split("/");
    // bin ich in Frames eingebunden? 0=keine Frames
    // Wenn ich (die Seite) solo bin, rufe den Frameset auf und hänge ? und dein Verzeichnis und deinen
    // Namen an die url (Bsp. index.htm?verzeichnis&dateiname.htm)
     if (Woerter[Woerter.length-5] == "html"){
       window.parent.location.replace("../../../../index.htm"+"?"+Woerter[Woerter.length-4]+"&"+Woerter[Woerter.length-3]+"&"+Woerter[Woerter.length-2]+"&"+Woerter[Woerter.length-1]);
     }else{
       if (Woerter[Woerter.length-4] == "html"){
         window.parent.location.replace("../../../index.htm"+"?"+Woerter[Woerter.length-3]+"&"+Woerter[Woerter.length-2]+"&"+Woerter[Woerter.length-1]);
       }else{
         if (Woerter[Woerter.length-3] == "html"){
           window.parent.location.replace("../../index.htm"+"?"+Woerter[Woerter.length-2]+"&"+Woerter[Woerter.length-1]);
         }else{
           if (Woerter[Woerter.length-2] == "html"){
             window.parent.location.replace("../index.htm"+"?"+Woerter[Woerter.length-1]);
           }else{
             window.parent.location.replace("../../../../../index.htm"+"?"+Woerter[Woerter.length-5]+"&"+Woerter[Woerter.length-4]+"&"+Woerter[Woerter.length-3]+"&"+Woerter[Woerter.length-2]+"&"+Woerter[Woerter.length-1]);
           }
         }
       }
     }
  }
}

function wo_bin_ich_2()
{
if (parent.frames.length == 0) //Gibt es eine Frameset?
  {
    // bin ich in Frames eingebunden? 0=keine Frames
    // Wenn ich (die Seite) solo bin, rufe den Frameset auf.
     window.parent.location.replace("index.htm");
  }
}

function wo_bin_ich_3() //für tbb
{
if (parent.frames.length == 0) //Gibt es ein Frameset?
  {
   window.parent.location.replace("../../index.htm"+"?tbb&"+window.location.search.substring(1));
  }
}

function Frames()
{
  if (window.top.location.search){
    LastSegment = window.top.location.search;
    LastSegment = LastSegment.substring(1);
    Woerter = LastSegment.split("&");
    if (Woerter[0]=="tbb"){
      Verzeichnis="gebabbel";
      LastSegment = "tbb/index.php?" + LastSegment.substring(4);
    }else{
      if (Woerter[0]=="impressum.html"){
        LastSegment= "impressum.html"
        Verzeichnis="";
      }else{
        if (Woerter.length != 2 && Woerter.length != 3 && Woerter.length != 4 && Woerter.length != 5) {LastSegment="aktuell/aktuell.html"; Verzeichnis="aktuell";}
        else{
          if (Woerter[0]=="") {LastSegment="aktuell/aktuell.html"; Verzeichnis="aktuell";}
          else{
            if (Woerter[1]=="") {LastSegment="aktuell/aktuell.html"; Verzeichnis="aktuell";}
            else{
              if (Woerter.length == 2) {
                LastSegment = Woerter[0] + "/" + Woerter[1];
                Verzeichnis = Woerter[0]
              }else{
                if (Woerter.length == 3) {
                  LastSegment = Woerter[0] + "/" + Woerter[1] + "/" + Woerter[2];
                  Verzeichnis = Woerter[0]
                }else{
                  if (Woerter.length == 4) {
                    LastSegment = Woerter[0] + "/" + Woerter[1] + "/" + Woerter[2] + "/" + Woerter[3];
                    Verzeichnis = Woerter[0]
                  }else{
                    LastSegment = Woerter[0] + "/" + Woerter[1] + "/" + Woerter[2] + "/" + Woerter[3] + "/" + Woerter[4];
                    Verzeichnis = Woerter[0]
                  }
                }
              }
            }
          }
        }
      }
    }
  }else{
    LastSegment="aktuell/aktuell.html";
    Verzeichnis="aktuell";
  }

  this.document.write("  <frameset rows=\"*\" cols=\"205,*\" frameborder=\"NO\" border=\"0\"");
  this.document.write("framespacing=\"0\">");
  this.document.write("  <frame name=\"leftFrame\" scrolling=\"AUTO\" noresize src=");
  this.document.write("  \"leftfr.htm?" + Verzeichnis + "\" marginwidth=\"0\">");
  this.document.write("  <frameset rows=\"80,*\" frameborder=\"NO\" border=\"0\" framespacing=");
  this.document.write("  \"0\">");
  this.document.write("    <frame name=\"topFrame\" noresize scrolling=\"AUTO\" src=");
  this.document.write("    \"topfr.htm\">");
  this.document.write("    <frame name=\"mainFrame\" src=\"html/" + LastSegment + "\">");
  this.document.write("  </frameset>");
  this.document.write("</frameset>");
}

  //Configure below to change URL path to the snow image
  var snowsrc="/dot.gif"
  var wappen="/wappen.gif"
  // Configure below to change number of snow to render
  var no = 1;
  var ns4up;
  var ie4up;
  var ns6up;

  var dx, xp, yp;    // coordinate and position variables
  var am, stx, sty;  // amplitude and step variables
  var doc_width = 1000, doc_height = 800;

  function snowNS() {  // Netscape main animation function
    for (i = 0; i < no; ++ i) {  // iterate for every dot
      yp[i] += sty[i];
      if (yp[i] > doc_height-50) {
        xp[i] = Math.random()*(doc_width-am[i]-30);
        yp[i] = 0;
        stx[i] = 0.02 + Math.random()/10;
        sty[i] = 0.7 + Math.random();
        doc_width = self.innerWidth;
        doc_height = self.innerHeight;
      }
      dx[i] += stx[i];
      document.layers["dot"+i].top = yp[i];
      document.layers["dot"+i].left = xp[i] + am[i]*Math.sin(dx[i]);
    }
    setTimeout("snowNS()", 30);
  }

  function snowIE_NS6() {  // IE and NS6 main animation function
    for (i = 0; i < no; ++ i) {  // iterate for every dot
      yp[i] += sty[i];
      if (yp[i] > doc_height-50) {
        xp[i] = Math.random()*(doc_width-am[i]-30);
        yp[i] = 0;
        stx[i] = 0.02 + Math.random()/10;
        sty[i] = 0.7 + Math.random();
        doc_width = ns6up?window.innerWidth : document.body.clientWidth;
        doc_height = ns6up?window.innerHeight : document.body.clientHeight;
      }
      dx[i] += stx[i];
      if (ie4up){
      document.all["dot"+i].style.pixelTop = yp[i];
      document.all["dot"+i].style.pixelLeft = xp[i] + am[i]*Math.sin(dx[i]);
      }
      else if (ns6up){
      document.getElementById("dot"+i).style.top=yp[i];
      document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i]);
      }
    }
    setTimeout("snowIE_NS6()", 30);
  }

function snow() {

  return; //XXX Das hier dann raus zum Aktivieren
  
  ns4up = (document.layers) ? 1 : 0;  // browser sniffer
  ie4up = (document.all) ? 1 : 0;
  ns6up = (document.getElementById&&!document.all) ? 1 : 0;

  if (ns4up||ns6up) {
    doc_width = self.innerWidth;
    doc_height = self.innerHeight;
  } else if (ie4up) {
    doc_width = document.body.clientWidth;
    doc_height = document.body.clientHeight;
  }

  dx = new Array();
  xp = new Array();
  yp = new Array();
  am = new Array();
  stx = new Array();
  sty = new Array();

  for (i = 0; i < no; ++ i) {
    dx[i] = 0;                        // set coordinate variables
    xp[i] = Math.random()*(doc_width-50);  // set position variables
    yp[i] = Math.random()*doc_height;
    am[i] = Math.random()*20;         // set amplitude variables
    stx[i] = 0.02 + Math.random()/10; // set step variables
    sty[i] = 0.7 + Math.random();     // set step variables

    if (ns4up) {// set layers
        if (i==0) {
            document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><font size=\"6\"><b style=\"font-size:18\">20.10.: Oktoberfest</b></font></a></layer>");
        } else {
            document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><font size=\"6\"><b style=\"font-size:18\">20.10.: Oktoberfest</b></font></a></layer>");
        }
    } else if (ie4up||ns6up) {
        if (i==0) {
            document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><font size=\"6\"><b style=\"font-size:18\">20.10.: Oktoberfest</b></font></a></div>");
        } else {
            document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><font size=\"6\"><b style=\"font-size:18\">20.10.: Oktoberfest</b></font></a></div>");
        }
    }
  }
//    if (ns4up) {// set layers
//        if (i==0) {
//            document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src='"+wappen+"' border=\"0\"></layer>");
//        } else {
//            document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src='"+snowsrc+"' border=\"0\"></layer>");
//        }
//    } else if (ie4up||ns6up) {
//        if (i==0) {
//            document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+wappen+"' border=\"0\"></div>");
//        } else {
//            document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"></div>");
//        }
//    }
//  }

  if (ns4up) {
    snowNS();
  } else if (ie4up||ns6up) {
    snowIE_NS6();
  }
}
