var imgWindow = new Object;
var imgWindow = null;

function popImg(thepic,w,h,zetekst,autor) {
	var specs 	= 'width=' + w + ', height=' + h;
	var img = thepic;
	if (!imgWindow || imgWindow.closed) {
		//imgWindow = window.open(thepic,'',specs); 
		

		hh = h + 60;
		imgWindow = window.open('','','width=' + w + ', height=' + hh + ', location=0, toolbar=0, status=no, menubar=0, directories=0, scrollbars=no, status=0, resizable=0');
		imgWindow.document.write('<?xml version="1.0" encoding="UTF-8"?\>'); 
		imgWindow.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'); 
		imgWindow.document.write('<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">'); 
		imgWindow.document.write('<head><title>Järva-Jaani Vanaautode Varjupaik</title>');
		imgWindow.document.write('<meta http-equiv="imagetoolbar" content="no">');
		imgWindow.document.write('<base href="http://varjupaik.jjts.ee/" />'); 
		imgWindow.document.write('<link rel="stylesheet" href="http://varjupaik.jjts.ee/varjupaik.css">');
		imgWindow.document.write('<style type="text/css"><!--'); 
 		
		// Works in NN4 to achieve zero margins
 		imgWindow.document.write('body {margin:-10px 0 0 -10px;padding:0}');

		// Works in real browsers to achieve zero margins
		imgWindow.document.write('html body {margin:0}'); 
		imgWindow.document.write('img {display:block;border:0}'); 
		imgWindow.document.write('\/\/--></style></head>'); 
		imgWindow.document.write('<body onblur="self.close()">'); 

		imgWindow.document.write('<div><table cellpadding=0 cellspacing=0 height="' + hh + '"><tr><td background="laadimine.gif" width="' + w + '" height="' + h + '"><img src="' + thepic + '"></td></tr>');
		imgWindow.document.write('<tr><td height=2 bgcolor=#c8c8c8></td></tr><tr><td align=right><table cellpadding=0 cellspacing=0 width=100%><tr><td align=right>');
		imgWindow.document.write('<font class=tekst><font size=-2 color=#c8c8c8>');
		if (autor) imgWindow.document.write(autor);
		imgWindow.document.write('&nbsp;</font></font></td></tr></table></td></tr>');
		imgWindow.document.write('<tr><td align=left colspan=2 valign=top><table cellpadding=0 cellspacing=0><tr><td>');
		imgWindow.document.write('<font class=tekst><font color=#000000>&nbsp;');
		if (zetekst) imgWindow.document.write(zetekst);
		imgWindow.document.write('&nbsp;</font></font></td></tr></table></td></tr>');
		imgWindow.document.write('</table></div>');		
		imgWindow.document.write('</body></html>');

		imgWindow.document.close(); /*added by me*/
	/*	gowidth=(screen.width/2-(w/2))
		goheight=(screen.height/2-(h/2))
		imgWindow.moveTo(gowidth,goheight)
		imgWindow.focus() */
	}
	else {
		imgWindow.focus();
	}
}

