// Browser Detection
isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
NS4 = (document.layers) ? true : false;
isIE = (document.all ? true : false);
IEmac = (isIE && isMac) ? true : false;
IE4plus = (document.all) ? true : false;
IE4 = (isIE && (navigator.appVersion.indexOf("MSIE 4.")!=-1)) ? true : false;
ver4 = (NS4 || IE4plus) ? true : false;
isDOM = (document.getElementById ? true : false);

//Load CSS
if (navigator.appName == 'Netscape')
	if (parseInt(navigator.appVersion) <= 4)
		document.write("<link rel='stylesheet' type='text/css' href='/_data/media_layout/vontobel/ns4x.css'>");
	else
		document.write("<link rel='stylesheet' type='text/css' href='/_data/media_layout/vontobel/ns5up.css'>");
//else
	//document.write("<link rel='stylesheet' type='text/css' href='/_data/media_layout/vontobel/ie.css'>");

// Support for multiple onload functions
var aSafeOnload = new Array();
function addSafeOnload(func) {
	if (IEmac && IE4) { // IE 4.5 for Mac blows out on testing window.onload
		window.onload = SafeOnload;
		aSafeOnload[aSafeOnload.length] = func;
	}
	else if  (window.onload) {
		if (window.onload != SafeOnload) {
			aSafeOnload[0] = window.onload;
			window.onload = SafeOnload;
		}		
		aSafeOnload[aSafeOnload.length] = func;
	} else {
		window.onload = func;
	}
}
function SafeOnload() {
	for (var i=0; i<aSafeOnload.length; i++)
		aSafeOnload[i]();
}
// mouseover functionality
function NavElement(menu,imgOver,extended) {
	this.MenuImg = eval('document.menu_'+menu);
	this.ImageOut = this.MenuImg.src;
	(new Image).src = imgOver;
	this.ImageOver = imgOver;
	function MouseEvent(event) {
		this.MenuImg.src = this['Image'+event];
		if (extended) {
			var MenuExtImg = eval('document.menu_'+menu+'ext');
			if (event == 'Over')
				MenuExtImg.src = 'empty';
			else
				MenuExtImg.src = 'empty';
		}
	}
	this.MouseEvent = MouseEvent;
}		
function submitToPopup(formToSubmit,winName,winWidth,winHeight) {
	PrintWindow = window.open("",winName,"width="+winWidth+",height="+winHeight+",resizable=no,scrollbars=yes,status=yes");
	formToSubmit.submit();
	PrintWindow.focus();
}
function OpenWindow(url,name) {
 window.open(url,name,"width=630,height=500,left=100,top=100,scrollbars=yes,status=yes");
}
function LegalCheck(myFormId) {
	myForm = eval('document.' + myFormId);
	if (myForm.nation[2].checked && !(myForm.legal_domizil.options[7].selected)) {
		if (myForm.legal_domizil.options[0].selected) {
			alert('Bitte wählen Sie Ihr Domizil aus.');
			return;
		} else {
			myForm.action = 'invest_funds_discl.html';
	 		myForm.submit();
		}
	} else {
		myForm.action = 'invest_funds_na.html';	
	 	myForm.submit();
	}	
}	

function closeWinAfterTimeout() {
	window.setTimeout('window.close()',5000);
}

// submit search only once
var v_search_submitted=false;
function checkSearchSubmit() {
	if (!v_search_submitted) {
		v_search_submitted=true;
		return true;
	} else
		return false;
}

/******************************/
/* Back to top implementation */
/******************************/
var b2tLayerName	= 'b2t';
var positionerName	= 'positioner';
var	b2tPic			= '<img src="/_data/media_layout/vontobel/icon_back_to_top.gif" border="0">';
		
function getOffsetPos(element,which) {
	vPos = 0;
	while (element != null) {
		vPos		+=	element["offset" + which];
		element	=		element.offsetParent;
	}
	return vPos;
}
function back2top() {
	if (isIE) {
		myItemStyle = document.all[b2tLayerName].style;
		myPositioner = document.all[positionerName];				
		if (getOffsetPos(myPositioner,"Top") + myPositioner.height > document.body.offsetHeight)
			myItemStyle.visibility = 'visible';
		else
			myItemStyle.visibility = 'hidden';
	} else {
		if (isDOM) {
			myItemStyle = document.getElementById(b2tLayerName).style;
			myPositioner = eval('document.'+positionerName);
			if (getOffsetPos(myPositioner,"Top") + myPositioner.height > window.innerHeight)
 				myItemStyle.visibility = 'visible';
			else
 				myItemStyle.visibility = 'hidden';
		} else {
			myItemStyle = eval('document.'+b2tLayerName);
			myPositioner = document.images[positionerName];
			if (myPositioner.y + myPositioner.height > window.innerHeight)
				myItemStyle.visibility = 'show';
			else
				myItemStyle.visibility = 'hide';	
		}
	}
}