function popupWindow(url, width, height) {

    if(url == '' || url == null) {
		return;
	}

	if (width == '' || width == null || height == '' || height == null) {
		width = 800;
		height = 600;
	}

	wx = (screen.width / 2) - (width / 2);
    wy = (screen.height / 2) - (height / 2);

    wnd=window.open(url, "_blank", "width="+(width+20)+",height="+(height+30)+",resizable=1,scrollbars=1,toolbar=no,menubar=no,screenX="+wx+",screenY="+wy);
	wnd.document.close();
	wnd.focus();

}



function popup_image(url, w, h) {

	wWidth = w + 50;
	wHeight = h + 100;
	if (wWidth > screen.width) wWidth = screen.width - 100;
	if (wHeight > screen.height) wHeight = screen.height - 200;

	wnd=window.open("", "imgWin", 'width=' + wWidth + ',height=' + wHeight + ',resizable=1,scrollbars=1,toolbar=no,menubar=no');
	wnd.document.write('<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1251" /><title>Просмотр оригинального изображения</title><link rel="stylesheet" type="text/css" href="/style.css" /></head><body>');
	wnd.document.write('<div align="center"><br /><a href="javascript:window.close();">');
	wnd.document.write('<img id="orImage" src="' + url + '" width="' + w + '" height="' + h + '" border="0" alt="" />');
	wnd.document.write('<br /><br />Закрыть окно</a>');
	wnd.document.write('</div>');
	wnd.document.write('</body></html>');
	wnd.document.close();
	wnd.focus();

}
