/* require "prototype.js", "scriptaculous.js", "effects.js" */

var PID = $("wrap").className.split("-")[1];

function provideIntroAnimation() {
   Element.hide('navigation');
   Element.hide('footer');
   //var h1 = $$("h1").first(); // prototype 1.5.0
   var h1 = document.getElementsByTagName("h1")[0];
   h1.style.cursor = 'pointer';
   h1.style.top = '323px';
   h1.onclick = function() {
      Effect.Fade(this); 
      Effect.Appear('navigation');
      Effect.Appear('footer'); 
   }
}

function externalLinks() {
  //$$("a[rel=external]").each(function(anchor) { 
  $A(document.getElementsByTagName("a")).each(function(anchor) { 
    if (anchor.rel == "external") {
        anchor.target = "_blank";
        if (anchor.title.length == 0) {
        anchor.title = "Öffnet in neuem Fenster";
      }
    }
  });
}

function blurLinksOnClick() {
  $A(document.getElementsByTagName("a")).each(function(a){
  //$$("a").each(function(a){
    var a_onclick = a.onclick;
    a.onclick = function() {
      if (a_onclick instanceof Function) a_onclick.call(this);
      this.blur();
    };
  });
}

externalLinks();
blurLinksOnClick();
if (PID == "intro") provideIntroAnimation();
//$$('body').first().show();
Element.show(document.getElementsByTagName('body')[0]);
