//speichert die scrollposition des öffnenden fensters
var xpos = 0;
var ypos = 0;

//öffnet ein neues fenster mit den angegebenen optionen
function openWindow(windowurl, windowname, width, height) {
	/*
	window.alert('appCodeName: ' + navigator.appCodeName + '\n' +
		'appName: ' + navigator.appName + '\n' +
		'appVersion: ' + navigator.appVersion + '\n' +
		'platform: ' + navigator.platform + '\n' +
		'userAgent: ' + navigator.userAgent + '\n');
	window.alert('screenLeft: ' + window.screenLeft + '\nscreenTop: ' + window.screenTop +
		'\nscreenX: ' + window.screenX + '\nscreenY: ' + window.screenY);
	*/
	var nleft = 0;
	var ntop = 0;
	if (navigator.userAgent.indexOf('MSIE') > -1) {
		nleft = window.screenLeft + 200;
		ntop = window.screenTop + 80;
		if (document.documentElement && document.documentElement.scrollTop) {
			ypos = document.documentElement.scrollTop;
			xpos = document.documentElement.scrollLeft;
		}
		else {
			ypos = document.body.scrollTop;
			xpos = document.body.scrollLeft;
		}
	}
	else {
		nleft = window.screenX + 200;
		ntop = window.screenY + 180;
		ypos = window.pageYOffset;
		xpos = window.pageXOffset;
	}
	var options = 'top=' + ntop + ',left=' + nleft + ',height=' + height + ',width=' + width + ',scrollbars=no,status=no,location=no,menubar=no,resizable=no,toolbar=no';
	//window.alert(options);
	window.open(windowurl, windowname, options);
	window.scrollTo(0,0);
}
//scrollt das fenster zur ürsprünglichen position
function scrollToPrevPos() {
	if (ypos || xpos) {
		window.scrollTo(xpos, ypos);
		ypos = 0;
		xpos = 0;
	}
}

function openBillWindow(width, height){
	var nleft = 0;
	var ntop = 0;
	var nwidth = 0;
	if (navigator.userAgent.indexOf('MSIE') > -1) {
		nleft = window.screenLeft;
		ntop = window.screenTop;
	}
	else {
		nleft = window.screenX;
		ntop = window.screenY;
	}
	left = nleft + ((parent.iWidth / 2) - 315);
	var options = 'top=' + ntop + ',left=' + left + ',height=' + height + ',width=' + width + ',scrollbars=yes,status=no,location=no,menubar=no,resizable=yes,toolbar=no';
	newwin = window.open('', 'bill', options);
	newwin.resizeTo(width, height);
	newwin.focus();
}
