/* Открытие ссылки в новом окне заданного размера */
function na_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable, autosize)
{
	top = (navigator.appName == 'Opera') ? top - 80 : top;
	width_str = autosize ? screen.availWidth - width : width;
	height_str = autosize ? screen.availHeight - height : height;
	toolbar_str = toolbar ? 'yes' : 'no';
	menubar_str = menubar ? 'yes' : 'no';
	statusbar_str = statusbar ? 'yes' : 'no';
	scrollbar_str = scrollbar ? 'yes' : 'no';
	resizable_str = resizable ? 'yes' : 'no';
	window.open(url, name, 'left='+left+',top='+top+',width='+width_str+',height='+height_str+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}

/* Открытие ссылки в новом окне заданного размера в соответствии с размером экрана */
function window_open_autosize(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable, autosize)
{
	top = (navigator.appName == 'Opera') ? top - 80 : top;
	width_str = autosize ? screen.availWidth - width : width;
	height_str = autosize ? screen.availHeight - height : height;
	toolbar_str = toolbar ? 'yes' : 'no';
	menubar_str = menubar ? 'yes' : 'no';
	statusbar_str = statusbar ? 'yes' : 'no';
	scrollbar_str = scrollbar ? 'yes' : 'no';
	resizable_str = resizable ? 'yes' : 'no';
	window.open(url, name, 'left='+left+',top='+top+',width='+width_str+',height='+height_str+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}

/* Открытие ссылки в новом окне c автоматическим определением размера 
Источник: http://forum.vingrad.ru/index.php?showtopic=85374&view=findpost&p=656106 */
function showImg(URL,imgPath) 
{
	var content = '<html><head>' +
	'\<\style>'+'BODY { overflow: hidden }'+'<\/style>'
	+'<script>' +    'function selfResizer(obj) {' +
	'var w = obj.width;iWidth='+self.innerWidth+';' +
	'var h = obj.height;iHeight='+document.body.clientHeight  +';' +
	/*'var left = (self.opera?iWidth:screen.availWidth)/2 - w/2;' +
	'var top = (self.opera?iHeight:screen.availHeight)/2 - h/2;' +*/
	'  window.resizeTo(w+10, h+80);' +
	/*'  window.moveTo(left, top);' +*/
	 '}' +    '<\/script>' +'</head><body>' +
	'<img onLoad="selfResizer(this)" style="position: absolute; left: 0px; top: 0px" src="'+imgPath+'">' +
	'</body></html>';

	var wnd = window.open(URL, 'newWnd', 'width=50,height=50,left=25,top=30,screenX=0,screenY=0,resizable,scrollbar=0,stastusbar=0');

    wnd.document.write(content);
    wnd.document.title = "Просмотр изображения";
    wnd.document.close();
}