/*
	the following lines are important for key-events in the page ...
	two global variables were set TABTASTE and CURRENTKEY in the function getKeyEvent
*/

var TABTASTE = 9;
var CURRENTKEY = 9;

/* NS FUNKTION */
if (!document.all) document.captureEvents(Event.KEYPRESS);

document.onkeydown=getKeyEvent;

function getKeyEvent(e){
	if (!document.all){
		CURRENTKEY = e.which;
	} else {
		CURRENTKEY = event.keyCode;
	}
}

function openPopup(strUrl,intWidth,intHeight) {
    var history_popup = window.open(strUrl,"popup1","width=" + intWidth + ",height=" + intHeight + ",top=" + (screen.availHeight - intHeight) / 2 + ",left=" + (screen.availWidth - intWidth) / 2);
}

function openPopupKonzern(strUrl,intWidth,intHeight) {
    var bank_popup = window.open(strUrl,"popup2","width=" + intWidth + ",height=" + intHeight + ",top=" + (screen.availHeight - intHeight) / 2 + ",left=" + (screen.availWidth - intWidth) / 2 + ", scrollbars=yes");
}

function showPicDesc(imgID,picDescID) {
	//alert(document.getElementById(imgID).alt);
	document.getElementById(picDescID).style.visibility = 'visible';
	document.getElementById(picDescID).innerHTML = '<span class="bottomtxt">'+document.getElementById(imgID).alt+'</span>';
}

function hidePicDesc(picDescID) {
	document.getElementById(picDescID).style.visibility = 'hidden';
}


//Global function for opening pdf documents in the same new window.
function loadPDF(strURL,isMOUSEEVENT) {
	if ((CURRENTKEY != TABTASTE) || (isMOUSEEVENT == 1)) {
		var pdfwin = window.open(strURL,"pdfwin","scrollbars=yes,resizable=yes");
		pdfwin.focus();
		return false;
	}
	return true;
}

//Global function for opening xls documents in the same new window.
function loadXLS(strURL,isMOUSEEVENT) {
	if ((CURRENTKEY != TABTASTE) || (isMOUSEEVENT == 1)) {
		var xlswin = window.open(strURL,"xlswin","menubar=yes,scrollbars=yes,resizable=yes");
		xlswin.focus();
		return false;
	}
	return true;
}

	
function openDownloadWin(strLocation,isMOUSEEVENT) {		
	if ((CURRENTKEY != TABTASTE) || (isMOUSEEVENT == 1)) {
		var custom_window = window.open(strLocation,'customwindow','width=1006,height=679,scrollbars=yes,resizable=yes');
		custom_window.focus();
		return false;
	}
	return true;
}

function openSurvey(sUrl) {
	var myWin = window.open(sUrl,'umfrage1','width=774,height=575,top=auto,left=auto,scrollbars=no,resizable=yes');
	myWin.focus();
	return false;
}

//Supressing right mouse clicks
var messageDE="Das Logo und seine Bestandteile sowie die Inhalte und hinterlegten Dateiformate sind urheberrechtlich geschützt und dürfen nicht ohne schriftliche Genehmigung durch Sal. Oppenheim jr. & Cie. KGaA genutzt oder verwertet werden, insbesondere nicht in digitaler oder anderer Form abgespeichert oder in sonstiger Weise verwendet werden.";
var messageEN="The logo and its elements, as well as its content and stored file formats, are copyrighted and may not be used or saved digitally or in any other form, or used in any other way without written permission from Sal. Oppenheim jr. & Cie. KGaA";
var message = messageDE;

if((window.location.href.indexOf('/gb2004de/') > -1) 
	|| (window.location.href.indexOf('/gb2005en/') > -1) 
	|| (window.location.href.indexOf('/gb2006en/') > -1)) {
	message = messageEN;
}
/*if (window.location.href.indexOf('/gb2006de') == -1) {
	message="The logo, its components, the contents and the stored data formats are protected by copyright and may not be used or exploited without the written authorization of Sal. Oppenheim jr. & Cie. KgaA; in particular, they may not be saved in digital or any other form or employed in any other way.";
}*/


function clickIE4(){
	if (event.button==2){
		alert(message);
		return false;
	}
}

function clickNS4(e){
	if (document.layers||document.getElementById&&!document.all){
		if (e.which==2||e.which==3){
			alert(message);
			return false;
		}
	}
}

/* Cookie fuer Online-Umfrage GB2006: */

	function CookieSchreiben(n,w,e) {
		var a = new Date();
		a = new Date(a.getTime() +e);
		document.cookie = n+'='+w+';expires='+a.toGMTString()+';';
	}
	
	function CookieLesen(n) {
		a = document.cookie;
		res = '';
		while(a != '') {
			cookiename = a.substring(0,a.search('='));
			cookiename = cookiename.replace(" ", "");
			cookiewert = a.substring(a.search('=')+1,a.search(';'));
			if(cookiewert == '')
			{cookiewert = a.substring(a.search('=')+1,a.length);}
			
			if (n == cookiename) { res = cookiewert; }
			
			i = a.search(';')+1;
			if(i == 0){i = a.length}
			a = a.substring(i,a.length);
		}
		return(res)
	}
	
	function CookieLoeschen(n) {
		document.cookie = n+'=; expires=Thu, 01-Jan-70 00:00:01 GMT;';
	} 
	
	function UmfrageOeffnen() {
		if(document.cookie) {
			myCookie = CookieLesen('OnlineGB2006');
			if(myCookie != '') {
				return false;
			} else {
				return true;
			}
		} else{
			WertMerken();
			return true;
		}	
	} 
	
	function WertMerken() {
		CookieSchreiben('OnlineGB2006','umfrage',1000*60*60*24*365);
		UmfrageOeffnen();
	}

/* Ende Cookie fuer Online-Umfrage GB2006: */


if(window.location.hostname != 'www.dbcdemo.bb-k.com') {
	if (document.layers){
		document.captureEvents(Event.MOUSEDOWN);
		document.onmousedown=clickNS4;
	} else if (document.all&&!document.getElementById){
		document.onmousedown=clickIE4;
	}
	
	document.oncontextmenu=new Function("alert(message);return false")
}