
function printwindow()
{
	var okno=window.open("","_print","scrollbars=yes,toolbar=np,location=no,directories=no,status=no,menubar=no,resizable=yes,width=450,height=600");
	okno.focus();
}

function imageZoom(x,y)
{
	x = (x!=0) ? (x+40) : 200;
	y = (y!=0) ? (y+40) : 200;
	var okno=window.open("","_image","scrollbars=yes,toolbar=np,location=no,directories=no,status=no,menubar=no,resizable=yes,width="+x+",height="+y);
	okno.focus();
}

function closeImagePopup() {

	if( wndImage && wndImage.close ) {
		wndImage.close();
	}

}

function imagePopup( img, w, h, cssUrl ) {

	var sUrl = '';
	var iTipHeight = (h>600) ? 600 : h+30;
	var iTipWidth = (w>750) ? 750 : w+40;
	var iTipLeft = 0;
	var iTipTop = 0;
	var sTipScrollbars = "yes";

	//closeImagePopup();

	//window.sTipText = sTipText;

	var sParams = "width=" + iTipWidth + ",height=" + iTipHeight + ",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=" + sTipScrollbars + ",resizable=yes,left=" + iTipLeft + ",top=" + iTipTop;

	wndImage = window.open( '', 'GFX', sParams );
	wndImage.document.write( '<html>' );
	wndImage.document.write( '<head>' );
	wndImage.document.write( '<link rel="stylesheet" type="text/css" href="'+cssUrl+'" />' );
	wndImage.document.write( '</head>' );
	wndImage.document.write( '<body>' );
	wndImage.document.write( '<img src="'+img+'" width="'+w+'" height"'+h+'" border="0">' );
	wndImage.document.write( '<table width="100%"><tr><td>' );
	wndImage.document.write( '<!-- PageNavigator -->' );
	wndImage.document.write( '<table width="100%" id="pageNavigator" cellspacing="0" cellpadding="0" border="0"><tr><td><a href="javascript:window.close();">Fenster schließen</a></td><td>&nbsp;</td><td class="right"><a href="javascript:window.print();">Drucken</a></td></tr></table>' );
	wndImage.document.write( '<!-- PageNavigator -->' );
	wndImage.document.write( '</td></tr></table>' );
	wndImage.document.write( '</body></html>' );
	wndImage.document.bgColor = "white";
	wndImage.document.close();
	wndImage.focus();

	return false;

}


function textPopup( fileurl ) {

	var windowWidth	= 400;
	var windowHeight = 400;
	var windowLeft = 0;
	var windowTop = 0;
	var windowScrollbars = "yes";
	var windowResize = "yes";

	var sParams = "width=" + windowWidth + ",height=" + windowHeight + ",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=" + windowScrollbars + ",resizable=" + windowResize + ",left=" + windowLeft + ",top=" + windowTop;
	winText = window.open( fileurl, 'Popup', sParams );
	winText.focus();

	return false;

}


var wndInfoTip;

/**
 * closeInfoTip()
 *
 * Closes info tip popup window
 */
function closeInfoTip() {

	if( wndInfoTip && wndInfoTip.close ) {
		wndInfoTip.close();
	}

}

/**
 * openInfoTip( string sUrl, string sTipText )
 *
 * Opens info tip popup window
 * and shows sTipText in it. sUrl is InfoTip URL
 */
function openInfoTip( sUrl, sTipText ) {

	var iTipHeight = 400;
	var iTipWidth = 450;
	var iTipLeft = eval( ( screen.availWidth - iTipWidth ) / 2 );
	var iTipTop = 100; //eval( screen.availHeight - 230 );
	var sTipScrollbars = "yes";

	closeInfoTip();

	window.sTipText = sTipText;

	var sParams = "width=" + iTipWidth + ",height=" + iTipHeight + ",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=" + sTipScrollbars + ",resizable=no,left=" + iTipLeft + ",top=" + iTipTop;

	wndInfoTip = window.open( sUrl, 'wndInfoTip', sParams );

}


var openWindowId=null;

function openWindow(imageName, height, width, htmlPage, pageTitle) {

	if (width == 0)
		width = 640;
	if (height == 0)
		height = 480;
	if (pageTitle == '')
		pageTitle =':: WindowName';

	var _scrolling = 0;
	var _scrollbars = 0;
	if (htmlPage != '') {
		_scrolling = 1;
		_scrollbars = 1;
	}
	var _top = screen.availHeight; //position on the screen
	var _left = screen.availWidth; //position on the screen
	var _top = (_top-height)/2; //vertical align
	var _left = (_left-width)/2; //horizontal align

	var options = "'fullscreen=0,toolbar=1,location=1,directories=0,menubar=1,status=1,scrolling=" + _scrolling + ",scrollbars=" + _scrollbars + ",resizable=0,width=" + width + ",height=" + height + ",top=" + _top + ",left=" + _left + "'";

	//var randomId = Math.round(Math.random()*5000);
	randomId = "_out";

	if (openWindowId != null) openWindowId.close();
	openWindowId = window.open(htmlPage, randomId, options);

	if (htmlPage == '') {
		openWindowId.document.write('<html><head><title>'+pageTitle+'</title></head><body style="padding:0px; margin:0px;"><a href="#" onclick="self.close()"><img src="'+imageName+'" width="'+width+'" height="'+height+'" border="0"></a></body></html>');
		openWindowId.document.close();
	}

	openWindowId.focus();
	return true;
}