/*	@author - unkom.ru	*/
/*	@title - Popup window with image inside	script */
/*	@description - Script get open popup sized window & display one image inside that window */
/*	@vars:
		'id' - image ID
		'url' - URL of opening image
		'w' - popup window width
		'h' - popup window height
		'text' - picture description. Automatically get "alt" or "title" img attributes value */

function image(id, url, w, h)
{
var OpenWindow = window.open("",id,"left=0, top=0, menubar=no, toolbar=no, location=no, directories=no, status=no, scrollbars=yes, resizable=yes, width=" + w + ", height=" + h);
var obj = document.getElementById(id);
var alt=obj.getAttribute('alt');
var	text = (alt) ? alt : obj.getAttribute('title');

OpenWindow.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"\n');
OpenWindow.document.write('"http://www.w3.org/TR/html4/strict.dtd">\n');
OpenWindow.document.write('<html>\n');
OpenWindow.document.write('<head>\n');
OpenWindow.document.write('<meta name="Content-Type" content="text/html; charset=windows-1251">\n');
OpenWindow.document.write('<title>'+text+'</title>\n');
OpenWindow.document.write('</head>\n');
OpenWindow.document.write('<body style="margin: 0; padding: 0; color: gray; font: normal 90%/1em Arial, Helvetica, sans-serif">\n');
OpenWindow.document.write('<h4 style="width: 100%; text-align:center; position: absolute; top: 50%; left: 0; margin-top: -0.5em;">Загружается изображение...</h4>\n');
OpenWindow.document.write('<img  onClick="window.close()" width="' + w + '" height="' + h + '" src="' + url + '" title="Щелкните, чтобы закрыть окно" alt="Щелкните, чтобы закрыть окно" style="border: none; cursor: hand; cursor: pointer; position: absolute; top: 0; left: 0;">\n');
OpenWindow.document.write('</body>\n');
OpenWindow.document.write('</html>\n');
OpenWindow.document.close();
}