boxBuilder=0;

/* 
 * shows description in description div 
 */

function showNote(posId,msg) {
    toolDisplayObj = document.getElementById(posId);
    if (toolDisplayObj) {
     toolDisplayObj.innerHTML = msg;
    }
}

function buildToolBox(boxPosition, printURL, sendafriendOpt, bookmarkOpt, feedbackOpt) {
    if('on' == 'on') {
        if (boxBuilder==0) {
            boxBuilder++;
            document.writeln("<iframe src='/images/icons/tp.gif' id='primerToolBoxJS' frameborder=0 style='position:absolute; display:none; left:100px; top:100px; background-color:white; z-index:999999;'></iframe>");
            document.writeln("<div style='position:absolute; left:100px; top:100px; display:none; background-color:white; border:1px solid #003399; z-index:99999999;' id='ToolBoxJS'>");      
    
    
            document.writeln("   <a style='background-image: url(/images/icons/icon_close.gif); position:absolute; right:120px; top:115px; display:none' id='closeButton' class='anchorClose' href='javascript:pageActiveSwitch(\"OFF\",\"ToolBoxJS\",\"others\")'>close window</a>");
    

            document.writeln("   <iframe id='toolBoxIFrameToolBoxJS' src='/images/icons/tp.gif' style='background-color:#E1E8F3;' frameborder=NO scrolling=NO onload='document.getElementById(\"closeButton\").style.display=\"inline\";'></iframe>");
            document.writeln("</div>");
         }
        extraPadding="";
        if (boxPosition=="bottom")
            extraPadding=" padding-top:10px;";
        document.writeln("<div style='width:192px; float:right; margin-bottom:-20px; "+extraPadding+"'>");
        document.write("<div id='ToolBarNote_"+boxPosition+"' class='ToolBarNote'>&nbsp;</div>");
        document.write("<div style='float:right'>");
        buttonMargin=6; 
        if (printURL != "") {
            document.write("<a href=\"javascript:openPrintPopup('"+printURL+"')\" onMouseOver='showNote(\"ToolBarNote_"+boxPosition+"\",\"Print\");' onMouseOut='showNote(\"ToolBarNote_"+boxPosition+"\",\"\")'><img src='/images/icons/print_toolbox.gif' border='0' alt='Print this page'></a>");
            buttonMargin=10; 
        }
        if (sendafriendOpt!="OFF") {
            document.write("<a href='javascript:doSendAFriend(\"ToolBoxJS\")' onMouseOver='showNote(\"ToolBarNote_"+boxPosition+"\",\"Email\");' onMouseOut='showNote(\"ToolBarNote_"+boxPosition+"\",\"\")'><img src='/images/icons/icon_sendafriend.gif' style='margin-left:"+buttonMargin+"px' border='0' alt='Recommend this page'></a>");
            buttonMargin=6; 
        }
        if (bookmarkOpt!="OFF") {
            document.write("<a href='javascript:doBookmark();' onMouseOver='showNote(\"ToolBarNote_"+boxPosition+"\",\"Bookmark\");' onMouseOut='showNote(\"ToolBarNote_"+boxPosition+"\",\"\")'><img src='/images/icons/icon_bookmark.gif' style='margin-left:"+buttonMargin+"px' border='0' alt='Add bookmark'></a>");
             buttonMargin=6; 
         }
        if (feedbackOpt!="OFF") {
            document.write("<a href='javascript:doFeedback(\"ToolBoxJS\")' onMouseOver='showNote(\"ToolBarNote_"+boxPosition+"\",\"Feedback\");' onMouseOut='showNote(\"ToolBarNote_"+boxPosition+"\",\"\")'><img src='/images/icons/icon_feedback.gif' style='margin-left:"+buttonMargin+"px' border='0' alt='Vote this page'></a>");
            buttonMargin=6; 
        }
        document.write("</div>");
        document.write("</div>");
    }
}



/* 
 * handle print click 
 */
function openPrintPopup(aURL) {
    printPopup=window.open(aURL, 'trgpopup', 'width=635,height=600,scrollbars=yes,resizable=no');
    printPopup.focus();
}



/* 
 * handle >send a friend< klick 
 */

function doSendAFriend() {
    uriAnnex=encodeURIComponent(" - "+document.getElementById("pageTitle").innerHTML);
    loadToolBoxIFrame("https://secure.deutsche-bank.de/pbc/seiteweiterempfehlen/index.jsp?lang=en&decorator=dbag&url="+window.location.href+uriAnnex,"ToolBoxJS"," 736","490");
    
    
        loadToolBoxIFrame("https://secure.deutsche-bank.de/pbc/seiteweiterempfehlen/index.jsp?lang=en&decorator=dbag&url="+window.location.href+uriAnnex,"ToolBoxJS"," 736","490");
    

}

/*
 * handle >feedback< klick 
 */

function doFeedback() {
    
    
        loadToolBoxIFrame("https://secure.deutsche-bank.de/feedbackmanager/?id=86&lang=en&decorator=dbag","ToolBoxJS","736","700");
    

}


/* 
 * handle >bookmark< klick 
 */

function doBookmark() {
    ap=navigator.appName;
    url=location.href;
    t=document.getElementById("pageTitle").innerHTML;
    if (window.sidebar) {
        window.sidebar.addPanel(t,url,'');
    } else if (window.external) {
        window.external.AddFavorite(url,t);
    } else if (window.addNet) {
        addNet(url,t);
    } else {
    
    
       alert("Your browser does not support this functionality.\nPlease add the bookmark manually.");
    

    }
}


function loadToolBoxIFrame(boxSrc,boxID,boxWidth,boxHeight) {
   document.getElementById("closeButton").style.display="none";
   document.getElementById("primer"+boxID).style.width="0px";
   document.getElementById("primer"+boxID).style.height="0px";
   document.getElementById("toolBoxIFrame"+boxID).style.width="0px";
   document.getElementById("toolBoxIFrame"+boxID).style.height="0px";
   document.getElementById("toolBoxIFrame"+boxID).src=boxSrc;
   document.getElementById("toolBoxIFrame"+boxID).style.width=boxWidth+"px";
   document.getElementById("toolBoxIFrame"+boxID).style.height=boxHeight+"px";
   document.getElementById("primer"+boxID).style.width=boxWidth+"px";
   document.getElementById("primer"+boxID).style.height=boxHeight+"px";
   window.scrollTo(100, 100);
   pageActiveSwitch('ON',boxID,'others');
}

// BLUE BACKGROUND
var pageIsInactive;
hiddenIFrames = new Array();
function pageActiveSwitch(toggle,movieID,mode) {
    if (toggle=="ON") {
        if (mode!="others") {
            for (var i = 0; i < document.getElementsByTagName("iframe").length; i++) {
                hiddenIFrames[document.getElementsByTagName("iframe")[i].id]="";
                if (document.getElementsByTagName("iframe")[i].id!="flashBox"+movieID && getStyle(document.getElementsByTagName("iframe")[i],"display")!="none") {
                    hiddenIFrames[document.getElementsByTagName("iframe")[i].id]=getStyle(document.getElementsByTagName("iframe")[i],"display");
                    document.getElementsByTagName("iframe")[i].style.display="none";
                    if (document.getElementById("alternateImage"+document.getElementsByTagName("iframe")[i].id.split("flashBox")[1])) {
                        document.getElementById("alternateImage"+document.getElementsByTagName("iframe")[i].id.split("flashBox")[1]).style.display="block";
                    }
                }
            }
            document.getElementById("documentInactive").innerHTML="<a href='javascript:closeMovie("+movieID+",\"internal\");'><div style='height:"+(document.body.scrollHeight)+"px' class='documentInactive'></div></a>";
        } else {
            document.getElementById("documentInactive").innerHTML="<a href='javascript:pageActiveSwitch(\"OFF\",\""+movieID+"\",\"others\");'><div style='height:"+(document.body.scrollHeight)+"px' class='documentInactive'></div></a>";
            document.getElementById("primer"+movieID).style.display=document.getElementById(movieID).style.display="block";
        }
        pageIsInactive=1;
    } else {
        if (pageIsInactive==1) {
            if (mode!="others") {
                for (var i = 0; i < document.getElementsByTagName("iframe").length; i++) {
                    if (hiddenIFrames[document.getElementsByTagName("iframe")[i].id]!="") {
                        document.getElementsByTagName("iframe")[i].style.display=hiddenIFrames[document.getElementsByTagName("iframe")[i].id];
                        if (document.getElementById("alternateImage"+document.getElementsByTagName("iframe")[i].id.split("flashBox")[1])) {
                            document.getElementById("alternateImage"+document.getElementsByTagName("iframe")[i].id.split("flashBox")[1]).style.display="none";
                        }
                    }
                }
            }
            hiddenIFrames = new Array();
            document.getElementById("documentInactive").innerHTML="";
            pageIsInactive=0;
            if (mode!="others") {
                  closeMovie(movieID,"internal");
            } else {
                  document.getElementById("primer"+movieID).style.display=document.getElementById(movieID).style.display="none";
            }
        }
    }
}
function getStyle(where,whatStyle) {
 if (eval("where.style."+whatStyle)) {
    styleToGet=eval("where.style."+whatStyle);
 } else {
  try {
   styleToGet=window.getComputedStyle(where,'').getPropertyValue(whatStyle);
  } catch (a) {
   try {
    styleToGet=eval("where.currentStyle."+whatStyle);
   } catch (b) {
    styleToGet="";
   }
  }
 }
 return styleToGet;
}