// Open a popup window an show the *.html file on the defined url
// Do not show any window decorations as menubar, statusbar, etc.
// PARAMETERS:
// url: the location of the *.html file that should be opened in a popup
// windowname: the name of the window (target name). NOT THE <title> OF THE WINDOW !
// width: the width of the window in pixels
// height: the height of the window in pixels
// scrollbars: yes or no

var win = null;
var win_static = null;

function popup(url, windowname, width, height, scrollbars)
{
	var window_left = (screen.width - width) / 2;
	var window_top = (screen.height - height) / 2;
	win = window.open(url, windowname, 'height=' + height + ',width=' + width + ',top=' + window_top + ',left=' + window_left + ',scrollbars=' + scrollbars + ',menubar=yes,status=yes,resizable=yes');
	if (parseInt(navigator.appVersion) >= 4)
	{
		win.window.focus();
	}
}

function popup_minimal(url, windowname, width, height)
{
	var window_left = (screen.width - width) / 2;
	var window_top = (screen.height - height) / 2;
	win = window.open(url, windowname, 'height=' + height + ',width=' + width + ',top=' + window_top + ',left=' + window_left + ',scrollbars=no,menubar=no,status=no,resizable=no,toolbar=no,titlebar=no');
	if (parseInt(navigator.appVersion) >= 4)
	{
		win.window.focus();
	}
}

function popup_static(url, windowname, width, height, scrollbars)
{
	var window_left = (screen.width - width) / 2;
	var window_top = (screen.height - height) / 2;
	win_static = window.open(url, windowname, 'height=' + height + ',width=' + width + ',top=' + window_top + ',left=' + window_left + ',scrollbars=' + scrollbars + ',menubar=yes,status=yes,resizable=yes');
	if (parseInt(navigator.appVersion) >= 4)
	{
		win_static.window.focus();
	}
}

function popup_args(url, args, windowname, width, height, scrollbars)
{
	var uri_not_encoded = url + "?" + args;
	var uri_encoded;

	// the URL is encoded for all browsers and platforms, except IE on MAC
	var macexplorer = ((navigator.appName.toLowerCase().indexOf("explorer")!=-1) && (navigator.platform.toLowerCase().indexOf("mac")!=-1))

	if(macexplorer)
	{
		popup(uri_not_encoded, windowname, width, height, scrollbars);
	}
	else
	{
		uri_encoded = encodeURI(uri_not_encoded);
		popup(uri_encoded, windowname, width, height, scrollbars);
	}
}

function popup_toolbar(url, windowname, width, height, scrollbars)
{
	var window_left = (screen.width - width) / 2;
	var window_top = (screen.height - height) / 2;
	win = window.open(url, windowname, 'height=' + height + ',width=' + width + ',top=' + window_top + ',left=' + window_left + ',scrollbars=' + scrollbars + ',menubar=yes,toolbar=yes,status=yes,resizable=yes');
	if (parseInt(navigator.appVersion) >= 4)
	{
		win.window.focus();
	}
}


