function addEvents () {
   if (document.addEventListener) { //w3c and netscape
      //alert("w3c and netscape");
      //submen1
      var submenu1 = document.getElementById("1");
      submenu1.addEventListener('click', showHideMenu, false);
      //submenu2
      var submenu2 = document.getElementById("2");
      submenu2.addEventListener('click', showHideMenu, false);
      //submenu3
      var submenu3 = document.getElementById("3");
      submenu3.addEventListener('click', showHideMenu, false);
      //goToHome page - link on banner
      var goHomeDiv = document.getElementById("box_top");
      goHomeDiv.addEventListener('click', goToHomePage, false);
      
   }
   else if (document.attachEvent) { //IE
      //alert("IE");
      //submenu1
      var submenu1 = document.getElementById("1");
      submenu1.attachEvent('onclick', showHideMenu);
      //submenu2
      var submenu2 = document.getElementById("2");
      submenu2.attachEvent('onclick', showHideMenu);
      //submenu3
      var submenu3 = document.getElementById("3");
      submenu3.attachEvent('onclick', showHideMenu);
      //goToHomePage link on banner
      var goHomeDiv = document.getElementById("box_top");
      goHomeDiv.attachEvent('onclick', goToHomePage);
   }
}
function showHideMenu(e) {
   var targ;
   if (!e) var e = window.event;
   if (e.target) targ = e.target;
   else if (e.srcElement) targ = e.srcElement;
   //--> targ stores info's about the clicked Element
   var target_id_nr = String(targ.id);
   var target_id = "sbm"+target_id_nr;
   var target_name = "sbm"+target_id_nr+"name";
   var target_pic = "sbm"+target_id_nr+"pic";
   var checkClassIE = document.getElementById(target_id).getAttribute('className');
   var checkClass = document.getElementById(target_id).className;
   //get the current Class Name
   if (checkClass == "null") var targetClassName = checkClassIE; else targetClassName = checkClass;
   
   //set current Class name to hide/show
   if (targetClassName == 'hide_element') {
      document.getElementById(target_id).className = 'show_element';
      document.images[target_pic].src = 'img/arrow_down.png';
   }else {
      document.getElementById(target_id).className = 'hide_element';
      document.images[target_pic].src = 'img/arrow.png';
   }
}
//create submenu Links->change location
function chURL (obj) {
   var chURLTo = obj.parentNode.id + ".php?";
   //add submenu that contains link clicked
   var submenuActive = obj.parentNode.parentNode.parentNode.parentNode.id;
   window.location = chURLTo + submenuActive;
}
//expand the active submenu after page loads
function expandActiveSubMenu () {
   var loc = String(window.location);
   loc = loc.split("/");
   loc = loc[loc.length-1].split("?");
   expandSubMenuId = loc[loc.length-1];
   if (document.getElementById(expandSubMenuId) !== null) document.getElementById(expandSubMenuId).className = 'show_element';
   //set arrow image - activeMenu = activeImage
   var subMenuNr = expandSubMenuId.split("");
   var activeSubMenuPic = "sbm" + subMenuNr[7] + "pic";
   if (document.getElementById(activeSubMenuPic) !== null) document.images[activeSubMenuPic].src = 'img/arrow_down.png';
}
//highlight active menu entry
function highlightMenuEntry () {
   var loc = String(this.location);
   loc = loc.split("/");
   loc = loc[loc.length-1].split(".");
   if ((loc[loc.length-2]) !== undefined) loc = loc[loc.length-2].toLowerCase();
   if (document.getElementById(loc) !== null) setCurrentMenuLi = document.getElementById(loc).className = 'current';
}

