onerror = FremdURL; Fehler = false;

function FremdURL()
{
  if (Fehler) {
    alert ("Sie werden weitergeleitet zur Startseite des TD Rot-Weiss Duesseldorf");
    top.location.href = "http://td-duesseldorf-rot-weiss.de/";
  }
  return true;
}

function TDframe(Pfad)
{
  if (Pfad.indexOf("file://") != 0)
  {
    if (parent.frames.length == 0)
    {
      var Datei = Pfad.slice(Pfad.lastIndexOf("/") + 1);
      if (Datei == "index.html") top.location.href="index0.html";
      else
      {
        if (navigator.appName == "Microsoft Internet Explorer")
        {
          top.location.replace("index0.html?" + Datei);
        }
        else
        {
          document.close();
          with (document)
          {
            open();
            writeln("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Frameset//EN\">");
            writeln("<html><head><title>TD Tanzsportclub D&uuml;sseldorf Rot-Weiss e.V.</title></head>");
            writeln("<frameset border=0 framespacing=0 frameborder=0 rows=79,*>");
            writeln("<frame name=\"TDlinkzeile\" SRC=\"../index_kopf.html\" scrolling=no marginwidth=0 marginheight=1 noresize>");
            writeln("<frame name=\"Hauptteil\" SRC=\""+Datei+"\" scrolling=auto marginwidth=0 marginheight=0>");
            writeln("</frameset><body></body></html>");
            close();
          }
          return false;
        }
      }
    }
    else {
      Fehler = true;
      if (top.frames[0].name != "TDlinkzeile") FremdURL();
      Fehler = false;
    }
  }
  noSpam()
}

function LadeFrame()
{
  if(self.location.search.length > 0)
    self.Hauptteil.location.replace(self.location.search.substring(1,self.location.search.length));
}

function Info(show)
{
  if (document.getElementById)
  {
    if (show) document.getElementById('info').style.visibility='visible';
    else window.setTimeout("document.getElementById('info').style.visibility='hidden'",2000);
  }
}

getElementsByClassName = function (c) {
  var ret = new Array(); var j = 0;
  var objs = document.all ? document.all : document.getElementsByTagName("*");
  for(i = 0;i<objs.length;i++) {
    if(objs[i].className == c) {
      ret[j] = objs[i]; j++;
    }
  }
  return ret;
}

function noSpam() {
  var at = "@", d = "td-duesseldorf-rot-weiss.de", i = 0;
  var x = getElementsByClassName("eMail"); e = x.length;
  if(e) {
    for(i=0; i<=e; i++) {
      if(x[i] != undefined) {
        var h = x[i].href;
        if(h.slice(0,7) != "mailto:") {
          var q = h.indexOf("?"); var p = h.indexOf("#");
          var s = ""; if (q != -1) s = h.slice(q,p);
          var atd = ""; if(h.indexOf(at) == -1) atd = at+d;
          h = h.slice(p+1); x[i].href = "mailto:" + h + atd + s;
        }
      }
    }
  }
}
