  var doc;
  var geladen=false;
  var Zeichnen=true;
  var MP0;
  var AlleMP=new Array()
  var HostName=window.location.host; if (HostName=="") HostName="(lokal)";
  var SZDefault=HostName;
  var mFarbe = 'yellow';

  function SetStatus(Zusatz)
  {
    if (Zusatz=="")
      window.status=SZDefault
    else
      window.status=HostName+" - "+Zusatz;
  }

  function NeuerMP(iParent,iEbene,iPic,iName,iURL)
  {
    this.parent  = iParent;
    this.ID      = AlleMP.length;
    this.Ebene   = iEbene;
    this.Pic     = iPic;
    this.Name    = iName;
    this.URL     = iURL;
    this.iFeld   = new Array();
    this.offen   = false;
    this.sichtbar= false;
    this.marked  = false;
    AlleMP[AlleMP.length]=this;
  }

  function AddMP(parentMP,iPic,iName,iURL)
  {
    var NrMP=parentMP.iFeld.length;
    parentMP.iFeld[NrMP]=new NeuerMP(parentMP,parentMP.Ebene+1,iPic,iName,iURL);
    return parentMP.iFeld[NrMP];
  }

  function Laden(Sprache)
  {
    var MP1,MP2,MP3,MP4,MP5,MP6;

    MP0=new NeuerMP(MP0,-1,"Root","#");
    AddMP(MP0,"anfang","Startseite","titel.htm");
    MP1=AddMP(MP0,"","Chronik","chronik.htm");
    MP1=AddMP(MP0,"","Bilder","bilder.htm");
    MP1=AddMP(MP0,"","Veranstaltungen","kalender.htm");
    MP1=AddMP(MP0,"","Das Buch","buch.htm");
    MP1=AddMP(MP0,"","Ortslage","ort.htm");
    MP1=AddMP(MP0,"","Freizeit","freizeit.htm");
    MP2=AddMP(MP1,"","Gastronomie","gastro.htm");
    MP2=AddMP(MP1,"","Erntefest","ernte.htm");
    MP2=AddMP(MP1,"","Landpartie","landpa.htm");
    MP2=AddMP(MP1,"","Umgebung","umgeb.htm");
    MP1=AddMP(MP0,"","Vereine","verein.htm");
    MP1=AddMP(MP0,"","Impressum","impress.htm");
    MP1=AddMP(MP0,"","Sitemap","sitemap.htm");

    for (var i=0; i<MP0.iFeld.length; i++)
      MP0.iFeld[i].sichtbar=true;

    geladen=true;
    PaintMenu();
  }

  function zuMP(aMP)
  {
    aMP.offen=false;
    aMP.marked=false;
    for (var i=0; i<aMP.iFeld.length; i++)
    {
      if (aMP.iFeld[i].Ebene!=0)
        aMP.iFeld[i].sichtbar=false;
      zuMP(aMP.iFeld[i]);
    }
  }

  function ShowMP(aMP)
  {
    zuMP(MP0);
    aMP.marked=true;
    aMP.sichtbar=true;
    while (aMP.parent.ID!=0)
    {
      aMP = aMP.parent;
      aMP.offen=true;
      aMP.sichtbar=true;
      for (var i=0; i<aMP.iFeld.length; i++)
        aMP.iFeld[i].sichtbar=true;
    }
  }

  function aufMP(aMP)
  {
    ShowMP(aMP);
    aMP.offen=true;
    for (var i=0; i<aMP.iFeld.length; i++)
      aMP.iFeld[i].sichtbar=true;
  }

  function rein(mNr)
  {
    SetStatus(AlleMP[mNr].Name);
  }

  function raus(mNr)
  {
    SetStatus('');
  }

  function rauf(mNr)
  {
    Zeichnen=false; //vermeidet doppeltes Zeichnen durch Seitenaufruf
    if (AlleMP[mNr].URL!='#')
      parent.HF.location.href=AlleMP[mNr].URL;

    if (AlleMP[mNr].offen)
    {
      if (AlleMP[mNr].marked) zuMP(AlleMP[mNr]);
    }
    else
    {
      aufMP(AlleMP[mNr]);
    }
    Zeichnen=true;
    PaintMenu();
    SetStatus('');
  }

function PaintPic(aPic)
{
//  doc.write('<img src="menu/'+aPic+'.gif" align="top" border="0">');
  doc.write('&nbsp;&nbsp;&nbsp;');
}

function PaintMP(aMP)
{
  for (var i=0; i<aMP.iFeld.length; i++)
    if (aMP.iFeld[i].sichtbar)
  {
    doc.write('<a href="#" onmouseover="parent.rein('+aMP.iFeld[i].ID+'); return true" onmouseout="parent.raus('+aMP.iFeld[i].ID+'); return true" onclick="parent.rauf('+aMP.iFeld[i].ID+'); return false"');
    if (aMP.iFeld[i].marked) doc.write(' style="color:'+mFarbe+'"');
    doc.write('>');
    if (aMP.iFeld[i].Pic||"")
      PaintPic(aMP.iFeld[i].Pic)
    else
    {
      var k=0;
      while (k<aMP.iFeld[i].Ebene)
      {
        PaintPic('gerade');
        k++;
      }
      if (aMP.iFeld[i].iFeld.length>0)
      {
        if (aMP.iFeld[i].offen)
          PaintPic('abzwb')
        else
        if (i!=aMP.iFeld.length-1)
          PaintPic('abzw');
        else
          PaintPic('abzwe');
      }
      else
      if (i!=aMP.iFeld.length-1)
        PaintPic('zweig')
      else
        PaintPic('ende');
    }
    doc.writeln('&nbsp;'+aMP.iFeld[i].Name+'</a><br><br>');
    PaintMP(aMP.iFeld[i]);
  }
}

function PaintMenu()
{
  if (geladen && ((window.document.frames) || (navigator.appVersion.substring(0,1) >= "4")))
  {
    doc=parent.HM.window.document;
    doc.open('text/html')
    doc.writeln('<html>');
    doc.writeln('<head>');
    doc.writeln('  <meta name="author" content="Christian Rassmann">');
    doc.writeln('  <meta name="robots" content="noindex,follow">');
    doc.writeln('  <meta http-equiv="expires" content="100000">');
    doc.writeln('  <title>'+HostName+'</title>');
    doc.writeln('  <style>');
    doc.writeln('    body      {background-color:#408080; margin-top:0px;}');
    doc.writeln('    p         {text-align:left; color:yellow}');
    doc.writeln('    p.frei a  {font:bold 10pt MS Sans Serif;}');
    doc.writeln('    p.menu    {border-style:none; border-width:1px; margin-top:0px; margin-bottom:0px;}');
    doc.writeln('    hr        {color:yellow; text-align:center; height:1px}');
    doc.writeln('    a         {font:bold 10pt MS Sans Serif; text-decoration:none;}');
    doc.writeln('    a:link    {color:yellow;}');
    doc.writeln('    a:visited {color:yellow;}');
    doc.writeln('    a:hover   {color:white;}');
    doc.writeln('  </style>');
    doc.writeln('  <base target="HF">');
    doc.writeln('</head>');
    doc.writeln('<body>');
    doc.writeln('<img src="basic/ortsschild.jpg" border="0">');
    doc.writeln('<p class="menu"><br>');
    PaintMP(MP0);
    doc.writeln('</nobr></p>');
    doc.writeln('</body></html>');
    doc.close();
  }
}

function SetMenuByName(iURL)
{
  if (geladen)
  {
    for (var i=0; i<AlleMP.length; i++)
      if (AlleMP[i].URL==iURL)
      {
         if (AlleMP[i].offen)
           aufMP(AlleMP[i])
         else
           ShowMP(AlleMP[i]);
      }
    PaintMenu();
  }
}





var Anfang=false;

function SitemapMP(aMP)
{
  for (var i=0; i<aMP.iFeld.length; i++)
  {
    if (aMP.iFeld[i].Ebene==0)
    {
      if (Anfang)
      {
        doc.writeln('    </td>');
        doc.writeln('  </tr>');
      }
      doc.writeln('  <tr>');
      doc.writeln('    <td>'+aMP.iFeld[i].Name+'</td>');
      doc.writeln('    <td>');
      if (aMP.iFeld[i].URL!='#') doc.writeln('      <a href="'+aMP.iFeld[i].URL+'">'+aMP.iFeld[i].Name+'</a><br>');
      Anfang=true;
    }
    else
    {
      doc.write('      ');
      var k=0;
      while (k<aMP.iFeld[i].Ebene)
      {
        doc.write('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
        k++;
      }
      doc.writeln('<a href="'+aMP.iFeld[i].URL+'">'+aMP.iFeld[i].Name+'</a><br>');
    }
    SitemapMP(aMP.iFeld[i]);
  }
}


