/* Subnavigation start */
var lastdiv = "";
var woher;
var globalsubnavtimeout;
  
function showDropdown (woher) {  
 hideDropdown();
 lastdiv = woher;
 document.getElementById(woher).style.visibility = "visible";       
 
}
function hideDropdown() { 
 if (lastdiv != "") { 
  document.getElementById(lastdiv).style.visibility = "hidden";     
  }
}    
 
function mainout() {
 globalsubnavtimeout = setTimeout("hideDropdown()",500);
} 
function subtimeout () {
 clearTimeout(globalsubnavtimeout);
}
if (hideDropdown) document.onmouseup = hideDropdown;
/* Subnavigation ende */

function pyramidehoverhi(ebene, bereich, nummer) {
 document.getElementById(ebene).style.backgroundImage = "url(/img/over_"+bereich+"_"+nummer+".gif)";
 document.getElementById(ebene+'link').style.color = "#ffffff";
}
function pyramidehoverlo(ebene, bereich, nummer) {
 document.getElementById(ebene).style.backgroundImage = "url(/img/normal_"+bereich+"_"+nummer+".gif)";
 document.getElementById(ebene+'link').style.color = "#004F9D"; 
}

/* Dient dazu die divs und den Pfeil in der Finanzpyramide einzublenden */
function pfeilon(id){
 document.getElementById(id).style.visibility = "visible"; 
}
function pfeiloff(id){
 document.getElementById(id).style.visibility = "hidden"; 
}


//==================================================================================
//      openWin - allgemeine PopUp-Funktion
//==================================================================================
        var PopUp;
        function openWin (link,breite,hoehe,leiste,resz,stts,menu,loc)
            {
            var werte = 'width=' + breite + ',height=' + hoehe + ',scrollbars=yes ,toolbar=' + leiste + ',resizable='+ resz +',status=' + stts +',menubar=' + menu + ',location=' + loc;
            PopUp = window.open(link,'Deutsche_Bank',werte);
            }

/*+++++ Uebergabe-Parameter abfragen +++++*/
function getParam(lookfor) {
 var stringfound="";
 var querystring = window.location.search.substr(1, window.location.search.length - 1);
 var params = querystring.split("&");
 var thisparam;
 for(var i = 0; i < params.length; i++) {
  thisparam = params[i].split("=");
  if (thisparam[0] == lookfor && thisparam.length == 2){
   stringfound = thisparam[1];
   break;
  }
 }
 return stringfound;
}
/*+++++ +++++*/


//==================================================================================
//      XopenWin - allgemeine PopUp-Funktion
//==================================================================================
function XopenWin (Xlink,Xwidth,Xheight,Xscrollbars,Xstatus,Xresizable,Xtoolbar,Xmenubar,Xlocation,Xname) {
 var PopUp;
 var werte = 'width='+Xwidth+',height='+Xheight+',scrollbars='+Xscrollbars+',status='+Xstatus+',resizable='+Xresizable+',toolbar='+Xtoolbar+',menubar='+Xmenubar+',location='+Xlocation;
 if (!Xname){ var Xname="Deutsche_Bank"; }
 PopUp = window.open(Xlink,Xname,werte);
 PopUp.focus();
 return false;
}
//==================================================================================
//      Xgothere
//==================================================================================
//Funktionen zum Aufruf der Linkparamter-Funktion:
//Allgemeine Funktion für Contentseiten
function Xgothere(oldlink) {
 var newurl=getLkParm(oldlink);
 location.href=newurl;
 return false;
}
function XgothereOW(Xlink,Xwidth,Xheight,Xscrollbars,Xstatus,Xresizable,Xtoolbar,Xmenubar,Xlocation,Xname) {
 var newurl=getLkParm(Xlink);
 top.window.name='daddy';
 return XopenWin(newurl,Xwidth,Xheight,Xscrollbars,Xstatus,Xresizable,Xtoolbar,Xmenubar,Xlocation,Xname);
}
function XgothereOW2(Xlink,Xwidth,Xheight,Xscrollbars,Xstatus,Xresizable,Xtoolbar,Xmenubar,Xlocation,Xname) {
 var newurl=getLkParm(Xlink);
 return XopenWin(newurl,Xwidth,Xheight,Xscrollbars,Xstatus,Xresizable,Xtoolbar,Xmenubar,Xlocation,Xname);
}


//*************************************************************************
//START Funktionen für den Austausch der Linkparameter-Quellseite
//takes url string and extracts file name without ext
function getCurrPage()
    {
        var pagearray = location.href.split("/"); //split on slash to get file name
        var page = pagearray[pagearray.length - 1] //get last array element
        var parmname = page.substring(0,page.indexOf('.')); //get everything before "."
        return parmname;
    }
 
/*swaps out page-link-parm with current page name by getting url string parameters, finding the "link=" 
   parameter; splitting it on "-" and getting the second element, which is the page name. It then replaces
   the old page name with the new page name in the original url string and returns it to the calling function*/
function getLkParm(oldlink)
    {
        var pagename=getCurrPage();
        var parmarray=oldlink.split("?")[1].split("&"); //get url parm string and build array of parms
        var i = 0;
        while ((parmarray[i].indexOf("link=")==-1) && (parmarray[i].indexOf("from-")==-1) && (i<parmarray.length))
            {
                i++ //get array index of link containing link= and from-, to ensure proper url parm
            }
        var lkparmarray=parmarray[i].split("-"); // split string on - so that from page is second array element
        var newlink=oldlink.replace((lkparmarray[0] + '-' + lkparmarray[1]),(lkparmarray[0] + '-' + pagename)) //get second array element and replace it in original string with new name
        return newlink;
    }
