//*************************************************************************
//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;
    }

//Funktionen zum Aufruf der Linkparamter-Funktion:
//Allgemeine Funktion für Contentseiten
function gothere(oldlink)
    {
        var newurl=getLkParm(oldlink);
        location.href=newurl;
    }


//Funktion zum Aufruf des TXM-Popups (openPrivateSite)
function gothereOPS(oldlink)
    {
        var newurl=getLkParm(oldlink);
        openPrivateSite(newurl);
    }
 

//Funktion für allgemeine Popups (openWin)
function gothereOW(oldlink,breite,hoehe,leiste,resz,stts)
    {
        var newurl=getLkParm(oldlink);
        callmeDaddy(newurl,breite,hoehe,leiste,resz,stts);
    }
function gothereOW2(oldlink,breite,hoehe,leiste,resz,stts,menu,loc)
    {
        var newurl=getLkParm(oldlink);
        openWin(newurl,breite,hoehe,leiste,resz,stts,menu,loc);
    }


//Funktion für allgemeine Popups ohne ScrollBars (openNoScroll)
function gothereOWNS(oldlink,breite,hoehe,leiste,resz,stts,menu,loc)
    {
        var newurl=getLkParm(oldlink);
        openNoScroll(newurl,breite,hoehe,leiste,resz,stts,menu,loc);
    }

//ENDE Funktionen für den Austausch der Linkparameter-Quellseite
//*************************************************************************
//*************************************************************************


//==================================================================================
// 21.10.04 REWRITING benutzter Funktionen zur besseren Einbindung als onClick-Attribut:
//==================================================================================

//==================================================================================
//      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);
}

//===== allg. Selektor-Weiterleitung =====
function selectTo(formname){
    var menu=document.forms[formname].selector.selectedIndex;
    var link=document.forms[formname].selector.options[menu].value.split('|')[0];
    var target=document.forms[formname].selector.options[menu].value.split('|')[1];
    if (document.forms[formname].selector.options[menu].value != '#'){
      if (target=="blank") XgothereOW(link,800,600,1,1,1,1,1,1);
      else Xgothere(link);
    }
    return false;
}

// Neueinfuegung Mai 2006

//==================================================================================
//      FensterOeffnen - spezielle PopUp-Funktion (620x530)
//==================================================================================
function FensterOeffnen (Adresse) {
  Fenster1 = window.open(Adresse, "Zweitfenster", "width=620,height=530,left=100,top=200,resizable=yes,scrollbars=yes");
  Fenster1.focus();
}
//==================================================================================
//      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);
            }
			
//==================================================================================
//      Formular in neuem Fenster öffnen
//==================================================================================
		
		function openInfoServiceNewWindow (lang) {
				if (lang == "de") {
					  var url = "https://secure.deutsche-bank.de/pbc/reddotforms/pbc/bankamiz_infoservice_de";					 			
					  
					//  if(document.infoservice.email.value != "" && document.infoservice.email.value != "IhrName@Provider.de")
					// {
						  url += "?email=";
						  url += document.infoservice.email.value; // document.kontaktformular.email.value
						  //url += "&emailPermission=true";
					//  }
					  openUrl = openWin (url,800,485,0,1,1,0,0);
					  window.location.href = window.location.href;
					  return false;
				} else {
					  var url = "https://secure.deutsche-bank.de/pbc/reddotforms/pbc/bankamiz_infoservice_tr";
					  //if(document.infoservice.email.value != "" && document.infoservice.email.value != "SizinSoyadiniz@provider.de")
					  //{
						  url += "?email=";
						  url += document.infoservice.email.value;
						  //url += "&emailPermission=true";
					 // }
					  openUrl = openWin (url,800,485,0,1,1,0,0);
					  window.location.href = window.location.href;
//						   window.location.href = openUrl;
					  return false;
				}
			}			
			