document.observe('dom:loaded', function(e) {
  // Auftrittsspezifische Funktionalität
  
  // Akkordion für Medientipps
  if ($("Media")) {
    var yumAccordion = new accordion("Media", {
      classNames : {
        toggle : "toggler",
        toggleActive : "selected",
        content : "element"
      }
    });
    yumAccordion.activate($$('#Media .toggler').first());
  }
  if ($("Journal")) {
    var yumAccordion = new accordion("Journal", {
      classNames : {
        toggle : "toggler",
        toggleActive : "selected",
        content : "element"
      }
    });
    yumAccordion.activate($$('#Journal .toggler').first());
  }
  
  // LayerAd ausblenden
  if ($("LayerAd")) {
    Event.observe($$("#LayerAd a.close").first(), "click", function(event) {
      $("LayerAd").hide();
      Event.stop(event);
    })
  }
  
  // Login-Button bei Hover-Effekt verändern
  if ($$("#Sidebar .box.login fieldset.submit input.submit")[0]) {
    Event.observe($$("#Sidebar .box.login fieldset.submit input.submit").first(), "mouseover", function() {
      this.src = "/images/button_login_hover.gif";
    });
    Event.observe($$("#Sidebar .box.login fieldset.submit input.submit").first(), "mouseout", function() {
      this.src = "/images/button_login.gif";
    });
  }
  
  if ($('BayerVideo')) {
    if ($('BayerVideoAltLink')) {
      $('BayerVideoAltLink').hide();
    }
    if(com.deconcept.FlashObjectUtil.getPlayerVersion().major == 0) {
      if ($('BayerVideoAltLink')) {
        $('BayerVideoAltLink').show();
      }
    }
  }
  
  // Deutschlandkarte mit Darstellung der Landesapothekerkammern
  if ($("GermanyStatesAddress")) {
    $$("#GermanyStatesAddress li").each(function(element) {
      element.hide();
    })
    $$("#GermanyStatesAddress li .close").each(function(element) {
      element.up("p").show();
    })
    
    $$("#MapGermanyStates area").each(function(element) {
      element.observe("click", function(event) {
        Event.stop(event);
        
        $$("#GermanyStatesAddress li").each(function(element) {
          element.hide();
        })
        
        hash = "AK-" + this.href.split('#')[1].toString();
        $(hash).addClassName("tooltip");
        $(hash).show();
      });
    })
    $$("#GermanyStatesAddress li .close").each(function(element) {
      element.observe("click", function(event) {
        Event.stop(event);
        this.up("li").hide();
      });
    })
  }
});
