//Menüfunktionen
//Die Menü-Struktur und die Einträge werden in 'menu_stk.js' definiert!

var an   =new NewArray(50);
var ebene=new NewArray(50);
var typ  =new NewArray(50);
var text =new NewArray(50);
var link =new NewArray(50);
var count=0;
var tree0_opened=0;
var tree1_opened=0;
var page_opened=0;
var name =navigator.userAgent;
var linktext ="";


function opentree(num, file_name)
{
 // if (tree_opened!=0) {closetree(tree_opened);}
  var n=eval(num);
  var i=n+1;
  var akt=ebene[i];
//  if (file_name.search(link[n])>0)
  typ[n]=1;
  if (file_name==link[n])
   {
    if ((ebene[n]==0) && (tree0_opened!=0)) {closetree(tree0_opened);}
    if ((ebene[n]==1) && (tree1_opened!=0)) {closetree(tree1_opened);}
   }
  while ((ebene[i]>=akt) && (i<=count))
  { if (ebene[i]==akt)   {an[i]=1; }
    i++;
  }
  if (ebene[n]==0)
   {
    tree0_opened=num;
    page_opened=0;
   }
  if (ebene[n]==1)
   {
    tree1_opened=num;
    if (file_name==link[n]) {  page_opened=num;   }
   }
  if ((file_name!='') && (file_name!='-')) {top.Main.location.href=file_name+"?spo=1";}
  if (file_name!='-') draw(0);
}

function closetree(num)
{
  var n=eval(num);
  var i=n+1;
  typ[i-1]=2;
  var akt=ebene[i];

  while ((ebene[i]>=akt) && (i<=count))
  { an[i]=0;
    if (typ[i]==1)
      typ[i]=2;
    i++;
  }
  if (link[n]!='') top.Main.location.href=link[n]+"?spo=1";

  if (ebene[n]==0) tree0_opened=0;
  if (ebene[n]==1) tree1_opened=0;
  page_opened=num;
  draw(0);
}

function openpage(num, link)
{
  if (link!='')
   { top.Main.location.href=link+"?spo=1";
     page_opened=num;
     draw(0); }
}

function findpageopened(filename)
{
  var i=1;
  var o=0;
  var datei="";
  var tr1=0;
  var tr0=0;
  var such="find:/"+filename;
//  alert(filename);
  while (i<=count)
   {
     datei=link[i].substring(1,link[i].length);
     if ((such.search(datei) >0) && (o==0)) { o=i; }   //speichert das erste Vorkommen in o
     i=i+1;
   }
// alert(o);
  //draw(0);
  i=o;
  while ((ebene[i]>0) && (i>0))       //geht vom Treffer ausgehend rückwärts bis die zugehörige Hauptebe erreicht ist
   {
    i=i-1;
//    alert(i);
    if ((ebene[o]==2) && (typ[i]<3) && (ebene[i]==1) && (tr1==0)) tr1=i; //
    if ((typ[i]<3) && (ebene[i]==0)) tr0=i; //
   }
//  alert(tr0+" /// "+tr1);

  if (o==0)
   {window.status="Die dargestellte Seite ist nicht über das Menü erreichbar!";}
  else
   {
     i=0;
     while (i<=count)
     {  if (ebene[i]>0) {an[i]=0}   //Nur die Hauptebenen anzeigen
        else
         { an[i]=1;
           if (typ[i]==1) typ[i]=2;
         }
       i=i+1;
      }
    tree0_opened=0;
    tree1_opened=0;
    i=tr0;
    an[i]=1;
    typ[i]=1;
    i=i+1;
    while ((ebene[i]>0) && (i<=count))
     {
       if (ebene[i]==1) an[i]=1;
       i=i+1;
     }
    if (tr1 > 0)
     {
      i=tr1;
      an[i]=1;
      typ[i]=1;
      i=i+1;
      while ((ebene[i]>1) && (i<=count))
       {
        if (ebene[i]==2) an[i]=1;
        i=i+1;
       }
     }
    if (typ[o]==2)
     {
      opentree(o,"-");
     }
    if (ebene[o]>0) page_opened=o
       else page_opened=0;
   }
  draw(0);

}

function NewArray(Anzahl)
{ this.length=Anzahl;
  for (var i=0; i<Anzahl; i++)
    this[i]=0;
  return this;
}

function draw(mode)      //mode=0: Menü-Funktion, mode=1: Sitemap, mode=2: Übersicht
{
  html="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"> \n<html>\n<head>\n<title>Navigation</title>\n<base target='Main'>\n";
  if (mode==2)
   {
    html+="<link href='/stylesheets/9.css' rel='stylesheet' type='text/css'>\n";
    html+="<script src='js_global/menu_fkt.js' type='text/javascript'> </script>\n";
   }
  if (mode>0)
   {
    html+="<script src='js_global/frames_fkt.js' type='text/javascript'> </script>\n";
   }
  html+="<style type=\"text/css\">  ";
  html+="body {margin-right:0px; margin-left: 0px; margin-top: 0px; margin-bottom: 0px;} \n";
  html+="a { font-style: normal; line-height: normal; font-weight: normal; font-variant: normal; color: #3C4975;}\n";
  html+="a:link { text-decoration:none; color:#0c2577; }\n";
  html+="a:visited { text-decoration:none;  color:#0c2577; }\n";
  html+="a:hover { text-decoration:none; color:#00A0C9; } \n";
  html+="a:active { text-decoration:none; color:#0c2577; } \n";
  html+="a:link.lk0 { text-decoration:none; color:#0c2577; } \n";
  html+="a:visited.lk0 { text-decoration:none;  color:#0c2577; } \n";
  html+="a:hover.lk0 { text-decoration:none; color:#00A0C9; } \n";
  html+="a:active.lk0 { text-decoration:none; color:#0c2577; } \n";
  html+="a:link.lk1 { text-decoration:none; color:#0c2577; }  \n";
  html+="a:visited.lk1 { text-decoration:none;  color:#0c2577; }  \n";
  html+="a:hover.lk1 { text-decoration:none; color:#00A0C9; } \n";
  html+="a:active.lk1 { text-decoration:none; color:#0c2577; }\n";
  html+="a:link.lk2 { text-decoration:none; color:#71739A; }  \n";
  html+="a:visited.lk2 { text-decoration:none;  color:#71739A; }   \n";
  html+="a:hover.lk2 { text-decoration:none; color:#00A0C9; }\n";
  html+="a:active.lk2 { text-decoration:none; color:#71739A; } \n";
  html+=".leer {padding-left: 0px;	font-size: 11px;color:#0c2577;font-style: normal;font-weight: normal;font-variant: normal;font-family: Arial, Helvetica, sans-serif;}\n";
  html+=".ebene0 {height:30; color:#0c2577; font-size: 12px; border-width:1; padding-left: 1px; border-color:#FFFFFF;border-top-style:solid;font-style: normal;font-weight: normal;font-variant: normal;font-family: Arial, Helvetica, sans-serif;}\n";
  html+=".ebene1 {height:12;color:#0c2577;font-size: 11px;border-width:1;padding-left: 2px;padding-top: 0px;border-color:#FFFFFF;border-top-style:none;font-family: Arial, Helvetica, sans-serif;}\n";
  html+=".ebene2 {height:10;color:#00A0C9;font-size: 11px;border-width:0;padding-left: 2px;padding-top: 0px;border-color:#BCBFCC;border-top-style:none;font-family: Arial, Helvetica, sans-serif;}\n";
  html+="</style> \n" ;

  html+="<META NAME=\"robots\" CONTENT=\"noindex,follow\">\n</head>\n\n";
  html+="<body bgcolor='#FFFFFF'>\n";
 // html+="<font size='1' face='Arial'>\n";
  html+="<table border='0' width='174' cellspacing='0' cellpadding='0' bgcolor='BCBFCC'>\n";
  if (mode==2) {html+="<tr><td colspan='2' class='headline'>Inhaltsübersicht</td></tr> \n";}
  for (var i=1; i<=count; i++)
    if ((an[i]==1) || (mode>0))
    { html+="<tr>";
      if (mode<2) {html+="<td width='25' bgcolor='#FFFFFF' class='leer'>&nbsp;</td>";}
      html+="<td width='18' bgcolor='#BCBFCC' class='leer' valign='middle'>&nbsp;";
      if ((i==tree0_opened) && (mode<2))
        { html+="<img src='/images/zeiger1a.gif' border=0>"; }
      else html+="";
      if ((i==page_opened) && (mode<2))
        { html+="<img src='/images/zeiger2a.gif' border=0>"; }
      html+="</td>";
      if (i>1) {html+="<td width='128' bgcolor='#BCBFCC' class='ebene"+ebene[i]+"' valign='middle'>";}
       else {html+="<td width='128' bgcolor='#BCBFCC' class='ebene"+ebene[i]+"' valign='middle' style='height: 29; border-top-style: none'>";} //1. Zelle ohne weisse Linie
      if (ebene[i]==2) html+="&nbsp;&nbsp;&nbsp;";

     if (mode==0)
     {
      if (typ[i]==1)
      { html+="<a href='JavaScript:parent.frames[0].opentree("+i+",\""+link[i]+"\")' ";
        html+="onmouseover='window.status="+'"Öffne: '+text[i]+'"'+";return true' onclick='window.status=\"\"; return true' onMousedown='window.status=\"\"; return true' onmouseout='window.status=\"\"; return true' class='lk"+ebene[i]+"'>";
        html+="";
        html+="";
        html+=text[i]+"</a>  \n<br>";
      }
      if (typ[i]==2)
      { html+="<a href='JavaScript:parent.frames[0].opentree("+i+",\""+link[i]+"\")' ";
        html+="onmouseover='window.status="+'"Öffne: '+text[i]+'"'+" ;return true' onclick='window.status=\"\"; return true' onMousedown='window.status=\"\"; return true' onmouseout='window.status=\"\"; return true' class='lk"+ebene[i]+"'>";
        html+="";
        html+="";
        html+=text[i]+"</a>  \n<br>";
      }
      if (typ[i]==3)
      { html+="<a href='JavaScript:parent.frames[0].openpage("+i+",\""+link[i]+"\")' ";
        html+="onmouseover='window.status="+'"Zeige: '+text[i]+'"'+" ;return true' onclick='window.status=\"\"; return true' onMousedown='window.status=\"\"; return true' onmouseout='window.status=\"\"; return true' class='lk"+ebene[i]+"'>";
        html+="";
        html+="";
        linktext=text[i];
        if (linktext.length > 20)
         {linktext = linktext.substring(0,18)+"...";}
        html+=linktext+"</a>  \n<br>";
      }
      if (typ[i]==31)
      { html+="";
        html+="<a href='"+link[i]+"' ";
        html+="onmouseover='window.status="+'"'+text[i]+'"'+" ;return true' class='lk"+ebene[i]+"'>";
        html+="";
        html+=text[i];
        html+="</a> \n<br>";
      }
     if (typ[i]==30)
      { html+="";
        html+="<a href='"+link[i]+"' ";
        html+="onmouseover='window.status="+'"'+text[i]+'"'+" ;return true' class='lk"+ebene[i]+"'>";
        html+="";
        html+=text[i];
        html+="</a>\n<br>";
      }
     if (typ[i]==7)
      { html+="";
        html+="<a href='"+link[i]+"' target='_blank'";
        html+="onmouseover='window.status="+'"Öffne im neuen Fenster: '+text[i]+'"'+" ;return true' onclick='window.status=\"\"; return true' onMousedown='window.status=\"\"; return true' onmouseout='window.status=\"\"; return true' class='lk"+ebene[i]+"'>";
        html+="";
        html+=text[i];
        html+="</a>\n<br>";
      }
     }
     else // mode > 0
      {
       if (link[i]!='')
        {
         if (mode==1)
          {
           html+="";
           html+="<a href='"+link[i]+"' ";
           html+=" class='lk"+ebene[i]+"'>";
           html+="";
           html+=text[i];
           html+="</a> \n<br>";
          }
         else // mode>1
          {
           html+="";
           html+="<a href='"+link[i]+"' ";
           if (typ[i]==7)
            {
             html+=" target='_blank' ";
            }
           html+=" class='lk"+ebene[i]+"'>";
           html+="";
           html+=text[i];
           html+="</a> \n<br>";
          }
        }
       else html+=text[i]+"\n<br>";       //kein Link vorhanden (nur Text)
      }
     html+="</td></tr> \n\n";
    }
  html+="<tr>";
  if (mode<2) {html+="<td height='500' bgcolor='#FFFFFF' class='leer'>&nbsp;</td>";}
  html+="<td height='1000' bgcolor='#BCBFCC' class='leer'>&nbsp;</td><td bgcolor='#BCBFCC' class='ebene0'>&nbsp;</td>\n</tr>\n";
  html+="</table>\n</body>\n</html>\n\n";
  if (mode==0)
   {
    parent.frames[1].document.open();
    parent.frames[1].document.clear();
    parent.frames[1].document.write(html);
//  if (name.indexOf("MSIE")>-1)
     parent.frames[1].document.close();
   }
  if (mode>0)
   {
    top.topFrame.rightwindow("about:blank",500,200);
    F1.window.document.write(html);
   }

}

function set(s_an,s_ebene,s_typ,s_text,s_link)
{ count++;
  an   [count]=s_an;
  ebene[count]=s_ebene;
  typ  [count]=s_typ;
  text [count]=s_text;
  link [count]=s_link;
}