var winDefaultWidth = 300;
var winDefaultHeight = 300;

// nove okno
function win(url, width, height, resizable, scroll, target)
{
	if (!width)
		width = winDefaultWidth;
	if (!height)
		width = winDefaultHeight;
	if (scroll == null)
		scroll = 0;
	if (target == null)
		target = '_blank';
	
	if (document.all)
	{
		var x = Math.round(window.screen.availWidth / 2 - width / 2);
		var y = Math.round(window.screen.availHeight / 2 - height / 2);
		if (x < 0) x = 10;
		if (y < 0) y = 10;
	}
	else
		var x = 200, y = 200;

	var features = 'height='+height+', left='+x+', location=no, menubar=no, resizable='+(resizable ? 'yes' : 'no')+', '
		+'scrollbars='+(scroll ? 'yes' : 'no')+', status=no, titlebar=no, toolbar=no, top='+y+', width='+width;
	window.open(url, target, features);
}

function show(url, width, height)
{
	var resizable = false;
	if (!width && !height)
	{
		width = 400;
		height = 400;
		var resizable = true;
	}
	else
	{
		width = !width ? 300 : width - 2;
		height = !height ? 300 : height - 2;
	
		if (width < 100)
			width = 100;
	}
	
	if (document.all)
	{
		var x = Math.round(window.screen.availWidth / 2 - width / 2);
		var y = Math.round(window.screen.availHeight / 2 - height / 2);
		
		if (x < 0)
			x = 10;
		if (y < 0)
			y = 10;
		
		var scrollable = width > window.screen.availWidth || height > window.screen.availHeight;
	}
	else
	{
		width += 4;
		height += 4;
		var scrollable = true;
		var x = 200, y = 200;
	}

	var features = 'height='+height+', left='+x+', location=no, menubar=no, resizable='+(resizable || scrollable ? 'yes' : 'no')+', '
		+'scrollbars='+(scrollable ? 'yes' : 'no')+', status=no, titlebar=no, toolbar=no, top='+y+', width='+width;
	
	window.open(url, '_blank', features);
}

