function initMenu()
{
  var nodes = document.getElementsByTagName("a");
  for (var i=0; i<nodes.length; i++)
  {
    nodes[i].onclick = function(){
      if (this.className.indexOf("a-rss") != -1) {
        if (this.parentNode.className.indexOf(" rss-active") != -1) {
          this.parentNode.className = this.parentNode.className.replace(" rss-active", "");
        }
        else 
          this.parentNode.className += " rss-active";
      }
      if (this.className.indexOf("a-verlosung") != -1) {
        window.open('fileadmin/popup/verlosung.html', 'Verlosung', 'width=600,height=400,status=yes,scrollbars=no,resizable=no');
      }
      if (this.className.indexOf("a-bkFunc") != -1) {
        bkHandler();
      }
    }
  }
  
  // creating and opening the iframe with the website
  $('.iframe').each(function(index)
  {
    $(this).click(function()
    {
      // scroll to top
      $("html, body").scrollTop(0);
      
      // check if dialog already exists
      if ($('#dialog_iframe').length != 0)
      {
        $('#dialog_iframe').dialog('open');
      }
      else // new dialog
      {
        var dialog = $('<iframe id="dialog_iframe" width="988" height="580" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" src="' + $(this).attr('href') + '"></iframe>').dialog(
        {
          title : $(this).attr('title'),
          width : 1000,
          height : 600,
          modal : true,
          position : 'top',
          draggable : false,
          resizable : false
        });
      }
      $('#dialog_iframe').attr('style', 'width:1002px !important; height:565px !important;');
      
      return false;
    })
  });
}
if (window.addEventListener)
  window.addEventListener("load", initMenu, false);
else if (window.attachEvent)
  window.attachEvent("onload", initMenu);

