var uApplicationHTTP 	= "http://www.volksbank-freiburg.de/";
var uApplicationHTTPS 	= "https://www.volksbank-freiburg.de/";
var sApplicationDomain 	= "https://www.volksbank-freiburg.de/";

// Berechnung der mittleren Contenthoehe:
function optimizeLayout(){
    var contentContainerHeight = document.getElementById("contentContainer").offsetHeight;
    contentContainerHeight = contentContainerHeight / 11;
   
    if (document.getElementById("contentDividerMiddle")) {
        document.getElementById("contentDividerMiddle").style.height = contentContainerHeight + "em"; 
        return;
    }
    if (document.getElementById("contentDividerMiddleWide")) {
        document.getElementById("contentDividerMiddleWide").style.height = contentContainerHeight + "em"; 
        return;
    }
}

function OpenPopUp(url, name, param) {
	if(!param) param = '';
	if(!url) {return false;} 
	else {
		if(!name) name = "noname";
			name 		= name + String(Math.random()).replace(/\./, "_");
		var popup 	= 'popup' + name;
		
		if ( url.indexOf("ebanking_frameset.cfm") > -1 && param.indexOf("left=") == -1 )
			param += ",left=0,top=0";
		
		popup 		= window.open(url,name,param);
		popup.focus();
		
		if ( url.indexOf("ebanking_frameset.cfm") > -1 )
			OpenPopUpEbankingInfo();
		
		if ( url.indexOf("forward_doc.cfm?doc_UUID=E70F5203304873207FD842873306915C") > -1 ) 
			OpenPopUpEbankingInfo('private');
		
		if ( url.indexOf("forward_doc.cfm?doc_UUID=F84FD24F304873207FCC44E270193003") > -1 )
			OpenPopUpEbankingInfo('business');
			
		if ( url.indexOf("forward_doc.cfm?doc_UUID=A82BB57F304875DA97A9C6FF543753DF") > -1 )
			OpenPopUpEbankingInfo('eBankingPrivateEdition');
	}
} 

function OpenPopUpEbankingInfo(sTyp) {
	if(!sTyp) sTyp = 'private';
	var uHref 		= "";
	var sName 		= "ebinfo";
	var sParams 	= "left=812,top=0,width=320,height=585,toolbar=0,location=0,status=1,menuBar=0,scrollBars=1,resizable=1";
	var bShowInfo 	= false;
		
	if (sTyp == "private") {
		uHref = uApplicationHTTPS + "ebanking_popup.cfm?" + sSID;
		if ( screen.availWidth >= 1024 ) {
			bShowInfo 	= true;
			if ( screen.availWidth == 1024 ) 
				sParams = "left=812,top=0,width=200,height=585,toolbar=0,location=0,status=1,menuBar=0,scrollBars=1,resizable=1";
		}	
	}
		 
	if( sTyp == "business" ) {
		if ( typeof(bPopUp_eBankingBusiness) == "undefined" || bPopUp_eBankingBusiness ) {
			uHref 		= uApplicationHTTPS + "page.cfm?id=911&" + sSID;
			if ( screen.availWidth > 1024 ) 
				sParams = "left=1024,top=0,width=250,height=660,toolbar=0,location=0,status=1,menuBar=0,scrollBars=1,resizable=1";
			else
				sParams = "left=0,top=420,width=340,height=340,toolbar=0,location=0,status=1,menuBar=0,scrollBars=1,resizable=1";
			bShowInfo 	= true;
		}
	}
	
	if( sTyp == "eBankingPrivateEdition" ) {
		if ( typeof(bPopUp_eBankingPrivateEdition) == "undefined" || bPopUp_eBankingPrivateEdition ) {
			uHref 		= uApplicationHTTPS + "page.cfm?id=1891&" + sSID;
			if ( screen.availWidth > 1024 ) 
				sParams = "left=1024,top=0,width=250,height=660,toolbar=0,location=0,status=1,menuBar=0,scrollBars=1,resizable=1";
			else
				sParams = "left=0,top=420,width=340,height=340,toolbar=0,location=0,status=1,menuBar=0,scrollBars=1,resizable=1";
			bShowInfo 	= true;
		}
	}		
		
	if ( bShowInfo ) {
		OpenPopUp(uHref, sName, sParams);
	}	
} 

function OpenPhishingWarning() {
	top.location = uApplicationHTTP + "page.cfm?id=796"; //Phishing Warnung
}



function markExternalHrefs() {
	var aLinks = document.getElementsByTagName("a");
	for (i=0; i<aLinks.length; i++) {
		if ( (aLinks[i].href.indexOf(sApplicationDomain) == -1 && aLinks[i].href.indexOf("javascript:") == -1 && aLinks[i].href.indexOf(window.location.href) == -1 && aLinks[i].href != "#") || aLinks[i].href.indexOf("forward_doc.cfm") > -1 ) {
			//if ( aLinks[i].id !== "intern" )
				aLinks[i].title = "Dies ist ein externer Link -\nFür Links auf externe Webseiten übernehmen wir trotz sorgfältiger inhaltlicher Kontrolle keine Haftung.\nFür den Inhalt der verlinkten Seiten sind ausschließlich deren Betreiber verantwortlich.";
		}
	}
}


function SetTarget(sTarget) {
	var aLinks = document.getElementsByTagName("a");
	for (i=0; i<aLinks.length; i++) 
		if (aLinks[i].href.indexOf("javascript:") == -1) 
			aLinks[i].target = sTarget;
}

function _eSCOnError() {
	return null;
}

// SCHNELLEINSTIEG
function CollapseExpand( sTriggerID, lIDs, sDefaultClassName) {
	var aIDs = lIDs.split(",");
	var i=0;
	oTrigger = document.getElementById(sTriggerID);
	if ( !oTrigger.className) 
		oTrigger.className = sDefaultClassName;

	if ( oTrigger.className == "main expand" ) {
		for ( i=0; i < aIDs.length; i++ )
			document.getElementById(aIDs[i]).style.display = "block";
		oTrigger.className = "main collapse";	
	}
	else {
		for ( i=0; i < aIDs.length; i++ )	
			document.getElementById(aIDs[i]).style.display = "none";
		oTrigger.className = "main expand";	
	}
}

// SUCHEINGABE IN CONTAINER
function startSearch( oForm){
	var bOK 	= true;
	var sOutput = "";
	var sTest 	= "";
	with( oForm ) {
		var sInput = searchstring.value;

		for( var i=0; i < sInput.length; i++) {
			if ( sInput.charCodeAt(i) != 32 )
	    		sTest += sInput.charAt(i);
			sOutput += sInput.charAt(i);
		}	

		if ( sInput.indexOf("Suchbegriff") > -1 )
			sTest = "";
		if ( sInput.indexOf("Volltextsuche") > -1 ) {
			sTest = "";
		}

		if ( sTest.length == 0 ) {
			alert("Bitte geben Sie einen Suchbegriff ein.");
			searchstring.value = "";
			searchstring.focus();
			bOK = false;
		}
		
		
		
		if ( bOK ) {
			while (sOutput.indexOf("%") > -1 ) 
				sOutput = sOutput.replace(/%/, "(percent)");
			while (sOutput.indexOf("&") > -1 ) 
				sOutput = sOutput.replace(/&/, "(amp)");
			var aRV = new Array("R+V", "r+v");
			for ( var i=0; i < aRV.length; i++ ) {
				while (sOutput.indexOf(aRV[i]) > -1 ) 
				sOutput = sOutput.replace(aRV[i], "R(plus)V");	
			}
		
			var uHref = action + "&Find=" + sOutput;
			location.href = uHref;	
		}	
	}
	return false;
}


/************************************************************************************************************
(C) www.dhtmlgoodies.com, October 2005

This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	

Updated:	
	March, 11th, 2006 - Fixed positioning of tooltip when displayed near the right edge of the browser.
	April, 6th 2006, Using iframe in IE in order to make the tooltip cover select boxes.
	
Terms of use:
You are free to use this script as long as the copyright message is kept intact. However, you may not
redistribute, sell or repost it without our permission.

Thank you!

www.dhtmlgoodies.com
Alf Magne Kalleland

************************************************************************************************************/	
var esc_tooltip = false;
var esc_tooltipShadow = false;
var esc_shadowSize = 4;
var esc_tooltipMaxWidth = 200;
var esc_tooltipMinWidth = 100;
var esc_iframe = false;
var tooltip_is_msie = (navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('opera')==-1 && document.all)?true:false;

function showTooltip(e,tooltipTxt, nWidth) {
	if (nWidth) {
		esc_tooltipMaxWidth = nWidth;
	}
	var bodyWidth = Math.max(document.body.clientWidth,document.documentElement.clientWidth) - 20;

	if(!esc_tooltip){
		esc_tooltip 			= document.createElement('DIV');
		esc_tooltip.id 			= 'esc_tooltip';
		esc_tooltipShadow 		= document.createElement('DIV');
		esc_tooltipShadow.id 	= 'esc_tooltipShadow';
		
		document.body.appendChild(esc_tooltip);
		document.body.appendChild(esc_tooltipShadow);	
		
		if(tooltip_is_msie){
			esc_iframe = document.createElement('IFRAME');
			esc_iframe.frameborder='5';
			esc_iframe.style.backgroundColor='#FFFFFF';
			esc_iframe.src = '#'; 	
			esc_iframe.style.zIndex = 100;
			esc_iframe.style.position = 'absolute';
			document.body.appendChild(esc_iframe);
		}
		
	}
	
	esc_tooltip.style.display='block';
	esc_tooltipShadow.style.display='block';
	if(tooltip_is_msie)esc_iframe.style.display='block';
	
	var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
	if(navigator.userAgent.toLowerCase().indexOf('safari')>=0)st=0; 
	var leftPos = e.clientX + 10;
	
	esc_tooltip.style.width = null;	// Reset style width if it's set 
	esc_tooltip.innerHTML = tooltipTxt;
	esc_tooltip.style.left = leftPos + 'px';
	esc_tooltip.style.top = e.clientY + 10 + st + 'px';

	
	esc_tooltipShadow.style.left =  leftPos + esc_shadowSize + 'px';
	esc_tooltipShadow.style.top = e.clientY + 10 + st + esc_shadowSize + 'px';
	
	if(esc_tooltip.offsetWidth>esc_tooltipMaxWidth){	/* Exceeding max width of tooltip ? */
		esc_tooltip.style.width = esc_tooltipMaxWidth + 'px';
	}
	
	var tooltipWidth = esc_tooltip.offsetWidth;		
	if(tooltipWidth<esc_tooltipMinWidth)tooltipWidth = esc_tooltipMinWidth;
	
	
	esc_tooltip.style.width = tooltipWidth + 'px';
	esc_tooltipShadow.style.width = esc_tooltip.offsetWidth + 'px';
	esc_tooltipShadow.style.height = esc_tooltip.offsetHeight + 'px';		
	
	if((leftPos + tooltipWidth)>bodyWidth){
		esc_tooltip.style.left = (esc_tooltipShadow.style.left.replace('px','') - ((leftPos + tooltipWidth)-bodyWidth)) + 'px';
		esc_tooltipShadow.style.left = (esc_tooltipShadow.style.left.replace('px','') - ((leftPos + tooltipWidth)-bodyWidth) + esc_shadowSize) + 'px';
	}
	
	if(tooltip_is_msie){
		esc_iframe.style.left = esc_tooltip.style.left;
		esc_iframe.style.top = esc_tooltip.style.top;
		esc_iframe.style.width = esc_tooltip.offsetWidth + 'px';
		esc_iframe.style.height = esc_tooltip.offsetHeight + 'px';
	}
}

function hideTooltip() {
	try {
		esc_tooltip.style.display='none';
		esc_tooltipShadow.style.display='none';		
		if(tooltip_is_msie)
			esc_iframe.style.display='none';		
	}
	catch(kuku){}		
}