function imgView(href,w,h)
{	
	var mat = 100;
   	var maxwidth = screen.width;
	var maxheight = screen.height;
	var top = Math.max(Math.floor((screen.height - (h + mat)) / 2), 10);	
	var left = Math.max(Math.floor((screen.width - (w + mat)) / 2), 10);
	var param = 'top=' + top + ',left=' + left + ',Toolbar=0, ocation=0, Directories=0, Status=0, Menubar=0, Resizable=0';
	if (w <= maxwidth && h <= maxheight) param += ',scrollbars=0';
	else { param += ',scrollbars=1'; w += 20; h += 20; }
	if(w > maxwidth) w = maxwidth; else w += mat;
	param  = param + ',width=' + w;
	if(h > maxheight) h = maxheight; else h += mat;
	param = param + ',height=' + h;

	imgWin = window.open('', '_blank', param);
	imgWin.opener = window;
	imgWin.resizeTo(w,h);
    imgWin.document.open("text/html");
	
	imgWin.document.writeln("<html>");
    imgWin.document.writeln("<head><title>Picspam.ru</title></head>");
    imgWin.document.writeln("<body style='margin:0; width:100%; height:100%; padding:0; background-color:#fff;'>");
	imgWin.document.writeln("<table style='border-collapse:collapse; margin:0; padding:0; width:100%; height:100%;'>");
	imgWin.document.writeln("<tr>");
	imgWin.document.writeln("<td style='margin:0; padding:0; width:100%; height:100%; text-align:center; vertical-align:middle;'>");
    imgWin.document.writeln('<img style="border:1px solid #666666;padding:1px;" src='+href+' onclick="parent.close()" style=cursor:hand;>');
	imgWin.document.writeln("</td></tr></table>");
	imgWin.document.write("</body>");
    imgWin.document.write("</html>");	
	imgWin.focus();
}
