/*
	open an image
	tested:
		Gecko 1.7.5-1.9a
		IE 6
		Konqueror: 3.4.3
	TODO: replace write method to DOM functions
*/
function showimage(file,width,height,name,djs)
{
	var scrollbars = 0;
	var xbig = (screen.availWidth < width) ? 1 : 0;
	var ybig = (screen.availHeight < height) ? 1 : 0;
	if (xbig) {
		width = screen.availWidth - 20;
		if (!ybig) { height += 20; }
		scrollbars = 1;
	}
	if (ybig) {
		height = screen.availHeight - 40;
		if (!xbig) { width += 20; }
		scrollbars = 1;
	}
	width += 4;
	height += 6;
	var xPos = Math.round((screen.availWidth / 2) - (width / 2) - 5);
	var yPos = Math.round((screen.availHeight / 2) - (height / 2) - 10);

	myWindow = window.open('', name.replace(/\./, '_'), 'top='+ yPos +',left='+xPos+',width='+width+',height='+height);
	myWindow.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">');
	myWindow.document.write('<html><head>');
	myWindow.document.write('<title></title>');
	myWindow.document.write('<style type="text/css">');
	myWindow.document.write('html, body { margin: 0; padding: 0; }');
	myWindow.document.write('body { background-color: #ECE9E0; text-align: center; }');
	myWindow.document.write('#picture { border: 1px solid black; }');
	myWindow.document.write('</style></head><body>');
	myWindow.document.write('<a href="javascript:window.close()"><img src="'+ file +'" id="picture" alt="kép" title="Bezár"></a>');
	myWindow.document.write('</body></html>');
	myWindow.focus();
	myWindow.document.close();
	if (djs)
	{
		return false;
	}
}
