// open pdf viewer with a given url
function openViewer(jahr, ausgabe, seite) {
	if (!ausgabe) ausgabe = '01'; if (!seite) seite = '01';
	if (String(ausgabe).length < 2) ausgabe = '0' + ausgabe;
	if (String(seite).length < 2) seite = '0' + seite;

	var surl = '/html/de/pdfansicht.asp?jahr='+jahr+'&ausgabe='+ausgabe+'&seite='+seite;
	openViewerPopup(surl, 'pdfview', -100, -100, 0, 1, 1);
}

//--- legacy function for popup windows (s. functions/v53/utilswindow.js)
function openViewerPopup (oUrl, oName, oW, oH, flagScroll, flagResize, flagReset) {
	var wType, popupX, popupY;
	
	// negative oW, oH Werte sind relativ zur Screen Grösse
	if (oW < 0) {
		oW = screen.availWidth + oW;
		oH = screen.availHeight + oH;
	}
	
	wType = "dependent=yes,directories=no,menubar=no,personalbar=no,status=no,toolbar=no";
	if (flagScroll==0) { wType += ",scrollbars=no"; } else { wType += ",scrollbars=yes"; }
	if (flagResize==0) { wType += ",resizable=no"; } else { wType += ",resizable=yes"; }
	
	wType += ",width="+oW+",height="+oH;
	
	// Das neue Fenster soll in der Mitte des aktuellen Browser Fensters positioniert werden...
	// (falls dadurch Teile vom Fenster ausserhalb des sichtbaren Bereichs liegen, werden die Koordination angepasst)
	var NS, IE;
	var sW, sH, wX, wY, wW, wH, mX, mY;

	// --- einfache Browserdefinition des aktuellen Clients..
	NS = (document.all) ? 0 : 1; IE = (document.all) ? 1: 0;
	sW = screen.availWidth; sH = screen.availHeight;
	if (NS) { wX = window.screenX; wY = window.screenY;} else {	wX = window.screenLeft; wY= window.screenTop; }
	if (NS) { wW = window.innerWidth; wH = window.innerHeight;} else {	wW = document.body.clientWidth; wH = document.body.clientHeight }

	popupX = parseInt(wX + (wW - oW) / 2); popupY = parseInt(wY + (wH - oH) / 2);
	if (parseInt(popupX + oW) > sW) popupX = sW - oW - 50 ; if (parseInt(popupY + oH) > sH) popupY = sH - oH - 50;	//- "50" ist Toleranz...
	if (popupX < 0) popupX = 0; if (popupY < 0) popupY = 0;

	// scrennX=NS, left=IE
	wType += ",screenX="+popupX+",left="+popupX+",screenY="+popupY+",top="+popupY;
	
	if (window['oW'+oName]) {
		if (window['oW'+oName].closed==false) {
			window['oW'+oName].document.location=oUrl; window['oW'+oName].focus();
		} else {
			if (flagReset==true) window['oW'+oName].close();
			window['oW'+oName] = window.open(oUrl, oName, wType); window['oW'+oName].focus();
		}
	} else {
		window['oW'+oName] = window.open(oUrl, oName, wType); window['oW'+oName].focus();
	}
	
	return window['oW'+oName];
}
