/*
tested and functional under:
- IE5
- NN4
- NN6
- Mozilla1

Opera doesn't open window, if it is already opened.

*/

var win4Pic = null;

function picWin(location,picWidth,picHeight,comment) {

    var closeMsg = "kliknutím zavřete okno";
	
	comment = (comment) ? comment : "Chalupa Cup 2006";

	if (win4Pic && !win4Pic.closed) {
		win4Pic.close();
	}
	
	
	if (picWidth < 100) {picWidth = 100}
	if (picHeight < 100) {picHeight = 100}

	

    availHeight = screen.height;
    availWidth = screen.width;

    if (availHeight < picHeight) {posTop = 0;}
    else {posTop = (availHeight - picHeight)/2;}

    if (availWidth < picWidth) {posLeft = 0;}
    else {posLeft = (availWidth - picWidth)/2;}

	
    atts = "width=" + picWidth + ",height=" + picHeight + ",directories=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0,top=" + posTop + ",left=" + posLeft;        
    win4Pic = window.open('','win4Pic',atts);

	
    win4Pic.document.open();
    win4Pic.document.write("<html><head><title>" + comment + "</title></head><body style='margin: 0px; padding: 0px;' marginwidth='0' marginheight='0' leftmargin='0' topmargin='0' onLoad='self.focus()'><table cellpadding='0' cellspacing='0' border='0' width='100%' height='100%'><tr><td align='center' valign='middle'><a href='#' onClick='self.close()'><img src='" + location + "' border='0' width='" + picWidth + "' height='" + picHeight + "' alt='" + closeMsg + "'></a></td></tr></table></body></html>");
    win4Pic.document.close();
	
	return true;
}
