// Copyright it-motive AG, Duisburg

// Die folgende Zeile im CFM- oder HTML-Code laedt das Skript:
/*
  <script language="JavaScript" src="OpenURLInNewWindow.js" type="text/javascript"></script>
*/

// OpenURLInNewWindow( name, url, width, height )
// Öffnet eine durch 'url' angegebene Datei in einem neuen Fenster.
// Breite und Höhe des Fensters können mitgegeben werden, die Position ist oben links.

// Parameter:
// - name: Name des neuen Fenster
// - url: URL der zu öffnenden Datei
// - width: Breite des neuen Fensters
// - height: Höhe des neuen Fensters


function OpenURLInNewWindow( name, url, width, height, top, left, resizable, locationbar, menubar, scrollbars, status, toolbar )
{
	var doPopUpX = left;
	var doPopUpY = top;

	if ( top  == -999 ) doPopUpY = (screen.height-height)/2;
	if ( left == -999 ) doPopUpX = (screen.width -width )/2;


	var option_str = "locationbar=" + locationbar + ",menubar=" + menubar + ",width=" + width + ",height=" + height + ",top=" + doPopUpY + ",left=" + doPopUpX + ",dependent=yes,resizable=" + resizable + ",scrollbars=" + scrollbars + ",status=" + status + ",toolbar=" + toolbar;
	var fenster = window.open(url, name, option_str);
	try
	{
		fenster.focus();
	}
	catch (e) {}
}

function OpenURLInNewWindowUTF8( name, url, width, height, top, left, resizable, locationbar, menubar, scrollbars, status, toolbar )
{
	var doPopUpX = left;
	var doPopUpY = top;

	if ( top  == -999 ) doPopUpY = (screen.height-height)/2;
	if ( left == -999 ) doPopUpX = (screen.width -width )/2;

	var option_str = "locationbar=" + locationbar + ",menubar=" + menubar + ",width=" + width + ",height=" + height + ",top=" + doPopUpY + ",left=" + doPopUpX + ",dependent=yes,resizable=" + resizable + ",scrollbars=" + scrollbars + ",status=" + status + ",toolbar=" + toolbar;
	var fenster = window.open("about:blank", name, option_str);
	try
	{
		fenster.document.defaultcharset="utf-8";
		fenster.location.href = url;
		fenster.focus();
	}
	catch (e) {}
}

