﻿firstclick=0;
function firstclick_stichwort(where) {
 if (firstclick==0) {
  where.value="";
  firstclick=1;
 }
}


// TRACKING
// set path for tracking page
trackPage='';
// functions
function createRequestObject() {
    var ro;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        ro = new XMLHttpRequest();
    }
    return ro;
}
var http = createRequestObject();
function sendTrackingRequest(trackingName,trackingValue) {
    http.open('get', trackPage+'?'+trackingName+'=DEU_'+trackingValue);

//  alert(trackPage+'?'+trackingName+'=DEU_'+trackingValue);
    http.send(null);
}

function showTrackingParameters () {  //show tracking parameters in smartedit mode
   for (i = 0; i < document.getElementsByTagName('span').length; i++) {
                if (document.getElementsByTagName('span')[i].className=="trackingOn") {
                        document.getElementsByTagName('span')[i].className="trackingOff"
                 } else if (document.getElementsByTagName('span')[i].className=="trackingOff") {
                        document.getElementsByTagName('span')[i].className="trackingOn"
                 }
        }    
}


//  font size / contrast changing
function toggleContrast() {
 if (document.getElementById('contrast')) {
  if (document.getElementById('contrast').disabled==false) {
   document.getElementById('contrast').disabled=true;
   eraseCookie('contrastToggle');
  } else {
   document.getElementById('contrast').disabled=false;
   createCookie('contrastToggle','ON','1');
  }
 }
}

function change_size(whatstyle,firsttime) {
 document.getElementById('small').disabled=true;
 document.getElementById('medium').disabled=true;
 document.getElementById('large').disabled=true;
 document.getElementById(whatstyle).disabled=false;
 eraseCookie('resize_fontsize');
 createCookie('resize_fontsize',whatstyle,'1');
 if (firsttime!='first_time') {set_size_button(whatstyle);}
}
var feedsExist;
function set_feedSize() {
 sizeToSet = document.location.href.split('?')[1];
 if (sizeToSet) {
     document.getElementById('small').disabled=true;
     document.getElementById('medium').disabled=true;
     document.getElementById('large').disabled=true;
     document.getElementById(sizeToSet).disabled=false;
 }
}

function set_size_button(new_style) {

 document.getElementById('button_small').style.backgroundImage="url(/hongkong/images/schriftgroesse_bg.gif)";
 document.getElementById('button_medium').style.backgroundImage="url(/hongkong/images/schriftgroesse_bg.gif)";
 document.getElementById('button_large').style.backgroundImage="url(/hongkong/images/schriftgroesse_bg.gif)";
 document.getElementById('button_'+new_style).style.backgroundImage="url(/hongkong/images/schriftgroesse_bg_x.gif)";

}

var current_style;
function set_size_first_time() {
try {
 if (!readCookie('resize_fontsize')) {
   document.getElementById('small').disabled=false;
   current_style='small';
 } else {
   current_style=readCookie('resize_fontsize')
   change_size(current_style,'first_time');
 }
} catch (e) {}
try {
 if (readCookie('contrastToggle')) {
   document.getElementById('contrast').disabled=false;
 } else {
   document.getElementById("contrast").disabled=true;
 }
} catch (e) {}
}

if (document.getElementById('small')) {
    set_size_first_time();
}

// Cookie handling

function createCookie(name,value,hours)
{
 if (hours)
 {
  var date = new Date();
  date.setTime(date.getTime()+(hours*60*60*1000));
  var expires = "; expires="+date.toGMTString();
 }
 else var expires = "";
 document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name)
{
 var nameEQ = name + "=";
 var ca = document.cookie.split(';');
 for(var i=0;i < ca.length;i++)
 {
  var c = ca[i];
  while (c.charAt(0)==' ') c = c.substring(1,c.length);
  if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
 }
 return null;
}
function eraseCookie(name)
{
 createCookie(name,"",-1);
}


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


/* shows description in description div */
function showNote(posId,msg) {
    toolDisplayObj = document.getElementById(posId);
    if (toolDisplayObj) {
     toolDisplayObj.innerHTML = msg;
    }
}


// LINKING FROM OPTION LIST

function linkFromOption(what) {
  stringToSplit=document.getElementById(what).options[document.getElementById(what).selectedIndex].value
  splitTrackingName=stringToSplit.split('&$&$')[0];
  splitTrackingValue=stringToSplit.split('&$&$')[1];
  splitUrl=stringToSplit.split('&$&$')[2];
  splitTarget=stringToSplit.split('&$&$')[3];
  splitHeight=stringToSplit.split('&$&$')[4];
  splitWidth=stringToSplit.split('&$&$')[5];
  splitSroll=stringToSplit.split('&$&$')[6];
  splitResize=stringToSplit.split('&$&$')[7];
  if (splitUrl) {
      if (splitTrackingName && splitTrackingValue) {   // send tracking values to tracking function
        sendTrackingRequest(splitTrackingName,splitTrackingValue)
      }
      if (splitTarget!='_self' && splitWidth!='' && splitHeight!='') {
          popupParams='width='+splitWidth+',height='+splitHeight+',scrollbars='+splitSroll+',resizable='+splitResize;
//          height='height='+splitHeight;
//          width=',width='+splitWidth;
//          scrollbars=',scrollbars='+splitSroll;
//          resize=',resizable='+splitResize; else resize='';
//alert('"'+popupParams+'"');
          focusPopup=window.open(splitUrl,splitTarget,popupParams);
          focusPopup.focus();
      }
      else {
          focusPopup=window.open(splitUrl,splitTarget);
          focusPopup.focus();
      }
//      document.getElementById(what).selectedIndex=0;
  }
}
var firstselect;
function resetOptionList(what) {
    if (firstselect=='yes') {
        document.getElementById(what).selectedIndex=0;
        firstselect='no';
    }
    if (document.getElementById(what).selectedIndex!=0) firstselect='yes';
}

// openSesame - be sure all needed classes are define in css file
function openSesame(whatid) {
 if (document.getElementById(whatid).className=="sesameOpened") {
  document.getElementById(whatid).className="sesameClosed"
 } else {
  document.getElementById(whatid).className="sesameOpened"
 }
}


// alert function for external links
lastBoxOpened="";
function buildAlertBox(boxID,mode) {
 className=document.getElementById('xLink'+boxID).className;
 innerHTML=document.getElementById('xLink'+boxID).innerHTML;
 HREF=document.getElementById('xLink'+boxID).href;
 boxCode="<div id='externalAlert"+boxID+"' class='alertBox'>";
 boxCode=boxCode+"<span id='alertText"+boxID+"'></span>";
 boxCode=boxCode+"<br><br><a href='"+HREF+"'  target='_self' onclick=\" openCloseAlert('"+boxID+"');\">Accept</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"javascript:openCloseAlert('"+boxID+"','');\">Reject</a>";
 boxCode=boxCode+"</div>";
 boxCode=boxCode+"<a href=\"javascript:openCloseAlert('"+boxID+"','"+mode+"');\" class='"+className+"' id='modifiedLink"+boxID+"'>"+innerHTML+"</a>";
 document.getElementById('fLink'+boxID).innerHTML=boxCode;
}
function openCloseAlert(alertId,mode) {
    if (document.getElementById('externalAlert'+alertId).style.display=='block') {
        document.getElementById('alertText'+alertId).innerHTML="";
        document.getElementById('fLink'+alertId).style.zIndex='1';
        document.getElementById('externalAlert'+alertId).style.display='none';
        document.getElementById('externalAlert'+alertId).style.left='0px';
        document.getElementById('externalAlert'+alertId).style.top='0px';
        lastBoxOpened="";
    } else {
        if (lastBoxOpened!="") {
            openCloseAlert(lastBoxOpened);
        }
        alertText="";
        if (mode=="external") alertText="Please read these conditions carefully before proceeding.  For purposes of this agreement for Hong Kong investors, &quot;Professional Investor&quot; refers to entities defined in the Securities and Futures Ordinance (Chapter 571 of the Laws of Hong Kong).<BR><BR>This is for informational purposes only is not the basis for any contract to deal in any security or instrument, or for Deutsche Bank AG (“DB”), any entity within the Deutsche Asset Management (“DeAM”) group, or their affiliates to enter into or arrange any type of transaction as a consequence of any information contained here.  This shall not be construed as the making of any offer or invitation to anyone in any jurisdiction in which such offer is not authorised or in which the person making such offer is not qualified to do so or to anyone to whom it is unlawful to make such an offer.<BR><BR>The information reflects prevailing market conditions and our judgment as of this date, which are subject to change.  We have relied upon and assumed without independent verification, the accuracy and completeness of all information available from public sources.  We consider the information in this update to be accurate, but we do not represent that it is complete and it should be construed as investment advice.  This is for informational purposes only and sets forth our views as of this date.  The underlying assumptions and these views are subject to change without notice.  Hypothetical figures are used for illustrative purposes and not indicative of the actual returns.<BR><BR>Certain information may constitute forward-looking statements.  Due to various risks, uncertainties and assumptions made in our analysis, actual events or results or the actual performance of the markets covered may differ materially from those described.  There can be no certainty that events will turn out as we have opined herein.<BR><BR>Investments are subject to risks, including possible loss of principal amount invested.  Past performance or any prediction or forecast is not necessarily indicative of future performance.  No assurance is given that the investment objective or the targets will be met.  This information does not constitute investment advice or recommendation and was prepared without regard to the specific objectives, financial situation or needs of any particular person who may receive it.  Investors should study all relevant information and consider whether the investment is appropriate for them.<BR><BR>Past performance is not indicative of future results.  No representation or warranty is made as to the efficacy of any particular strategy or the actual returns that may be achieved.";
        if (mode=="internal") alertText="&Uuml;ber diesen Link verlassen Sie die Internetseiten der Deutsche Bank und erreichen die Webseite eines anderen Anbieters der Deutsche Bank Gruppe. Der Zugriff auf die neue Webseite kann eigenst&auml;ndigen, von der bisherigen Seite abweichenden Zugangs- sowie Nutzungsbedingungen unterliegen.";
        document.getElementById('alertText'+alertId).innerHTML=alertText;
        document.getElementById('fLink'+alertId).style.zIndex='9999';
        document.getElementById('externalAlert'+alertId).style.display='block';
        alertBoxCoordinates('externalAlert'+alertId,mode);
        lastBoxOpened=alertId;
    }
}
//create alertBox position
function alertBoxCoordinates(objId,mode) {
 if (mode=='external') {pixelsTop=130;} else {pixelsTop=70;}
 ob = document.getElementById(objId);
 relativeRight=(580-(document.body.clientWidth-findPosX(ob)))-document.body.scrollLeft;
 relativeBottom=document.body.clientHeight-(findPosY(ob)-document.body.scrollTop);
 if (relativeRight>0) {
   if (relativeRight>findPosX(ob)) relativeRight=findPosX(ob);
   ob.style.left="-"+relativeRight+"px";
  }
 if (relativeBottom<pixelsTop) {
   ob.style.top="-"+pixelsTop+"px";
 }
}
function findPosX(obj) {
 var curleft = 0;
 if (obj.offsetParent)
 {
  while (obj.offsetParent)
  {
   curleft += obj.offsetLeft
   obj = obj.offsetParent;
  }
 }
 else if (obj.x)
  curleft += obj.x;
 return curleft;
}
function findPosY(obj)
{
 var curtop = 0;
 if (obj.offsetParent)
 {
  while (obj.offsetParent)
  {
   curtop += obj.offsetTop
   obj = obj.offsetParent;
  }
 }
 else if (obj.y)
  curtop += obj.y;
 return curtop;
}
// EXTENDED REDDOT DIV OPENING


// OTHER FUNCTIONS
// 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;
}
///////////

//function is in templates