﻿// DHTML-Bibliothek Version 1.0  last-update: 25.09.2008

  var browserName = navigator.appName,
      browserVersion = parseInt(navigator.appVersion),
      isIE = browserName.indexOf("Microsoft Internet Explorer") ==-1 ? false : true,
      isNN = browserName.indexOf("Netscape")==-1 ? false : true,
      isOp = browserName.indexOf("Opera")==-1 ? false : true,
      isMacIE = /msie .* mac/i.test(navigator.userAgent),
      isDOM = document.getElementById,
      isDomNN = document.layers,
      isNN4 = (document.layers && typeof document.classes != "undefined"),
      isN6 = (!isOp && document.defaultView && typeof document.defaultView.getComputedStyle != "undefined"),
      isW3C = !isIE && !isN6 && !isOp && document.getElementById,
      isDomIE = document.all,
      docStr,
      styleStr= isDomNN ? '' : 'style.'
      ce = document.captureEvents,
      docBody= false,
      curToolTip = null;
  if (isDOM)
     docStr="document.getElementById(elem).";
  else if (isDomIE)
     docStr="document.all[elem].";
  else
     docStr="document.layers[elem].";
  function setAttr(elem, attr, val)
  {
    if ( typeof elem != 'object' )
       eval("elem= " + docStr.substr(0, docStr.length-1)+ ";");
    if ( elem )
       eval("elem." + styleStr + attr + "= val");
  }
  function getAttr(elem, attr)
  {
    if ( typeof elem == 'object' )
       eval("var ret= elem." + styleStr + attr + ";");
    else
       eval("var ret= " + docStr + styleStr + attr + ";");
    return (ret ? ret: '');
  }
  function getObject(elem){eval("var ret= " + docStr.substr(0, docStr.length-1)+ ";"); return (ret ? ret: void(0)); }
  function getInt(x){var y; return isNaN(y = parseInt(x),10)? 0 : y;}
  function getObjW(elem){return getInt(isNN4? elem.clip.width : (elem.offsetWidth || elem.style.pixelWidth) );}
  function getObjH(elem){return getInt(isNN4? elem.clip.height: (elem.offsetHeight || elem.style.pixelHeight));}
  function setObjPos(x, y, elem){var i = elem.style || elem; var px = (isNN)? '' : 'px'; i.left = x + px; i.top = y + px; }
  function getEvX(e, xlim){var y = getInt(e.pageX || e.clientX || 0) + getInt(isIE? docBody.scrollLeft : 0);if(y > xlim)y = xlim;var scr = getInt(window.pageXOffset || (docBody? docBody.scrollLeft : 0) || 0);if(y < scr) y = scr; return y;}
  function getEvY(e, ylim, elem){var y2;var y = getInt(e.pageY || e.clientY || 0) + getInt(isIE? docBody.scrollTop : 0) + 15; if(y > ylim && y > ylim-24) y -= (curToolTip.h + 40); return y;}

  function getContent(elem)
  {
    var content= false;
    if ( typeof elem != 'object' )
       eval("elem= " + docStr.substr(0, docStr.length-1) + ";");
    if ( !elem )
       return false;
    if (isDOM){
        if ( elem.firstChild ) content= elem.firstChild.nodeValue; 
    }
    else
       if (isDomIE )
          content= elem.innerText;
       else
          if ( isDomNN ){
             elem.document.open();
             content= elem.document.read();
             elem.document.close();
          }
          else
             return false;
    return content;
  }
  function setContent(elem, content)
  {
    if ( typeof elem != 'object' )
       eval("elem= " + docStr.substr(0, docStr.length-1) + ";");
    if ( !elem )
       return false;
    if (isDOM) {
       if ( elem.firstChild )
          elem.firstChild.nodeValue= content;
    }
    else
       if (isDomIE )
          elem.innerText= content;
       else
          if ( isDomNN ){
             elem.document.open();
             elem.document.write(content);
             elem.document.close();
          }
          else
             return false;
    return true;
  }
  
  function popup(url, target, param)
  {
     var win;
     param= param || "width=500, height=500, dependent=yes, location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no";
     target= target ? target.replace(/\W/g, '') : target= 'info';    
     win= window.open(url, target, param);
     win.focus();
  }
  
  // Für den Mozilla, Firefox und Opera die Höhe anpassen
 function setContentHeight(conDivIds, bodytableId, deltaHeight, minWidth, isResize)
 {
   if ( isDOM )
   {
      if ( !window.contentHeight && setContentWidthHeight() === false )
         return false;
      var conDiv,
          ids= conDivIds.split(','),
          bodytable=document.getElementById(bodytableId),
          conHeight= window.contentHeight,
          conWidth= window.contentWidth;
      if ( isResize !== true )
      {   
         if ( !window.contentHeight_calls )
         {
            window.contentHeight_calls= [];//new Array();
            document.body.onunload= new Function("if ( detailWin && !detailWin.closed) detailWin.close();");
            window.onresize= checkContentHeights;
         }
         window.contentHeight_calls['"' + conDivIds + '","' + (bodytableId || "") + '",' + (deltaHeight || "null") + ',' + (minWidth || "null")]= true;
      }
      minWidth= minWidth || 980;   
      if ( conWidth < minWidth )
      {
         if ( document.body.scroll != 'yes' )
            document.body.scroll= 'yes';
         if ( document.body.scroll == 'yes' )
            conHeight-= 20;
      }
      else
         document.body.scroll= 'no';
      if ( bodytable )
      {
         bodytable.style.height= conHeight + 'px';
         bodytable.style.maxHeight= conHeight + 'px';
         bodytable.className= bodytable.className.replace(/([ ]?jsClosed)/, '');

         var bdt= getObjW(bodytable) + 45,
             pad= 0; 
         if ( bdt > 45 && bdt < conWidth )
            pad= parseInt( (conWidth - bdt) / 2,10);
         bodytable.parentNode.style.paddingLeft= pad + 'px';

      }
      conHeight-= deltaHeight;
      if ( conHeight < 0 )
         conHeight= 0;
      for ( var i= 0; i < ids.length; i++)
      {
         conDiv=document.getElementById(ids[i]);
         if ( conDiv )
         {
            conDiv.style.height= conHeight + 'px';
            conDiv.style.maxHeight= conHeight + 'px';
         }
      }
    }
  }
  
  function setContentWidthHeight()
  {
      if (self.innerHeight)
      { 
         window.contentHeight= self.innerHeight;
         window.contentWidth= self.innerWidth;
         if ( isOp ) 
            window.contentHeight-= 5;
      }
      else if (document.documentElement && document.documentElement.clientHeight)
      {
         window.contentHeight= document.documentElement.clientHeight;
         window.contentWidth= document.documentElement.clientWidth;
      }
      else if (document.body) // other Explorers
      {
         window.contentHeight= document.body.clientHeight;
         window.contentWidth= document.body.clientWidth;
      }
      else
         return false;
      return true;
  }
  
  function checkContentHeights()
  {
      var conHeight= window.contentHeight,
          conWidth= window.contentWidth;
      setContentWidthHeight();   
      if ( conHeight == window.contentHeight && conWidth == window.contentWidth )
         return; 
      for ( var paramStr in window.contentHeight_calls ){
         try { eval('setContentHeight(' + paramStr + ',true);'); } catch (e) { }
      }   
  }
  
   function topnav(elem, over)
   {
     if(over)
        setAttr(elem, 'backgroundColor', '#C8C8C8');
     else
        setAttr(elem, 'backgroundColor', '#9B9B9B');
   }

function showCon(conID, left, top, height)
{
   hideCon();
   if ( document.onclick != hideCon )
       document.conID_onclick= document.onclick || null;
   if ( isDomNN  )
      setPos(conID, left, top);
   else
      if ( height )
         setAttr(conID, 'height', height);
   window.setTimeout("document.conID= '" + conID + "'; setAttr(document.conID, 'display', 'block');document.onclick= hideCon;", 200);
}
function hideCon()
{
   setAttr(document.conID, 'display', 'none');
   document.conID= null;
   document.onclick= document.conID_onclick || null;
}

function showHideNav(alwaysOpen, id)
{
   if ( document.getElementById )
   {
      var span= document.getElementById('e' + id),
          div= document.getElementById('s' + id),
          show= true;
      if ( span && div )
      {
         if ( alwaysOpen )
            show= (span.className.indexOf(' jsClosed') >= 0);
         else
         {
            var elem= div.parentNode.firstChild;
            while ( elem )
            {
               if ( elem.id && elem.className == "nSub" )
               {
                  if ( elem == div )
                     show= false;
                  else
                  { 
                     elem.className= elem.className + " jsClosed";
                     elem= document.getElementById('e' + elem.id.slice(1));
                     if ( elem )
                        elem.className= elem.className + " jsClosed";
                  }
                  break;
               }
               elem= elem.nextSibling;
            }
         }
         if ( show )
         {
            span.className= span.className.replace(" jsClosed", "");
            div.className= div.className.replace(" jsClosed", "");
         }
         else
         {
            span.className= span.className + " jsClosed";
            div.className= div.className + " jsClosed";
         }
      }
   }
} 

 var detailWin;
/* 
  imgUrl= die Url des Bildes
  [prevWidth]= Die Breite des Vorschaubildes oder false, wenn das Bild als Vollbild angezeigt werden soll
               default= 200
  [prevHeight]= Die Höhe des Vorschaubildes
                default= proportional zu prevWidth  
  [withDownload]= bei true wird ein DownloadButton angezeigt
*/
   function openDetail(imgUrl, prevWidth, prevHeight, withDownload)
   {
      if ( detailWin )
         detailWin.close();
      if ( !imgUrl )
         return;
      var imgUrlType = imgUrl.slice(imgUrl.lastIndexOf(".")+1).toUpperCase();
      if (imgUrlType != "JPG" && imgUrlType != "JPEG" && imgUrlType != "GIF" && imgUrlType != "PNG")
      {
        popup(imgUrl,"detail");
        return;
      }
      var start= imgUrl.indexOf("://" + location.hostname);
      if ( start > 0 )
         imgUrl= imgUrl.slice(start + 3 + location.hostname.length)
      if ( prevWidth === false )
      {
         prevWidth= "&fullImage=1"; 
         prevHeight="";
         withDownload= "";
      }
      else
      {
        if ( !prevWidth && !prevHeight )
            prevHeight= 200;
        prevWidth= prevWidth ? "&prevWidth=" + prevWidth : "";
        prevHeight= prevHeight ? "&prevHeight=" + prevHeight : "";
        withDownload= withDownload ? "&download=yes" : "";
      }
      detailWin= window.open('/media/aktion/common/imagedetail_aktionen.aspx?img=' + imgUrl
        + prevWidth + prevHeight + withDownload
        , "detail", "width=300, height=300, dependent=yes, location=no,menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no");
      if ( detailWin )
         detailWin.focus();
   }

   function openAsDownload(filename)
   {
      if ( detailWin )
         detailWin.close();
      if ( !filename )
         return;
      var start= filename.indexOf("://" + location.hostname);
      if ( start > 0 )
         filename= filename.slice(start + 3 + location.hostname.length)
      detailWin= window.open('/media/aktion/common/getFile.aspx?src=' + filename
        , "download", "width=300, height=300, dependent=yes, location=no,menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no");
      if ( detailWin )
         detailWin.focus();
   }

function showHide(id, show)
{
    var elem= getObject(id);
    if ( !elem )
       return;
    if ( show !== true && show !== false )
       show= (elem.style.display != 'block');
    elem.style.display= show ? 'block' : 'none'; 
} 

var curInfoArea= new Array(),
    curShowPicture= new Array();
function showInfoArea(id, pageID)
{
  if ( isDOM )
  {
     var info= document.getElementById(id);
     if ( !info || info == curInfoArea[pageID] )
        return;
     info.className= info.className.replace(/([ ]?jsClosed)/, '');
     if ( curInfoArea[pageID] )
        curInfoArea[pageID].className= String(curInfoArea[pageID].className.replace(/([ ]?jsClosed)/, '') + ' jsClosed').replace(/^[ ]*/, '');
     curInfoArea[pageID]= info;
  }
}

function showPictureArea(id, pageID, area)
{
  if ( isDOM )
  {
     if ( curShowPicture[pageID] )    
        curShowPicture[pageID].style.display= 'none';
     var sp= document.getElementById(id);
     if ( sp )
     {
        sp.style.display= 'block';
        if ( !sp.onclick && area.onclick )
           sp.onclick= area.onclick; 
     }
     curShowPicture[pageID]= sp;      
  }
}

function initInfoArea(parentID, showFirst, pageID)
{
  if ( isDOM )
  {
     var area= document.getElementById(parentID);
     if ( !area )
        return false;
     area= area.firstChild;
     while ( area && area.nodeType != 1 )
        area= area.nextSibling;
     if ( !area )
        return false;
     //var cnt= curInfoArea.length;
     if ( showFirst )
     {
        curInfoArea[pageID]= area;
        //area.curIndex= cnt;
        area.className= area.className.replace(/([ ]?jsClosed)/, '');
        //area= area.nextSibling;
     }
  }
}

function checkTargetLink(link)
{
  try
  {
    if (!link || !link.target || link.target == '_self')
       return;
    if ( opener.name == link.target )
       opener.focus()
    else
       self.blur();
  }
  catch (e) {}
}

function changeImage(name, url)
{
    if (document.getElementsByName(name)[0])
       document.getElementsByName(name)[0].src= url;
}
 
function highlightWord(node,word) 
{
    if (node.hasChildNodes) 
    {
        var hi_cn;
        for (hi_cn=0;hi_cn<node.childNodes.length;hi_cn++) 
            highlightWord(node.childNodes[hi_cn],word);
    }
    if (node.nodeType == 3) 
    {
       var val= node.nodeValue,
           valLower= val.toLowerCase(),
           pos= valLower.indexOf(word);
        if ( pos != -1 ) 
        {
            var par= node.parentNode,
            em= document.createElement("em");
            em.style.backgroundColor= "yellow";
            em.style.fontStyle= "normal";
            if ( pos > 0 )
               par.insertBefore(document.createTextNode(val.substr(0,pos)), node);
            else
               pos= 0;   
            em.appendChild(document.createTextNode(val.substr(pos, word.length)));   
            par.insertBefore(em, node);
            pos+= word.length;
            if ( pos < val.length )
               par.insertBefore(document.createTextNode(val.substr(pos)), node);
            par.removeChild(node);
        }
    }
}
function highlight()
{
   var sv= document.location.href.match(/\?highlight=([^&]+)/);
   if ( sv )
   {
       var words= decodeURI(sv[1].toLowerCase()).split(" "),
           word, 
           i=0,
           cnt;
       while ( i < words.length )
       {
           word= words[i];
           cnt= word.length >= 3 ? 1 : 0;
           while ( ++i < words.length )
           {
              if ( words[i].length >= 3 && ++cnt == 2 )
                 break;
              word+= ' ' + words[i];
           }
           highlightWord(document.getElementsByTagName("body")[0],word);
       }
   }
}

function initToolTip(elem)
{
  if ( docBody === false )
     docBody = (document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body? document.body : null; 
  try {
    eval("elem.tt_showToolTip= " + elem.onmouseover.toString().replace(/initToolTip\([^)]*\)/, '') + ";");
  } catch(e){elem.tt_showToolTip= null;}
  elem.onmouseover= showToolTip;
  elem.onmousemove= showToolTip;
}

function showToolTip(e) {
  e= e || window.event;
  var elem= this;
  if (!elem || !elem.href ||!e)
     return; 
  if (!elem.toolTip)
  {
     var href= elem.href.split("#");
     if ( href.length != 2 ){ return false;}  
     var anc= document.getElementsByName(href[1]);
     if ( anc.length ) elem.toolTip= anc[0].parentNode;
     if ( !elem.toolTip || elem.toolTip.nodeName != 'DIV') {elem.toolTip= null; return; } 
     if ( !elem.toolTip.toolTip )
     {
        document.body.appendChild(elem.toolTip);
        if ( curToolTip )
           hideToolTip(curToolTip.id, curToolTip.timeID);
        curToolTip = elem.toolTip;
        if (!elem.toolTip.id )
           elem.toolTip.id= new Date().getTime();
        curToolTip.className = "toolTip";
        setAttr(curToolTip,"position", "absolute");
        curToolTip.w= getObjW(elem.toolTip);
        curToolTip.h= getObjH(elem.toolTip);
        setAttr(curToolTip, "width", curToolTip.w + 'px');
        setAttr(curToolTip, "height", curToolTip.h + 'px');
        if ( isNN && isDOM ) curToolTip.style.minHeight= curToolTip.h + 'px';
        elem.toolTip.toolTip= elem.toolTip;
        elem.toolTip.onmouseout= function(e) {elem= e ? e.target : window.event.srcElement; if (elem == this ) window.setTimeout("hideToolTip('" + this.id + "', " + this.timeID + ")", 100);};
        elem.toolTip.onmouseover= function(){this.timeID= new Date().getTime(); };
     }
     if ( elem.onmouseout )
     {
        elem.tt_onmouseout= elem.onmouseout;
        elem.onmouseout= function(e) { this.tt_onmouseout(); hideToolTip(curToolTip.id); };
     }
     else    
        elem.onmouseout= hideToolTip;
     elem.onmousemove= null;
  }
  else
  { 
      if ( curToolTip )
      {
         if ( curToolTip != elem.toolTip )
            hideToolTip(curToolTip.id, curToolTip.timeID);
         else
         {
            curToolTip.timeID= null;         
            return;   
         }
      }      
  }
  if (elem.toolTip)
  {
    curToolTip = elem.toolTip;   
    var e_h = curToolTip.h - getInt(elem.toolTip.style.pixelTop || elem.toolTip.style.top || 0);
    if(typeof elem.toolTip.style.pixelHeight != "undefined") elem.toolTip.style.pixelHeight = e_h;
    else elem.toolTip.style.height = e_h+'px';
    var xlim = 0, ylim = 0; 
    if (docBody) {
          xlim = getInt(docBody.clientWidth) + getInt(window.pageXOffset || docBody.scrollLeft || 0) -    curToolTip.w - 15;
          ylim = getInt(docBody.clientHeight) +    getInt(window.pageYOffset || docBody.scrollTop || 0) - curToolTip.h;
    } else {
          xlim = getInt(window.innerWidth) + getInt(window.pageXOffset || 0) - curToolTip.w;
          ylim = getInt(window.innerHeight) + getInt(window.pageYOffset || 0) - curToolTip.h;
    }
    setObjPos(getEvX(e, xlim), getEvY(e, ylim, elem.toolTip), elem.toolTip);
    elem.toolTip.style.display = "block";
  }
  if ( elem.tt_showToolTip )
     elem.tt_showToolTip();
}
function hideToolTip(id, timeID) 
{
  var toolTip = this.toolTip || document.getElementById(id);
  if ( !toolTip )
     return; 
  if ( !timeID )
  {
     toolTip.timeID= new Date().getTime();
     window.setTimeout("hideToolTip('" + toolTip.id + "', " + toolTip.timeID + ")", 500);
     return;
  }
  if ( timeID == toolTip.timeID ) 
  {  
     toolTip.style.display = "none";
     if ( curToolTip == toolTip )
         curToolTip= null;
  }     
}
function setCookie(name, value, expires, path, domain, secure)
{
  if ( navigator.cookieEnabled == 0 )
  {
     alert('' || 'Error! You have disabled cookies');    
     return false;   
  } 
  document.cookie = name + "=" + encodeURIComponent(value)
    + ((expires && expires.toGMTString ) ? "; expires=" + expires.toGMTString() : "")
    + ((path) ? "; path=" + path : "")
    + ((domain) ? "; domain=" + domain : "")
    + ((secure) ? "; secure" : "");
  return true;
}
function makeExpires(days, hours, sec)
{
  days= isNaN(days) ? 1 : days;
  hours= isNaN(hours) ? 1 : hours;
  sec= isNaN(sec) ? 1 : sec;
  var expire= new Date();
  expire.setTime(expire.getTime() + (days * 24 * hours * 60 * sec * 60 * 1000));
  return expire;
}
function getCookie(cookie_name)
{
  var ret;
  eval('ret= document.cookie.match(/\\b' + cookie_name.replace('/', '\\/') + '=([^;]*)/);');
  if ( ret != null )
     return decodeURIComponent(ret[1]);
  return '';
}
window.contentReady= new (function contentReday()
{
   this.isReday= false;
   this.f= Array();
   this.ready= function(){window.contentReady.isReady= true;for(var i=0; i < window.contentReady.f.length; i++ ) window.contentReady.f[i]();window.contentReady.f= Array(); }
   this.add= function(func){if (this.isReady) func(); else this.f[this.f.length]= func;}
   this.init= function() {
       if ( document.addEventListener && !isOp )
           document.addEventListener( "DOMContentLoaded", window.contentReady.ready, false );
       else if ( isIE && window == top ) (function(){
           if (window.contentReady.isReady) return;
           try { document.documentElement.doScroll("left");} catch( error ) { setTimeout( arguments.callee, 0 ); return;}
           window.contentReady.ready();
       })();
       else if ( isOp )
           document.addEventListener( "DOMContentLoaded", function () {
               if (window.contentReady.isReady) return;
               for (var i = 0; i < document.styleSheets.length; i++)
                   if (document.styleSheets[i].disabled) { setTimeout( arguments.callee, 0 ); return; }
               window.contentReady.ready();
           }, false);
       else {if (window.addEventListener) window.addEventListener("load", window.contentReady.ready, false);else if (window.attachEvent) window.attachEvent("onload", window.contentReady.ready);else window.setTimeout("window.contentReady.ready()",5000);}
   }
})();
window.contentReady.init()  
if ( isDOM )
{
   document.write("<style>span.jsClosed { background-image:url(/media/aktion/common/sub_passiv.gif) }\n"
     + "table.jsClosed { display:none }\n"
     + "tbody.jsClosed { display:none }\n"
     + "div.jsClosed { display:none }\n"
     + "</style>")
   window.contentReady.add(highlight);
}

