var menu = new Array();
var vert = new Array();
var tmr = new Array();
var adj = new Array();
var last_zIndex = 10000;
var lastOverId = '';
var div_ob_abst = 24;
var richt = 'bottom';

var adjustTop		= 1;			// move the submenu's some pixels. Positive number (10) for down, negative (-10) for up.
var adjustLeft		= 2;			// move the submenu's some pixels. Positive number (10) for right, negative (-10) for left.
var zuf=Math.floor(Math.random()*100);

menu['m']  = new Array();
menu['m'][0] = new Array("Info","d_ter_vw.php?i=I","d_h_info.php","");
menu['m0'] = new Array();//0     1                 2              3
menu['m0'][0] = new Array("Tages-Info","d_ter_vw.php?i=I","d_h_info.php","");
menu['m0'][1] = new Array("Schülerberatung","d_bib_vw.php","d_fach/bib/bib_1.htm","Berufsorientierung / Schülerberatung");
//menu['m0'][2] = new Array("Nachhilfebörse","","https://www.dachsberg.at/moodle/mod/resource/view.php?id=602","T");
//menu['m0'][6] = new Array("Sitemap","","d_site.htm","Sitemap");
menu['m0'][2] = new Array("Begabtenförderung","","d_h_begabt.php","Begabtenförderung");
menu['m0'][3] = new Array("Impressum","","d_impr.php","Impressum");
menu['m'][1] = new Array("Schule","d_kla_vw.php","d_kla_sta.php","Klassen");
menu['m1'] = new Array();
menu['m1'][0] = new Array("Schulleitung","","d_sch_lei.php","Schulleitung");
menu['m1'][1] = new Array("LehrerInnen","d_leh_vw.php","d_leh_pic.php","LehrerInnen");
menu['m1'][2] = new Array("Klassen","d_kla_vw.php","d_kla_sta.php","SchülerInnen");
menu['m1'][3] = new Array("Schulerhalter","","d_sch_erh.php","Schulerhalter");
menu['m1'][4] = new Array("Personal","","d_sch_per.php","Hauspersonal");
menu['m1'][5] = new Array("Schulpartner","","d_sch_elt.php","Elternverein");
	menu['m1_5'] = new Array();
	menu['m1_5'][0] = new Array("Elternverein","","d_sch_elt.php","Elternverein");
	menu['m1_5'][1] = new Array("SGA","","d_sch_sga.htm?"+zuf,"Schulgemeinschaftsausschuss");
menu['m1'][6] = new Array("Schulprofil","d_pro_vw.php","d_pro_zie.htm","Ziele der Schule");
	menu['m1_6'] = new Array();
	menu['m1_6'][0] = new Array("Ziele","d_pro_vw.php","d_pro_zie.htm","");
	menu['m1_6'][1] = new Array("Stundentafeln","d_pro_vw.php","d_pro_stu.htm","");
	menu['m1_6'][2] = new Array("Oberstufe/ORG","d_pro_vw.php","d_downl/oberstufe.pdf","T");
	menu['m1_6'][3] = new Array("NABE","d_pro_vw.php","d_pro_nab.htm","");
	menu['m1_6'][4] = new Array("eLSA","d_pro_vw.php","d_pro_els.htm","");
	menu['m1_6'][5] = new Array("Aktivitäten","d_pro_vw.php","d_pro_akt.htm","");
	menu['m1_6'][6] = new Array("Religiöses","d_pro_vw.php","d_pro_rel.htm","");
	menu['m1_6'][7] = new Array("Leben Lernen","d_pro_vw.php","d_pro_leb.htm","");
	menu['m1_6'][8] = new Array("Jugendhaus","d_pro_vw.php","d_pro_bil.htm","");
menu['m1'][7] = new Array("Rundgang","d_run_vw.php","d_pics.php|nam=101209nA","Gebäude");
	menu['m1_7'] = new Array();
	menu['m1_7'][0] = new Array("Neubau","d_run_vw.php","d_pics.php|nam=101209nA","Neubau");
	menu['m1_7'][1] = new Array("Gebäude","d_run_vw.php","d_pics.php|nam=100831nD","Gebäude");
	menu['m1_7'][2] = new Array("Internat","d_run_vw.php","d_pics.php|nam=100831nD","");
	menu['m1_7'][3] = new Array("Räume","d_run_vw.php","d_pics.php|nam=100831nD","");
	menu['m1_7'][4] = new Array("Ansichten","d_run_vw.php","d_pics.php|nam=100831nD","");
	menu['m1_7'][5] = new Array("Im Winter","d_run_vw.php","d_pics.php|nam=100831nD","");
menu['m1'][8] = new Array("Finanzielles","","d_sch_fin.htm","Finanzielles");
menu['m'][2] = new Array("Unterricht","d_fba_vw.php","d_fba_st.php","Themen der Fachbereichsarbeiten");
menu['m2'] = new Array();
menu['m2'][0] = new Array("FBA-Themen","d_fba_vw.php","d_fba_st.php","Themen der Fachbereichsarbeiten");
menu['m2'][1] = new Array("Beweg.&Sport","","d_fach/lue/lue-001.htm","Bewegung und Sport");
menu['m2'][2] = new Array("Biologie","d_ter_vw.php|i=A|f=BU|a=f","d_chron.php|i=A|f=BU|a=f","Biologie und Umweltkunde");
menu['m2'][3] = new Array("Chemie","d_ter_vw.php|i=A|f=Ch|a=f","d_chron.php|i=A|f=Ch|a=f","Chemie");
menu['m2'][4] = new Array("Physik","d_ter_vw.php|i=A|f=Ph|a=f","d_chron.php|i=A|f=Ph|a=f","Physik");
menu['m2'][5] = new Array("Geografie","d_ter_vw.php|i=A|f=GW|a=f","d_chron.php|i=A|f=GW|a=f","Geografie und Wirtschaftskunde");
menu['m2'][6] = new Array("Psychologie","d_ter_vw.php|i=A|f=PP|a=f","d_chron.php|i=A|f=PP|a=f","Psychologie");
menu['m2'][7] = new Array("Musikerziehung","d_ter_vw.php|i=A|f=ME|a=f","d_chron.php|i=A|f=ME|a=f","Musikerziehung");
menu['m2'][8] = new Array("Bildn. Erziehung","d_ter_vw.php|i=A|f=BE|a=k","d_chron.php|i=A|f=BE|a=k","Bildn. Erziehung");
menu['m2'][9] = new Array("Text. Werken","d_ter_vw.php|i=A|f=TX|a=k","d_chron.php|i=A|f=TX|a=k","Bildn. Erziehung");
menu['m2'][10] = new Array("Techn. Werken","d_ter_vw.php|i=A|f=TW|a=k","d_chron.php|i=A|f=TW|a=k","Bildn. Erziehung");
menu['m2'][11] = new Array("Plast. Gestalten","d_ter_vw.php|i=A|f=PG|a=k","d_chron.php|i=A|f=PG|a=k","Bildn. Erziehung");
menu['m'][3] = new Array("Listen","","d_kla_opt.php","Klassenlisten");
menu['m3'] = new Array();
menu['m3'][0] = new Array("Klassenlisten","","d_kla_opt.php","Klassenlisten");
menu['m3'][1] = new Array("Fächer-Liste","","d_kla_opt.php?a=kv","Unterrichtsfächer");
menu['m3'][2] = new Array("LehrerInnen","d_leh_vw.php","d_leh_spr.php|i=L","LehrerInnen");
menu['m3'][3] = new Array("Klassensprecher","","d_kla_spr.php","Klassensprecher");
menu['m'][4] = new Array("Termine","d_ter_vw.php?i=T","d_term.php","");
menu['m4'] = new Array();
menu['m4'][0] = new Array("Monat","d_ter_vw.php?i=T","d_term.php","");
// menu['m4'][1] = new Array("Kalender","d_ter_vw.php?i=kalen","d_kalen.php","Kalender");
menu['m4'][1] = new Array("Google-Kalender","","https://www.google.com/calendar/embed?height=600&amp;wkst=2&amp;bgcolor=%23FFFFFF&amp;src=dachsberg.at_emr6q4o89oeo0294u0rtm0otjk%40group.calendar.google.com&amp;color=%23125A12&amp;src=e_2_de%23weeknum%40group.v.calendar.google.com&amp;color=%23060D5E&amp;src=de.austrian%23holiday%40group.v.calendar.google.com&amp;color=%23853104&amp;ctz=Europe%2FVienna","T");
menu['m4'][2] = new Array("RTF-Kalender","","d_kal_opt.php","Kalender erstellen");
menu['m4'][3] = new Array("Schulveranst.","d_ter_vw.php?i=V","d_ter_sva.php","Schulveranstaltungen");
menu['m4'][4] = new Array("Schulfrei","","d_ter_fre.php","Schulfreie Tage");
menu['m4'][5] = new Array("Schularbeiten","d_sab_vw.php","d_sab.php","Schularbeiten-Kalender");
menu['m'][5] = new Array("Orden","","d_ord_ord.php","Ordenshaus Dachsberg");
menu['m5'] = new Array();
menu['m5'][0] = new Array("Ordenshaus","","d_ord_ord.php","Ordenshaus Dachsberg");
menu['m5'][1] = new Array("Geschichte","","d_ord_ges.htm","Aus der Geschichte von Dachsberg");
menu['m5'][2] = new Array("Franz v. Sales","","d_h_fvs.htm","","");
menu['m5'][3] = new Array("OSFS-Links","","d_ord_osf.htm","","Oblaten weltweit");
menu['m'][6] = new Array("Ehemalige","d_mat_vw.php","d_ehe_mit.htm","Mitteilungen von Ehemaligen");
menu['m6'] = new Array();
menu['m6'][0] = new Array("Mitteilungen","d_mat_vw.php","d_ehe_mit.htm","Mitteilungen von Ehemaligen");
menu['m6'][1] = new Array("Webseiten","","d_ehe_web.php","Webseiten von Ehemaligen");
menu['m6'][2] = new Array("Matura","d_mat_vw.php","d_ehe_mat.php","Matura");
menu['m6'][3] = new Array("Personensuche","d_mat_vw.php","d_ehe_suc.php","Personensuche");
menu['m'][7] = new Array("Dachsbau","d_bau_vw.php","d_bau/index.html","T");
menu['m7'] = new Array();
menu['m7'][0] = new Array("Aktuell","","d_bau/index.html","T");
menu['m7'][1] = new Array("Programm","","d_bau/db_woche.pdf","T");
menu['m7'][2] = new Array("Video","","d_bau/video/index.html","Videoteam");
menu['m7'][3] = new Array("DVT","","http://krfa.kr.funpic.de/index.htm","T");
menu['m7'][4] = new Array("USA Blog","","http://sites.google.com/a/dachsberg.at/usa-blog/","T");
var menu_len=8;		// Anzahl m0,m1,..

function iFramePatch()		//This function should be called onMouseOver of every iFrame that's under the menu structure
{if (!document.all && lastOverId)
     hideSubmenu(document.getElementById(lastOverId));
}
function buildSubmenu(obj,align)
{ var re=0;
 if (brw=='MF')
     re=6;
 lastOverId = obj.id;
 menuPath = obj.id.split('_');
 x = "div";
 for (i=0; i<menuPath.length; i++)
     {x+='_'+menuPath[i];
      if (document.getElementById(x))
         {if (tmr[x]) window.clearTimeout(tmr[x]);
          document.getElementById(x).style.visibility = vis(1);}
     }
 if (menu[obj.id])		//check if we have a submenu of the obj...
    {d = obj;			//calc position of mouseover
     if(d)
//       {L_pos = d.offsetLeft + d.offsetWidth;
//        T_pos = d.offsetTop;
       {if (align == 'bottom')
           {L_pos = d.offsetLeft - 1 + d.offsetWidth;	// div_ob_abst = 22; wegen IframePatch()
            T_pos = d.offsetTop + 3;} else
           {L_pos = d.offsetLeft + d.offsetWidth;	// ???
            T_pos = d.offsetTop;}
        while (d.offsetParent)
              {d = d.offsetParent;
               L_pos+= d.offsetLeft;
               T_pos+= d.offsetTop;}
       }
     if (obj.className.indexOf('menuItem') < 0 && align == 'bottom')	//patch first submenu to go right below the main buttons...
        {L_pos-= obj.offsetWidth;
         T_pos+= obj.offsetHeight;}
     if (obj.id.length==2)				// NEU - zur Positionierung!
        {L_pos+= adjustLeft;
         T_pos+= adjustTop;} else 
         T_pos+=1;
     if (L_pos > 0 && T_pos >0)		//Only parse when position is higher than 0,0... else we dont have the right position!
        {c = document.getElementById('div_' + obj.id);		//check if allready build...
         if (c)
            {c.style.visibility = vis(1);					//unhide...
             c.style.zIndex = last_zIndex++;
             c.style.top = (T_pos - 1) + "px";				//hard replace
             c.style.left = (L_pos - 1) + "px";} else		//
            {subObj = document.createElement('div');		//build new div
             subObj.id = 'div_' + obj.id;
             subObj.className = 'menu';
             subObj.style.position = 'absolute';
             subObj.style.zIndex = last_zIndex++;
             subObj.style.top = (T_pos - 1) + "px";
             subObj.style.left = (L_pos - 1) + "px";
             document.getElementsByTagName('body')[0].appendChild(subObj);		//write div to the body...
             content = "";				//build html for submenu
             m = menu[obj.id];			//document.getElementById('dum').innerHTML='<p>'+m[1][2]+'</p>';
             for (i=0; i<m.length; i++)
                 {if (menu[obj.id][i][3]=="T")
                      var act="top.location.href='"+menu[obj.id][i][2]+"'"; else
                      //if (menu[obj.id][i][1]=="")
                      //    var act="top.location.href='d_suw.php?t="+menu[obj.id][i][3]+"&i="+menu[obj.id][i][2]+"&s="+scr+"'"; else
                          var act="top.location.href='d_sub.php?m="+menu[obj.id][i][1]+"&t="+menu[obj.id][i][3]+"&i="+menu[obj.id][i][2]+"&s="+scr+"'";
                  var s_top=subObj.style.top;
                  var t_top=eval(s_top.substr(0,eval(s_top.Length-2))+i*div_ob_abst);
                  content+= "<div style=\"position:absolute; width:"+eval(bw2-re)+"px; top:"+t_top+"px\" onmouseout=\"hideSubmenu(this)\" onmouseover=\"buildSubmenu(this,align)\" onclick=\""+ act + "\" class=menuItem id=\"" + obj.id + "_" + i +"\">" + m[i][0] +"</div>";
                  adj[i] = obj.id + "_" + i;		//width:"+eval(bw2-re)+"px 
                 }
             subObj.innerHTML = content;				//insert new menu
            }
        }
    }
}
function hideSubmenu(obj)
{closePath = obj.id.split('_');		//get common part of div id
 x = "div";							//hide path
 for (i=0; i<closePath.length; i++)
     {x+= '_' + closePath[i];
      if (document.getElementById(x))
          tmr[x] = window.setTimeout("document.getElementById('"+x+"').style.visibility = vis(0);",100);}
}
document.onmouseover = function(e)		//change div's on mouse over and out...
{obj = document.all ? event.srcElement : e.target;
 but = obj.className.substring(0,4);
 if (but=='menu' || but=='main' || but=='butt')
     obj.className+='Over';

}
document.onmouseout = function(e)
{obj = document.all ? event.srcElement : e.target;
 if (obj.className.substr((obj.className.length - 4),4) == 'Over')
     obj.className = obj.className.substr(0,(obj.className.length - 4));
}

function hori_menu(li,t1)
{max=menu_len;
 var w=0;
 var re=0;
 if (brw=='MF')
     re=6;
 for (var i=0; i<max; i++)
     {if (i!=0 && i!=7)
          wid=bw1; else
          wid=bw2;
      document.write('<div class=main id="m'+i+'" ');	// HAUPTMENÜ ... m1,m2,..
      document.write('style="position:absolute; width:'+eval(wid-re)+'px; height:'+eval(bh2-re)+'px; left:'+eval(li+w)+'px; top:'+t1+'px" ');
      if (menu["m"+i])
          if (menu["m"+i].length>1)			// Submenü existiert
              document.write('onMouseout=hideSubmenu(this) onMouseover=buildSubmenu(this,richt) ');
          if (menu["m"][i][3]=="T")
              var act="top.location.href='"+menu["m"][i][2]+"'"; else
              //if (menu["m"][i][1]=="")
              //    var act="top.location.href='d_suw.php?t="+menu["m"][i][3]+"&i="+menu["m"][i][2]+"&s="+scr+"'"; else
                  var act="top.location.href='d_sub.php?m="+menu["m"][i][1]+"&t="+menu["m"][i][3]+"&i="+menu["m"][i][2]+"&s="+scr+"'";
      document.write('onClick=\"'+act+'\">'+menu["m"][i][0]+'</div>');
      w=eval(w+wid+3);
     }
}

vert = new Array();
vert[0] = new Array("Anmeldung GYM","","d_h_anm_g.htm","Anmeldung / Voranmeldung - GYM");
vert[1] = new Array("Anmeldung ORG","","d_h_anm_o.htm","Anmeldung / Voranmeldung - ORG");
vert[2] = new Array("Tagesbetreuung","d_h_tabe_vw.php","d_h_tabe.php","TABE");
vert[3] = new Array("Kontakte","","d_kontakt.php","Kontakt");
vert[4] = new Array("Geburtstage","d_ter_vw.php?i=G","d_geb.php","Geburtstage");
vert[5] = new Array("Supplierungen","d_sup_vw.php","d_sup.php","Supplierplan");
vert[6] = new Array("Stundenplan","","https://www.dachsberg.at/WebUntis/?school=gym_dachsberg","T");
vert[7] = new Array("Klassen-Webs","","d_h_klweb.php","Klassen-Webseiten");
vert[8] = new Array("Gästebuch","d_gab_vw.php","gb/index.php?action=view","Gästebuch");
vert[9] = new Array("Neue Termine","","d_ter_neu.php","Neue Termine");
vert[10] = new Array("Downloads","","d_down.htm","");

function vert_menu(li,t1,item,color)
{max=item.length;
 for (var i=0; i<max; i++)
      {document.write('<div class=butt'+color+' ');
       document.write('style="position:absolute; left:'+li+'px; top:'+eval(t1+i*22)+'px; width:'+eval(bw2-bre)+'px; height:'+eval(bh1-bre)+'px" ');
           if (item[i][3]=="T")
               act="top.location.href='"+item[i][2]+"'"; else
               if (item[i][3]=="S")
                   act="parent.frames['ifr'].location.href='"+item[i][2]+"'"; else
                   //if (item[i][1]=="")
                   //    act="top.location.href='d_suw.php?t="+item[i][3]+"&i="+item[i][2]+"&s="+scr+"'"; else
                       act="top.location.href='d_sub.php?m="+item[i][1]+"&t="+item[i][3]+"&i="+item[i][2]+"&s="+scr+"'";
       document.write('onClick=\"'+act+'\">'+item[i][0]+'</div>');
      }
}

