blnOp = false;
blnIe = false;
blnIe7 = false;
blnNs = false;
//--------------------------------
function checkBrowser()
{
	if (window.opera)
	{
		blnOp = true;
	}
	else if (document.layers) 
	{
		blnNs = true;
	}
	else if (document.all)
	{
		blnIe = true;
		
		if (navigator.userAgent.indexOf('MSIE 7') > 0 || navigator.userAgent.indexOf('MSIE 8') > 0 )
		{
			blnIe7 = true;
		}
	}
}
checkBrowser();
//--------------------------------
function open_window(url, name, breite, hoehe, center, scrollbar) {
	var features = 'location=no,menubar=no,resizable=yes,status=no,toolbar=no';
	if (scrollbar == 0) {
		features += ',scrollbars=no'
	} else {
		features += ',scrollbars=yes'
	}
	if (center == 1) {
		var left = (screen.width) ? (screen.width - breite) / 2 : 100;
		var top = (screen.height) ? (screen.height - hoehe) / 2 : 100;
		features += ',left=' + left + ',top=' + top;
	}
	features += ',width=' + breite + ',height=' + hoehe;
	name = name.replace(/ /,"")
	window.open(url, name, features);
}
//--------------------------------
function changeProductpage(pageid) {
	if (pageid != '') {
		location.href = 'showpage.asp?pageid=' + pageid;
	}
}
//--------------------------------
function changeProductChart(index, time){
	
	// unterbinden, dass beim time-wechsel, der index ausgewertet wird
	if (index != actual_index)
	{
		switch(index) 
		{
			case 'product':
				document.getElementById('underlying').className = 'aktiv';
				document.getElementById('underlying_bc').className = 'show';
				document.getElementById('chart_underlying_img').src = "/images/icon_haken.gif"
				if (actual_index == 'underlying')
				{
					document.getElementById('product').className = 'aktiv';
					actual_index = 'both';
					document.getElementById('underlying_bc').className = 'noshow';
					document.getElementById('chart_product_img').src = "/images/icon_haken.gif"
				}
				else
				{
					document.getElementById('product').className = '';
					actual_index = 'underlying';
					document.getElementById('underlying_bc').className = 'show';
					document.getElementById('chart_product_img').src = "/images/icon_haken_no.gif"
				}
				break;
				
			case 'underlying':
				document.getElementById('product').className = 'aktiv';
				document.getElementById('underlying_bc').className = 'show';
				document.getElementById('chart_product_img').src = "/images/icon_haken.gif"
				if (actual_index == 'product')
				{
					document.getElementById('underlying').className = 'aktiv';
					actual_index = 'both';
					document.getElementById('underlying_bc').className = 'noshow';
					document.getElementById('chart_underlying_img').src = "/images/icon_haken.gif"
				}
				else
				{
					document.getElementById('underlying').className = '';
					actual_index = 'product';
					document.getElementById('underlying_bc').className = 'noshow';
					document.getElementById('chart_underlying_img').src = "/images/icon_haken_no.gif"
				}
				break;
			default:
				break;
		}
	}
	else if (time == actual_time)
	{
		if (index == 'product')
		{
			actual_index = 'underlying';
			document.getElementById('underlying_bc').className = 'show';
			document.getElementById('chart_product_img').src = "/images/icon_haken_no.gif"
			document.getElementById('chart_underlying_img').src = "/images/icon_haken.gif"
		}
		else if(index == 'underlying')
		{
			actual_index = 'product';
			document.getElementById('underlying_bc').className = 'noshow';
			document.getElementById('chart_product_img').src = "/images/icon_haken.gif"
			document.getElementById('chart_underlying_img').src = "/images/icon_haken_no.gif"
		}
		document.getElementById(index).className = '';
		document.getElementById(actual_index).className = 'aktiv';
	}
	document.getElementById(actual_time).className = '';
	document.getElementById(time).className = 'emphased';
	document.getElementById(actual_time+'Perf').className = '';
	document.getElementById(time+'Perf').className = 'emphased';
	actual_time = time;
	document.images['produktdetail_chart_img'].src = chartLinks[actual_index][time];
}
//--------------------------------
function changeUnderlyingChart(time){
	document.getElementById(actual_time).className = '';
	document.getElementById(time).className = 'emphased';
	actual_time = time;
	document.images['produktdetail_chart_img'].src = chartLinks['underlying'][time];
}
//--------------------------------
function changeBasiswertBox(divId){
	for (var i = 0; i < boxes.length; i++) {
		if (boxes[i] != divId) {
			document.getElementById('chart' + boxes[i]).style.display = 'none';
		}
		else {
			document.getElementById('chart' + boxes[i]).style.display = 'block';
		}
	}
}
//--------------------------------
function changeBasiswertBeschreibungBox(divId){
	var x;
	for (var i = 0; i < boxes.length; i++) {
		if (boxes[i] != divId) {
			x = document.getElementById('beschreibung' + boxes[i]);
			if (x != null) {
				x.style.display = 'none';
			}
		}
		else {
			x = document.getElementById('beschreibung' + boxes[i]);
			if (x != null) {
				x.style.display = 'block';
			}
		}
	}
}
//--------------------------------
function changeBasiswertCharts(time, idx, img){
	$(basiswert_actual_time[idx] + idx).className = '';
	$(time + idx).className = 'emphased';
	basiswert_actual_time[idx] = time;
	document.images[img].src = basiswert_chartLinks[idx][time];
}
//--------------------------------
function changeFondsChart(time){
	// unterbinden, dass beim time-wechsel, der index ausgewertet wird
	if (time != actual_time)
	{
		if(document.getElementById(actual_time) != null){document.getElementById(actual_time).className = '';}
		if(document.getElementById(time) != null){document.getElementById(time).className = 'emphased';}
		if(document.getElementById(actual_time + '_perf') != null){document.getElementById(actual_time + '_perf').className = ''}
		if(document.getElementById(time + '_perf') != null){document.getElementById(time + '_perf').className = 'emphased';}
		actual_time = time;
		document.images['fondsdetail_chart_img'].src = chartLinks[actual_index][time];
	}
}
//--------------------------------
function changeIRLayer(currency) {
	document.getElementById(actual_currency + '_link').className = '';
	document.getElementById(currency + '_link').className = 'aktiv';
	document.getElementById(actual_currency + '_layer').style.visibility = 'hidden';
	document.getElementById(currency + '_layer').style.visibility = 'visible';
	actual_currency = currency;
}
//--------------------------------
function setServerDate() {
	var actualClientTime = new Date();
	var elapsedTime = actualClientTime.getTime()-clientTime.getTime();
	actualServerTime = serverTime.getTime()+elapsedTime;
	setTimeout('setServerDate()',1000);
}
//--------------------------------
function clock(city,zone,showAmOrPm) {
	var digital = new Date(actualServerTime);
	var hours 	= digital.getHours() + parseInt(zone) + parseInt(sZone);
	var minutes = digital.getMinutes();
	var seconds = digital.getSeconds();
	var amOrPm 	= "AM";
	if (minutes<0) {
		minutes = 60 + minutes;
		hours	= hours -1;
	}
	if (minutes>=60) {
		minutes = minutes-60;
		hour	= hours+1;
	}
	if (minutes <= 9) minutes = "0" + minutes;
	
	if (hours >= 24) hours = hours-24;
	if (hours < 0) hours = hours+24;
	
	if (showAmOrPm) {
		if (hours == 0) hours = 12;
		if (hours >= 12) amOrPm = " PM"; else amOrPm = " AM";
		if (hours > 12) hours	= hours-12;
	} else {
		if (hours <= 9) hours = "0" + hours;
		amOrPm = "";
	}
	
	if (seconds <= 9) seconds = "0" + seconds;
	
	dispTime = hours + ":" + minutes + amOrPm ;
	document.getElementById(city).innerHTML = dispTime;
	setTimeout("clock('" + city + "'," + zone + "," + showAmOrPm + ")",1000);
}
//--------------------------------
function deleteInput(ref)
{
	if (blnClicked == false)
	{
		ref.value = '';
		blnClicked = true;
	}
}
//--------------------------------
function changeInfo(formname, elementname,id)
{
	var Kuerzel = eval("document." + formname + "." + elementname + ".value");
	for (i = 0;i < 3; i++)
	{
		eval('document.getElementById("' + id + '_' + i + '").innerHTML = arrInfo["' + Kuerzel + '"][' + i + ']');
	}
}
//--------------------------------
function checkPassword(inputField)
{	
	//Im Quelltext muss arrKonfig als Array definiert werden mit Name der Elemente (Sicher, Mittel, Unsicher, Unbekannt)
	
	var testString = eval("document.frmProfile." + inputField + ".value");
	//Mindestlänge 6 Zeichen; Kleinbuchstaben, Großbuchstaben, Zahlen, Sonderzeichen
	var regExSicher = /^.*(?=.{6,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!§$%&?*+~#@<>]).*$/; 
	//Mindestlänge 6 Zeichen; Buchstaben und Zahlen
	var regExMediumSicher = /^.*(?=.{6,})(?=.*\d)(?=.*[A-Z a-z]).*$/;
	var i;
	
	for (i=0; i< arrKonfig.length;i++)
	{
		document.getElementById(arrKonfig[i]).style.display = "none";
	}
	
	// Wenn Passwort sicher ist
	if (regExSicher.test(testString))
	{
		document.getElementById(arrKonfig[0]).style.display = "inline";
	}
	else
	{
		//Wenn Passwort mittelsicher ist 
		if (regExMediumSicher.test(testString))
		{
			document.getElementById(arrKonfig[1]).style.display = "inline";
		}
		//Wenn Passwort unsicher ist
		else
		{
			document.getElementById(arrKonfig[2]).style.display = "inline";
		}
	}
}
//--------------------------------
function bannerSchliessen() {
	var objDivs = document.getElementsByTagName('DIV');
	for (var i = 0; i < objDivs.length; i++) {
		if ((objDivs[i].id.length >= 7) && (objDivs[i].id.substr(0,7) == 'phpads_')) {
			document.getElementById(objDivs[i].id).style.display = 'none';
		}
	}
}
//nimmt ein element anhand einer ID und setzt es auf display:none falls inline oder umgekehrt
function displayOpenClose(id,str_mehr,str_minimieren){	
	if(document.getElementById(id).style.display == 'none'){
		document.getElementById(id).style.display = 'inline';
		document.getElementById('link_'+id).innerHTML = str_minimieren;
	}else{
		document.getElementById(id).style.display = 'none';
		document.getElementById('link_'+id).innerHTML = str_mehr;
	}
}
//--------------------------------
function displayOpen(id){	
	if(document.getElementById(id).style.display == 'none'){
		document.getElementById(id).style.display = 'inline';
	}
}
//--------------------------------
//setzt alle im Array übergebenen sichtbaren Elemente display:none, den Rest auf display:visible
function vdShowHideSubSearch(id,idArraySchliessen, idArrayOeffnen, strFilter){	
	if(document.getElementById('search_link_'+ strFilter + id).innerHTML.match(/plus/)) {
		// Liste ist geschlossen und muss geöffnet werden
		document.getElementById('search_link_' + strFilter + id).innerHTML = '<img src="/images/minus.gif" border="0" />';
		for(var i = 0; i < idArrayOeffnen.length; i++){ 
			document.getElementById('search_' + strFilter + idArrayOeffnen[i]).style.display = 'block';
			document.getElementById('search_link_' + strFilter + idArrayOeffnen[i]).innerHTML = '<img src="/images/plus.gif" border="0" />';
			//letztes Element kann nicht existent sein, Funktion bricht im Case hier ab.
		}
	}else{
		//Liste ist offen und muss geschlossen werden
		document.getElementById('search_link_' + strFilter + id).innerHTML = '<img src="/images/plus.gif" border="0" />';
		for(var i = 0; i < idArraySchliessen.length; i++){ 
			document.getElementById('search_' + strFilter + idArraySchliessen[i]).style.display = 'none';
			//letztes Element kann nicht existent sein, Funktion bricht im Case hier ab.
		}
	}
}
//--------------------------------
//Initialisierung fuer die MM_Suggest Vorschlagssuche
function mmsetup() {
	var lang = document.frmSearch.lang.value;
	SetupMMSuggest(document.frmSearch.stinput,
		{'requestURL': "/smartsugg.asp?max_results=25&Keywords_mode=APPROX&Keywords=$v$&query=$v$&bias=100&Lang=$document.frmSearch.lang.value$",
		 'onActivate': customOnActivate,
		 'flags': AS_NOLOGO + AS_GROUPED + AS_GENERATED_CATEGORIES_NOT_SELECTABLE + AS_GROUPED_DISPLAYCAT, 
		 //'flags': AS_NOLOGO + AS_GROUPED + AS_NO_ROOT, 
		 'groupedRowFunction': customGroupedRow,
		 'suggBoxTop': topBox,
		 'suggBoxBottom': bottomBox,
		 'onActivate': customOnActivate,
		 'beforeRequest': customBeforeRequest,
		 'width':410,
		 'left':40,
		 'align': 'right',
		 'iconPath': "/images/mmsuggest/",
		 'normalfg':"#003399",
		 'normalbg':"#FFFFFF",
		 'highlightfg':"#FFFFFF",
		 'highlightbg':"#003399"}
	);
	activateOverlay(); //???
}
//--------------------------------
//Öffnet einen Link in einem Popup im aufrufenden Fenster
function to_old_window(strURL) {
	opener.location.href = strURL;
}
//--------------------------------
//setzt Element mit ID box_ID auf display oder none und link mit ID search_Link_ID auf +/-
function vdShowHideBox(id){
	if(document.getElementById('search_link_'+ id).innerHTML.match(/plus/)) {
		// Liste ist geschlossen und muss geöffnet werden
		document.getElementById('search_link_' + id).innerHTML = '<img src="/images/minus.gif" border="0" />';
		document.getElementById('box_' + id).style.display = 'block';
	}else{
		//Liste ist offen und muss geschlossen werden
		document.getElementById('search_link_' + id).innerHTML = '<img src="/images/plus.gif" border="0" />';
		document.getElementById('box_' + id).style.display = 'none';
	}
}
function vdShowBox(id){
	document.getElementById('search_link_' + id).innerHTML = '<img src="/images/minus.gif" border="0" />';
	document.getElementById('box_' + id).style.display = 'block';
}
//--------------------------------
//setzt Element mit ID id auf display oder none und verschiebt die News in der Liste bei true
function vdShowListAbstand(id){
	rowElement = $(vdShowListAbstandelementId);
	rowElement2 = $(vdShowListAbstandelementId2);
	h = parseFloat(rowElement2.offsetHeight);//inMaxElements * 25;
	
	if (id.indexOf('scrollbox_1') >-1 && parseFloat(rowElement.getStyle('top'))<= 0){
		rowElement2.setStyle('top', rowElement.offsetHeight + parseFloat(rowElement.getStyle('top')));
	}
	if (id.indexOf('scrollbox_2') >-1 && parseFloat(rowElement2.getStyle('top'))<= 0){
		rowElement.setStyle('top', rowElement2.offsetHeight + parseFloat(rowElement2.getStyle('top')));
	}
}

function vdShowListBox(id,blnVerschieben){
	document.getElementById(id).style.display = 'block';
	if (blnVerschiebene = 'true') {
		vdShowListAbstand(id);
	}
}
function vdHideListBox(id,blnVerschieben){
	document.getElementById(id).style.display = 'none';
	if (blnVerschiebene = 'true') {
		vdShowListAbstand(id);
	}
}
//--------------------------------
function stop_bubble(e){
	if (!e) var e = window.event;
	e.cancelBubble = true;
	if (e.stopPropagation) e.stopPropagation();
	return true;
}
//--------------------------------
function loadWertpapierproduktBeschreibung() {
	var inWPNr = document.getElementById('select_wpnr').value
	if (inWPNr > 0) {
		new Ajax('showpage.asp?pageid=' + CONST_RUBRIK_WERTPAPIERPRODUKTBESCHREIBUNGEN_TEXT + '&mode=text&inwpnr=' + inWPNr, {
			method: 'get',
			update:$('wpbeschreibung'),
			onRequest: function() {$('wpbeschreibung').innerHTML = stHTML;},
			onComplete: function() {$('wpbeschreibung').innerHTML = responseText;}
		}).request();
	}
}
//--------------------------------
function showExtendedSort()
{
	if (document.getElementById('ExtendedSort').className == 'hide')
	{
		document.getElementById('ExtendedSort').className='show';
		if (blnIe && !blnIe7)
		{
			document.getElementById('inwpnr').style.display = 'none';
			document.getElementById('inbwpnr').style.display = 'none';
			document.getElementById('inbwnr').style.display = 'none';
			document.getElementById('inlnr').style.display = 'none';
//			document.getElementById('inbpr').style.display = 'none';
			
			document.getElementById('selectbox_1').style.display = 'block';
			document.getElementById('selectbox_2').style.display = 'block';
			document.getElementById('selectbox_3').style.display = 'block';
			document.getElementById('selectbox_4').style.display = 'block';
//			document.getElementById('selectbox_5').style.display = 'block';
		}
	}
	else
	{
		document.getElementById("ExtendedSort").className='hide';
		if (blnIe && !blnIe7)
		{
			document.getElementById('inwpnr').style.display = 'inline';
			document.getElementById('inbwpnr').style.display = 'inline';
			document.getElementById('inbwnr').style.display = 'inline';
			document.getElementById('inlnr').style.display = 'inline';
//			document.getElementById('inbpr').style.display = 'inline';
			
			document.getElementById('selectbox_1').style.display = 'none';
			document.getElementById('selectbox_2').style.display = 'none';
			document.getElementById('selectbox_3').style.display = 'none';
			document.getElementById('selectbox_4').style.display = 'none';
//			document.getElementById('selectbox_5').style.display = 'none';
		}
	}
}

function showHandelspartner(herkunft)
{
	if (herkunft == 'produktdetail')
	{
		document.getElementById('handelspartner_body').className='handelspartner_body_show';
	}
	else if (herkunft == 'hide')
	{
		document.getElementById("handelspartner_body").className='handelspartner_body_hide';
	}
	else
	{
		if (document.getElementById('handelspartner_body').className == 'handelspartner_body_hide')
		{
			document.getElementById('handelspartner_body').className='handelspartner_body_show';
		}
		else
		{
			document.getElementById("handelspartner_body").className='handelspartner_body_hide';
		}
	}

}

function showLayer(id_box, id_img) {
	if (id_img)
	{
		var box = $(id_box);
		var img = $(id_img);
		var xpos;
		var ypos;
		
		box.setStyle('top', 0);
		box.setStyle('left', 0);
		box.setStyle('left', img.getPosition().x - box.getPosition().x - 10 - box.getCoordinates().width);
		box.setStyle('top', img.getPosition().y - box.getPosition().y - 17);
		
		box.setStyle('visibility', 'visible');
	}
	else
	{
		$(id_box).setStyle('visibility', 'visible');
	}
}
function hideLayer(id) {
	$(id).setStyle('visibility', 'hidden');
}

function openPopupWindow(Url, Height, Width, Scrollbar) {
	var Parameters;
	
	Scrollbar = Scrollbar || false;
	
	if(Height)
	{
		Parameters = 'height=' + Height;
	}
	if(Width)
	{
		if(Parameters != '')
			Parameters += ',';
			
		Parameters += 'width=' + Width;
	}
	
	if(Parameters != '')
		Parameters += ',';
	
	if(Scrollbar)
		Parameters += 'scrollbars=yes,';
	else
		Parameters += 'scrollbars=no,';
		
//	locationbar can't be hidden in ff3 or Opera
	Parameters += 'titlebar=0,menubar=0,toolbar=0,location=0,resizable=0';
	
	window.open(Url,'_blank', Parameters);
	
}

function reloadPopupBox(ID, Title, Nr, Page, TitleExtend, Index, Newsticker,Chart, Produkt, Intraday, Nr2) {
	Newsticker = Newsticker || false;
	Index = Index || false;
	Produkt = Produkt || false;
	Intraday = Intraday || false;
	
	var requestLink = 'showpage.asp?pageid=' + Page + '&mode=text';
	if (Newsticker)
		requestLink += '&bli=1';
	if (Index)
		requestLink += '&ininr=';
	else if (Produkt)
		requestLink += '&pkpnr=';
	else
		requestLink += '&inbwnr=';
	requestLink += Nr;
	
	var buttonRequestLink = 'showpage.asp?pageid=' + Page;
	if (Newsticker)
		buttonRequestLink += '&blk=1';
	if (Index)
		buttonRequestLink += '&ininr=';
	else if (Produkt)
		buttonRequestLink += '&pkpnr=';
	else
		buttonRequestLink += '&inbwnr=';
	buttonRequestLink += Nr;
	
	if(!Chart)
	{
		new Ajax(requestLink, {
				method: 'get',
				evalScripts: true,
				onRequest: function() {
					$(ID + '_head').innerHTML = Title + ' ' + TitleExtend;
					$(ID + '_content').innerHTML = LoadHTML;
				},
				onComplete: function(responseText) {
					$(ID + '_content').innerHTML = responseText;
					
					if(Newsticker) {
						var ticker = new NewsTicker('news_ticker_element', { width: 760, height: 12, charWidth: 10, paddingMultiplier: 1 });
						ticker.start.delay(0, ticker);
					}
					
					var adjustWidth = 10;
					if(!document.all || window.opera) {
						adjustWidth = 27;
					}
					$(ID + '_head_button').onclick = function() {
						openPopupWindow(buttonRequestLink, $(ID + '_content').offsetHeight, $(ID + '_content').offsetWidth + adjustWidth);
					};
					
					try{
						if($(ID + '_height_constraint').offsetHeight < $(ID + '_content').offsetHeight && document.all) {
							$(ID + '_content').style.width = $(ID + '_height_constraint').offsetWidth - 17;
						}
					}
					catch(e) {}
				}
			}).request();
	} else {
		flashMovie = $('amstock');
		if(flashMovie) {
			flashMovie.reloadSettings('showpage.asp?pageid=' + CONST_RUBRIK_STOCKCHARTS_SETTINGS + '&bldisc=1&mode=text&inbwnr=' + (Produkt ? Nr2 : Nr) + '&sttyp=' + (Intraday ? 'intraday' : 'hist'));
			
			$(ID + '_head').innerHTML = Title + ' ' + TitleExtend;
			
			var adjustWidth = 10;
			if(!document.all || window.opera) {
				adjustWidth = 27;
			}
			$(ID + '_head_button').onclick = function() {
				openPopupWindow(buttonRequestLink, $(ID + '_content').offsetHeight, $(ID + '_content').offsetWidth + adjustWidth);
			};
			
			new Ajax(requestLink + '&blnh=1', {
				method: 'get',
				evalScripts: true,
				onComplete: function(responseText) {
					$('amhtml').innerHTML = responseText;
				}
			}).request();
			
			if (Intraday) {
				$('amlink').innerHTML = texthist;
				$('amlink').href = 'javascript:changeChart(' + (Produkt ? Nr2 : Nr) + ', \'' + 'hist' + '\')';
			} else {
				$('amlink').innerHTML = textintra;
				$('amlink').href = 'javascript:changeChart(' + (Produkt ? Nr2 : Nr) + ', \'' + 'intraday' + '\')';
			}
		}
	}
}

function loadOverviewChart(lngProduktNr) {
	new Ajax('showpage.asp?pageid=' + CONST_RUBRIK_DAX_TOOL_CHARTS + '&bldisc=1&mode=text&pkpnr=' + lngProduktNr, {
		method: 'get',
		onRequest: function() {
			$('daxtool_uebersicht_charts').innerHTML = stHTML;
		},
		onComplete: function(responseText) {
			$('daxtool_uebersicht_charts').innerHTML = responseText;
		}
	}).request();
}

function adjustPopupBox(Url, Id) {
	var heightAdjust = 10;
	if($(Id + '_height_constraint')) {
		if(!document.all || window.opera) {
			if($(Id + '_height_constraint').offsetHeight < $(Id + '_content').offsetHeight) {
				heightAdjust = 27;
			}
		} else {
			window.addEvent('load', function() {
				if($(Id + '_height_constraint').offsetHeight < $(Id + '_content').offsetHeight) {
					$(Id + '_content').style.width = ($(Id + '_height_constraint').offsetWidth - 17) + 'px';
				}
			});
		}
	}
	
	$(Id + '_head_button').onclick = function() {
		openPopupWindow(Url, $(Id + '_content').scrollHeight, ($(Id + '_content').scrollWidth + heightAdjust));
	};
}

function adjustPopupWindow() {
	var offsetHeight = 0;
	var offsetWidth = 0;
	
	if(document.body.offsetHeight < 100)
		offsetHeight = document.body.offsetHeight - 100;
		
	if(document.body.offsetWidth < 100)
		offsetWidth = document.body.offsetWidth - 100;
		
	if(offsetHeight != 0 || offsetWidth != 0)
		window.resizeBy(offsetWidth, offsetHeight);
}

function changeChart(bwnr, typ, clipped) {
	clipped = clipped || false;
	
	flashMovie = $('amstock');
	if(flashMovie) {
		flashMovie.reloadSettings('showpage.asp?pageid=' + CONST_RUBRIK_STOCKCHARTS_SETTINGS + '&bldisc=1&mode=text&inbwnr=' + bwnr + '&sttyp=' + typ + (clipped ? '&blc=1' : ''));
		intraday = typ == 'intraday' ? true : false;
		$('amlink').innerHTML = typ == 'intraday' ? texthist : textintra;
		$('amlink').href = 'javascript:changeChart(' + bwnr + ', \'' + (typ == 'intraday' ? 'hist' : 'intraday') + '\')';
		
		$('amzoom').style.display = (intraday ? '' : 'none');
		
	}
}

function amReturnData(chart_id, data) {
	chartdata = data;
}

function chartPush(data) {
	chartdata += '\r\n' + data;
	ochart.setData(chartdata);
	if($('amzoomcheck').checked) {
		ochart.showAll();
	}
}

function amProcessCompleted(chart_id, process_name) {
	if(process_name == "init") {
		ochart = document.getElementById(chart_id);
		ochart.getData();
	}
}

function activateOverlay() {
	var navi = $$('li.topitem');
	navi.each(function(el) {
		if($E('div.subnavi', el)) {
			el.addEvents({'mouseenter': function() {
				var overlay = $('content_overlay');
				if (overlay.getStyle('display') == 'none') {
					if (window.ie6)
					{
						$$('select').addClass('hidden');
					}
					overlay.setStyle('display', 'block');
				}
			}
			, 'mouseleave': function() {
				var suggBox_obj = $('suggBox0');
				if (!suggBox_obj || suggBox_obj.getStyle('visibility') == 'hidden') {
					var overlay = $('content_overlay');
					if (overlay.getStyle('display') != 'none') {
						if (window.ie6)
						{
							$$('select').removeClass('hidden');
						}
						overlay.setStyle('display', 'none');
					}
				}
			}});
		}
	});
}

function createCookie(name,value) {
	document.cookie = name+"="+value+"; 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 showHideBorderBoxContent(id) {
	var tmp = $(id + '_content');
	
	if (!tmp.collapsibleSet)
	{
		tmp.collapsible = new Fx.Slide($(id + '_content'), {
			duration: 500,
			transition: Fx.Transitions.linear
		});
		tmp.collapsible.wrapper.style.position = 'relative';
		tmp.collapsible.wrapper.style.display = 'inline-block';
		tmp.collapsible.wrapper.style.width = '100%';
		tmp.collapsibleSet = true;
	}
	
	if (tmp.style.display == 'none')
	{
		tmp.style.display = 'inline-block';
		tmp.collapsible.hide();
		tmp.collapsibleOpen = false;
	}
	else if (tmp.style.display != 'inline-block')
	{
		tmp.style.display = 'inline-block';
	}
	
	if (tmp.collapsible.open && $('linkmenue'))
	{
		$('linkmenue').style.display = 'none';
	}
	
	if (!window.opera)
	{
		tmp.collapsible.toggle().chain(function(){
			if (this.open){
				this.wrapper.setStyle('height', '');
			}
		});
	}
	else
	{
		if (tmp.collapsible.open)
		{
			tmp.collapsible.hide();
			tmp.collapsible.wrapper.setStyle('height', '0');
		}
		else
		{
			tmp.collapsible.show();
			tmp.collapsible.wrapper.setStyle('height', '');
		}
	}
	
	tmp = $(id + '_button');
	
	var a = readCookie('x-markets-de-box');
	var boxvar = id + '=1';
	
	if (tmp.src.indexOf('min') == -1)
	{
		tmp.src = '../images/neu/button_min.gif';
		if (a.indexOf(boxvar) != -1)
		{
			if (a.length > boxvar.length)
				boxvar = '&' + boxvar;
			a = a.substring(0, a.indexOf(boxvar)) + a.substring(a.indexOf(boxvar) + boxvar.length)
		}
		if (a.substring(0,1) == '&')
			a = a.substring(1);
	}
	else
	{
		tmp.src = '../images/neu/button_max.gif';
		createCookie('x-markets-de-box', a);
		if (a != null && a != '')
		{
			a = a + '&' + boxvar;
		} else {
			a = boxvar;
		}
	}
	createCookie('x-markets-de-box', a);
}

function switchReiterBoxTab(id, tab, extLoad, partnerBoxen) {
	var tmp = $(id);
	var tmp2;
	var inhalt;
	var openTab = tmp.contentopen || 0;
	var maxHeight = 0;
	var partnerObj;
	var partnerTab;
	var key;
	
	if (tab != openTab)
	{
		for(i = 1; i < 50; i++) {
			tmp2 = $(id + '_content_' + i);
			if (tmp2) {
				if (i == tab) {
					tmp2.setStyle('display', 'block');
				} else {
					tmp2.setStyle('display', 'none');
				}
			} else {
				break;
			}
		}
		
		for(i = 1; i < 50; i++) {
			tmp2 = $(id + '_tab_' + i + '_left');
			if (tmp2) {
				if (i == tab) {
					tmp2.className = 'tableft activeleft';
					$(id + '_tab_' + i + '_middle').className = 'tabmiddle activemiddle';
					$(id + '_tab_' + i + '_right').className = 'tabright activeright';
				} else {
					tmp2.className = 'tableft';
					$(id + '_tab_' + i + '_middle').className = 'tabmiddle';
					$(id + '_tab_' + i + '_right').className = 'tabright';
				}
			} else {
				break;
			}
		}
		
		tmp.contentopen = tab;
		
		tmp = $(id + '_content_' + tab);
		
		if (extLoad == 1 && tmp.isloaded != 1)
		{
			inhalt = $(id + '_content_' + tab + '_inhalt');
			new Ajax(inhalt.innerHTML.split(';').join('&') + '&bldisc=1&mode=ajax', {
				method: 'get',
				evalScripts: true,
				update: inhalt,
				onRequest: function() {
					inhalt.innerHTML = 'Bitte Warten ...';
				}
			}).request();
			
			tmp.isloaded = 1;
		}
	}
	
	maxHeight = $(id + '_content_' + tab + '_inhalt').getSize().size.y;
	for (key =0; key < partnerBoxen.length; key++)
	{
		partnerObj = $(partnerBoxen[key]);
		partnerTab = partnerObj.contentopen || 1;
		if (maxHeight < $(partnerObj.id + '_content_' + partnerTab + '_inhalt').getSize().size.y) {
			maxHeight = $(partnerObj.id + '_content_' + partnerTab + '_inhalt').getSize().size.y;
		}
	}
	
	if (partnerBoxen.length > 0) {
		$(id + '_content_' + tab).style.height = maxHeight + 'px';
	}
	
	for (key = 0; key < partnerBoxen.length; key++)
	{
		partnerObj = $(partnerBoxen[key]);
		partnerTab = partnerObj.contentopen || 1;
		$(partnerObj.id + '_content_' + partnerTab).style.height = maxHeight + 'px';
	}
}

function adjustReiterBoxen(id, partnerBoxen) {
	window.addEvent('load', function() {
		switchReiterBoxTab(id, 1, false, partnerBoxen)
	});
}

function switch_checkbox(id) {
	var box = document.getElementById('checkbox_' + id);
	var div = document.getElementById('checkboxdiv_' + id);
	
	if (box.checked)
	{
		div.className = 'produktcheckboximg';
		box.checked = false;
	}
	else
	{
		div.className = 'produktcheckboximgactive';
		box.checked = true;
	}
}

function showLinkMenu(e) {
	var menuBox = $('linkmenue');
	var pos = findPos(e);
	
	document.getElementsByTagName('body')[0].appendChild(menuBox);
	
	if (menuBox.style.display == '' || menuBox.style.display == 'none')
	{
		menuBox.style.top = pos[0]+ -10 + 'px';
		menuBox.style.left = pos[1]+ 30 + 'px';
		menuBox.style.display = 'block';
	}
	
	menuBox.addEvent('mouseleave', function(e) {
		menuBox.style.display = 'none';
	});
}

function findPos(e) {
	var curleft = curtop = 0;
	
	if (e.offsetParent)
	{
		do {
			curleft += e.offsetLeft;
			curtop += e.offsetTop;
		} while (e = e.offsetParent);
	}
	
	return [curtop,curleft];
}

function activateOverlay() {
	var navi = $$('li.topitem');
	navi.each(function(el) {
		if($E('div.subnavi', el)) {
			el.addEvents({'mouseenter': function() {
				var overlay = $('content_overlay');
				if (overlay.getStyle('display') == 'none') {
					if (window.ie6)
					{
						$$('select').addClass('hidden');
					}
					overlay.setStyle('display', 'block');
				}
			}
			, 'mouseleave': function() {
				var suggBox_obj = $('suggBox0');
				if (!suggBox_obj || suggBox_obj.getStyle('visibility') == 'hidden') {
					var overlay = $('content_overlay');
					if (overlay.getStyle('display') != 'none') {
						if (window.ie6)
						{
							$$('select').removeClass('hidden');
						}
						overlay.setStyle('display', 'none');
					}
				}
			}});
		}
	});
}
function loadTopBonus(stLandKuerzel,inbwpnr) {
	new Ajax('showpage.asp?pageid=' + CONST_RUBRIK_BONUSPORTALTABELLE + '&mode=text', {
		method: 'get',
		data: 'inwpnr=' + inwpnr + '&inbwpnr=' + inbwpnr,
		update:$('topbonus'),
		onRequest: function() {$('liste').innerHTML = stHTML;},
		onComplete: function() { strBuchstabe = stBuchstabe; }
	}).request();
}

function loadDiskontRenditeMatrix(stLandKuerzel,inbwpnr) {
	new Ajax('showpage.asp?pageid=' + CONST_RUBRIK_DISKONTPORTALTABELLE + '&mode=text', {
		method: 'get',
		data: 'inwpnr=' + inwpnr + '&inbwpnr=' + inbwpnr,
		update:$('topbonus'),
		onRequest: function() {$('liste').innerHTML = stHTML;},
		onComplete: function() { strBuchstabe = stBuchstabe; }
	}).request();
}
function loadUnderlyings(stLandKuerzel,stBuchstabe) {
	new Ajax('showpage.asp?pageid=' + CONST_RUBRIK_BASISWERTTABELLE + '&mode=text' + '&inwpnr=' + inwpnr + '&stwpnr=' + stwpnr + "&inzeichen=" + intAnzahlZeichen + "&blportal=" + blportal, {
		method: 'post',
		data: "stbuchst=" + stBuchstabe + "&stbwpnr=" + strBWPNr,
		update:$('basiswerte'),
		onRequest: function() {$('liste').innerHTML = stHTML;},
		onComplete: function() { strBuchstabe = stBuchstabe; }
	}).request();
}

function loadUnderlyingTypes(stBWPNr) {
	new Ajax('showpage.asp?pageid=' + CONST_RUBRIK_BASISWERTTABELLE + '&mode=text' + '&inwpnr=' + inwpnr + '&stwpnr=' + stwpnr + "&inzeichen=" + intAnzahlZeichen + "&blportal=" + blportal, {
		method: 'post',
		data: "stbwpnr=" + stBWPNr + "&blnBasiswertprodukte=1",
		update:$('basiswertprodukte'),
		onRequest: function() {$('basiswerte').innerHTML = stHTML;},
		onComplete: function() { strBWPNr = stBWPNr; }
	}).request();
}
function SubmitPortalSearch() {
	var Formular = $("frmPortalSearch");
	
	if (typeof(strDefaultProduktName) == "undefined") {
		var strDefaultProduktName = 'Name, WKN, ISIN';
	}
	if (typeof(strDefaultBasiswertName) == "undefined") {
		var strDefaultBasiswertName = 'Name, WKN';
	}
	
	if(Formular.stProduktName && Formular.stProduktName.value == strDefaultProduktName) {
		Formular.stProduktName.value = "";
	}
	if(Formular.stBasiswertName && Formular.stBasiswertName.value == strDefaultBasiswertName) {
		Formular.stBasiswertName.value = "";
	}
	
	for (var i = 0; i < document.frmPortalSearch.elements.length; i++) { 
		if(document.frmPortalSearch.elements[i].name.indexOf("db") == 0 && isNaN(document.frmPortalSearch.elements[i].value)) {
			document.frmPortalSearch.elements[i].value = parseFloat(document.frmPortalSearch.elements[i].value.replace(/,/g,"."));
			if(isNaN(document.frmPortalSearch.elements[i].value)) {
				document.frmPortalSearch.elements[i].value = '';
			}
		}
		
	}
	
	return true;
}

function sendPortalSearch() {
	$('frmPortalSearch').action = $('frmPortalSearch').action + "&mode=ajax";
	SubmitPortalSearch();
	$('frmPortalSearch').send({
		update: $('produkttypenportalreiter_content_1_inhalt'),
		
		onRequest: function() {
			$('produkttypenportalreiter_content_1_inhalt').innerHTML = 'Bitte Warten ...';
		}
	});
}

function reloadPortalProduktuebersicht(stlink, incontainerid) {
	new Ajax(stlink + '&mode=ajax', {
			method: 'get',
			evalScripts: true,
			update:$('produkttypenportalreiter_content_'+incontainerid+'_inhalt'),
			onRequest: function() {
				$('produkttypenportalreiter_content_'+incontainerid+'_inhalt').innerHTML = "Bitte warten...";
			},
			onComplete: function(responseText) {
				$('produkttypenportalreiter_content_'+incontainerid+'_inhalt').innerHTML = responseText;
				if (document.getElementById('st_produktfaelligkeitstag_min')) {
					initkalender();
					}
			}
		}).request();
}
function reloadPagingAjax(select){
	var url = select.options[select.options.selectedIndex].value;
	if (url == ""){
		select.form.reset();
		return;	
	}else{
		new Ajax(url + '&mode=ajax', {
				method: 'get',
				evalScripts: true,
				update:$('produkttypenportalreiter_content_1_inhalt'),
				onRequest: function() {
					$('produkttypenportalreiter_content_1_inhalt').innerHTML = "Bitte warten...";
				},
				onComplete: function(responseText) {
					$('produkttypenportalreiter_content_1_inhalt').innerHTML = responseText;
					if (document.getElementById('st_produktfaelligkeitstag_min')) {
						initkalender();
						}
				}
			}).request();
	}
}