/* Flashdetect */
/*
Copyright (c) Copyright (c) 2007, Carl S. Yestrau All rights reserved.
Code licensed under the BSD License: http://www.featureblend.com/license.txt
Version: 1.0.3
*/
var FlashDetect=new function(){var self=this;self.installed=false;self.raw="";self.major=-1;self.minor=-1;self.revision=-1;self.revisionStr="";var activeXDetectRules=[{"name":"ShockwaveFlash.ShockwaveFlash.7","version":function(obj){return getActiveXVersion(obj);}},{"name":"ShockwaveFlash.ShockwaveFlash.6","version":function(obj){var version="6,0,21";try{obj.AllowScriptAccess="always";version=getActiveXVersion(obj);}catch(err){}
return version;}},{"name":"ShockwaveFlash.ShockwaveFlash","version":function(obj){return getActiveXVersion(obj);}}];var getActiveXVersion=function(activeXObj){var version=-1;try{version=activeXObj.GetVariable("$version");}catch(err){}
return version;};var getActiveXObject=function(name){var obj=-1;try{obj=new ActiveXObject(name);}catch(err){}
return obj;};var parseActiveXVersion=function(str){var versionArray=str.split(",");return{"raw":str,"major":parseInt(versionArray[0].split(" ")[1],10),"minor":parseInt(versionArray[1],10),"revision":parseInt(versionArray[2],10),"revisionStr":versionArray[2]};};var parseStandardVersion=function(str){var descParts=str.split(/ +/);var majorMinor=descParts[2].split(/\./);var revisionStr=descParts[3];return{"raw":str,"major":parseInt(majorMinor[0],10),"minor":parseInt(majorMinor[1],10),"revisionStr":revisionStr,"revision":parseRevisionStrToInt(revisionStr)};};var parseRevisionStrToInt=function(str){return parseInt(str.replace(/[a-zA-Z]/g,""),10)||self.revision;};self.majorAtLeast=function(version){return self.major>=version;};self.FlashDetect=function(){if(navigator.plugins&&navigator.plugins.length>0){var type='application/x-shockwave-flash';var mimeTypes=navigator.mimeTypes;if(mimeTypes&&mimeTypes[type]&&mimeTypes[type].enabledPlugin&&mimeTypes[type].enabledPlugin.description){var version=mimeTypes[type].enabledPlugin.description;var versionObj=parseStandardVersion(version);self.raw=versionObj.raw;self.major=versionObj.major;self.minor=versionObj.minor;self.revisionStr=versionObj.revisionStr;self.revision=versionObj.revision;self.installed=true;}}else if(navigator.appVersion.indexOf("Mac")==-1&&window.execScript){var version=-1;for(var i=0;i<activeXDetectRules.length&&version==-1;i++){var obj=getActiveXObject(activeXDetectRules[i].name);if(typeof obj=="object"){self.installed=true;version=activeXDetectRules[i].version(obj);if(version!=-1){var versionObj=parseActiveXVersion(version);self.raw=versionObj.raw;self.major=versionObj.major;self.minor=versionObj.minor;self.revision=versionObj.revision;self.revisionStr=versionObj.revisionStr;}}}}}();};FlashDetect.release="1.0.3";
/* End flash detect */
/* Crypt emails */
function processEmail(element,encrypt)
{var temp;var enc_temp;var dec_temp;if(encrypt)
{temp=element.href.substring(7,element.href.length)
enc_temp=b64d2t(utf8t2d(temp));element.href="mailto:"+enc_temp;return element.href;}
else
{temp=element.href.substring(7,element.href.length);dec_temp=utf8d2t(b64t2d(temp));element.href="mailto:"+dec_temp;return element.href;}}
function b64t2d(t)
{var b64s='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';b64=new Array();f64=new Array();for(var i=0;i<b64s.length;i++)
{b64[i]=b64s.charAt(i);f64[b64s.charAt(i)]=i;}
var d=[];var i=0;t=t.replace(/\n|\r/g,"");t=t.replace(/=/g,"");while(i<t.length)
{d[d.length]=(f64[t.charAt(i)]<<2)|(f64[t.charAt(i+1)]>>4);d[d.length]=(((f64[t.charAt(i+1)]&15)<<4)|(f64[t.charAt(i+2)]>>2));d[d.length]=(((f64[t.charAt(i+2)]&3)<<6)|(f64[t.charAt(i+3)]));i+=4;}
if(t.length%4==2)
d=d.slice(0,d.length-2);if(t.length%4==3)
d=d.slice(0,d.length-1);return d;}
function b64d2t(d)
{var b64s='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';b64=new Array();f64=new Array();for(var i=0;i<b64s.length;i++)
{b64[i]=b64s.charAt(i);f64[b64s.charAt(i)]=i;}
var r=new Array;var i=0;var dl=d.length;if((dl%3)==1)
{d[d.length]=0;d[d.length]=0;}
if((dl%3)==2)
d[d.length]=0;while(i<d.length)
{r[r.length]=b64[d[i]>>2];r[r.length]=b64[((d[i]&3)<<4)|(d[i+1]>>4)];r[r.length]=b64[((d[i+1]&15)<<2)|(d[i+2]>>6)];r[r.length]=b64[d[i+2]&63];if((i%57)==54)
r[r.length]="\n";i+=3;}
if((dl%3)==1)
r[r.length-1]=r[r.length-2]="=";if((dl%3)==2)
r[r.length-1]="=";var t=r.join("");return t;}
function utf8t2d(t)
{var b64s='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';b64=new Array();f64=new Array();for(var i=0;i<b64s.length;i++)
{b64[i]=b64s.charAt(i);f64[b64s.charAt(i)]=i;}
t=t.replace(/\r\n/g,"\n");var d=new Array;var test=String.fromCharCode(237);if(test.charCodeAt(0)<0)
for(var n=0;n<t.length;n++)
{var c=t.charCodeAt(n);if(c>0)
d[d.length]=c;else
{d[d.length]=(((256+c)>>6)|192);d[d.length]=(((256+c)&63)|128);}}
else
for(var n=0;n<t.length;n++)
{var c=t.charCodeAt(n);if(c<128)
d[d.length]=c;else if((c>127)&&(c<2048))
{d[d.length]=((c>>6)|192);d[d.length]=((c&63)|128);}
else
{d[d.length]=((c>>12)|224);d[d.length]=(((c>>6)&63)|128);d[d.length]=((c&63)|128);}}
return d;}
function utf8d2t(d)
{var b64s='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';b64=new Array();f64=new Array();for(var i=0;i<b64s.length;i++)
{b64[i]=b64s.charAt(i);f64[b64s.charAt(i)]=i;}
var r=new Array;var i=0;while(i<d.length)
{if(d[i]<128)
{r[r.length]=String.fromCharCode(d[i]);i++;}
else if((d[i]>191)&&(d[i]<224))
{r[r.length]=String.fromCharCode(((d[i]&31)<<6)|(d[i+1]&63));i+=2;}
else
{r[r.length]=String.fromCharCode(((d[i]&15)<<12)|((d[i+1]&63)<<6)|(d[i+2]&63));i+=3;}}
return r.join("");}
/* End crypt emails */

function getWindowHeight()
{
  var myWidth = 0, myHeight = 0;
if (typeof( window.innerWidth ) == 'number' ) {
 //Non-IE    
  myWidth = window.innerWidth;    
  myHeight = window.innerHeight;  
} 
else if
( 
  document.documentElement && ( document.documentElement.clientWidth ||  document.documentElement.clientHeight ) )
{
 //IE 6+ in 'standards compliant mode'    
 myWidth = document.documentElement.clientWidth;    
 myHeight = document.documentElement.clientHeight;  
} 
else if
( 
 document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
 {    
 //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;  
}
  return (myHeight);
}

/* Pressesuche in den Presse-Crossteasern */
function SearchPresse(languageVar)
{
  if (languageVar == 'de') {
    window.location.href = '/web/cms/de/113452/presse-news/pressearchiv/?suchbegriff=' + $('#pq').val();
  }
  else if (languageVar == 'en') {
    window.location.href = '/web/cms/en/113452/presse-news/pressearchiv/?suchbegriff=' + $('#pq').val();
  }
  return false;
}

//Shadowbox_load
$(window).load(function(){
    var options = {
        handleOversize: 'resize',
        handleUnsupported:  'remove',
        counterType:  'skip',
        autoplayMovies:true
        
    };
    Shadowbox.init(options);
});

/* Tooltip-Funktion */
function showTooltip(areaId) {
 xOffset = -20;
 yOffset = 20;
 areaId.content = $('div.'+ areaId.getAttribute("id")).html();
 $("body").append("<div id='tooltip'>" + areaId.content +"</div>");

 $('map').mousemove(function(e){
 varTop=e.pageY - xOffset - $('#tooltip').height();
 varLeft=e.pageX+yOffset;
 $("#tooltip").css("top",(varTop) + "px").css("left",(varLeft) + "px");
});
};
function hideTooltip(areaId){
 $("#tooltip").remove();
};

/* Diese Funktion wird für die Kombibox-Funktionalität genutzt, um die CrossTeaser aus- und einzublenden */
function showMe( divToShow )
{
  $('#switchTeaser > div').addClass('hidden');
  $('#' + divToShow ).removeClass('hidden');
}

/* Leeren der Input-Felder mit der ID pq beim Klick
 * Initialwert wird zwischengespeichert und wieder in das 
 * Feld geschrieben, wenn der Cursor das leere Feld verlässt
 */
$(document).ready(function(){
  var initial = $('#pq').attr('value');
$('#pq').click(function() {
  if ($('#pq').attr('value')==initial) {
    $('#pq').attr('value','');
  }
  $('#pq').blur(function() {
    if ($('#pq').attr('value')=='') {
      $('#pq').attr('value',initial);
    }
  });
});
/* Funktion zur Darstellung von Flash, das die Seite überlagert. Das entsprechende Div wird sichtbar / unsichtbar gesetzt */
$('#startOverlayFlash').click( function() {
 $('#flashContainer').removeClass('hidden');
});
$('#stopOverlayFlash').click( function() {
 $('#flashContainer').addClass('hidden');
});
$('#CompanyList').bind('mouseenter',function(){
   $('ul',this).removeClass('hidden');
   }).bind('mouseleave',function(){
   $('ul',this).addClass('hidden');
});

/* Funktion für den MouseOver-Effekt in der KombiBox: Feststellen des "semiactive"-Status sowie switchen der CrossTeaser */
$('#teaserMenu li').bind('mouseenter',function() {
      $('#teaserMenu li').removeClass('semiactive');
  if ( $(this).addClass('semiactive').hasClass('active') )
    $('#teaserMenu .active').removeClass('inactive');
      else
    $('#teaserMenu .active').addClass('inactive');
      showMe( $(this).find('a').attr('class') );
   });

$('.dynamic > li > ul').toggle();
$('.dynamic > li.open > ul').toggle();
$('.dynamic > li > a').click( function() {
 $(this).parent().find('ul').slideToggle();
});
$("#flyout").accordion({ header: 'dt', animated: 'easeslide', selectedClass: 'active', active: '.selected', autoheight: false});
});

/*
*
* Typische RWE-Funktionen
*
*
*/
/* OpenWindow*/
function OpenCustomWindow(sUrl, sName, nWidth, nHeight, bScrollBars, bToolBar, bLocation, bResizable, bMenuBar, bStatus, nX, nY) {
 if ((typeof nWidth == 'undefined') || (nWidth == null) || (nWidth=='0')) nWidth = 800;
 if ((typeof nHeight == 'undefined') || (nHeight == null)|| (nHeight=='0'))  nHeight = 600;
 if ((typeof bScrollBars == 'undefined') || (bScrollBars == null)) bScrollBars = false;
 if ((typeof bToolBar == 'undefined') || (bToolBar == null)) bToolBar = false;
 if ((typeof bLocation == 'undefined') || (bLocation == null)) bLocation = false;
 if ((typeof bResizable == 'undefined') || (bResizable == null)) bResizable = false;
 if ((typeof bMenuBar == 'undefined') || (bMenuBar == null)) bMenuBar = false;
 if ((typeof bStatus == 'undefined') || (bStatus == null)) bStatus = false;
 if ((typeof nX == 'undefined') || (nX == null)) nX = -1;
 if ((typeof nY == 'undefined') || (nY == null)) nY = -1;
 var param = "width=" + nWidth + ",height=" + nHeight
 + ",scrollbars=" + (bScrollBars ? "yes" : "no")
 + ",toolbar=" + (bToolBar ? "yes" : "no")
 + ",menubar=" + (bMenuBar ? "yes" : "no")
 + ",location=" + (bLocation ? "yes" : "no")
 + ",resizable=" + (bResizable ? "yes" : "no")
 + ",status=" + (bStatus ? "yes" : "no")
 + ((nX != -1) ? ",left=" + nX : "" )
 + ((nY != -1) ? ",top=" + nY : "" );
 var win = window.open(sUrl, sName == null ? "" : sName, param);
 try {
 win.resizeTo(nWidth, nHeight);
 }
 catch(err) {
 }
 win.focus();
 return win;
}
/* Pulldown */
function pulldownLinkChanged(list)
{
   var val = list.options[list.selectedIndex].value;
   if (!val)
   return;
   var parts = val.split('#|#');
   var url = parts[0];
   var target = parts[1];
   var script = parts[2];
   if (target == '_blank')
    window.open(url);
   else if (script)
  {
    eval(script);
  }
  else
    location.href=url;
    list.selectedIndex = 0
}


