function open_picture(u,w,h,max_w,max_h) {
	if (window.screen) {
		max_w = window.screen.width - 20;
		max_h = window.screen.height - 53;
	}
//    imgopen(u,u);
//    return ; 


	win_w = w + 0;
	win_h = h + 0;
	if (win_w > max_w) win_w = max_w;
        if (win_h > max_h) win_h = max_h;
	win = window.open('','','width=' + win_w + ', height=' + win_h + ", scrollbars=yes, resizable=no, scrolling=yes");
	win.document.open();
	win.document.write('<body bgcolor=#F1F2F2 leftMargin=0 rightMargin=0 topMargin=0 marginwidth=0 marginheight=0>');
	win.document.write('<img width=' + w + ' height=' + h + ' src="' + u + '">');
	win.document.close();
 	win.focus();
        return(win);
}



function imgopen(imgf,tit){

rand_id='image'+(Math.round(Math.random()*1000));

outf="<html>"
 +"<head>"
 +"<title>"+tit+"</title>"
 +"<style>body{margin:0px}</style>"
 +"</head>"
 +"<body leftmargin=0 topmargin=0>"
 +"<img src=\""+imgf+"\">";

iopen="iwin=self.open('"+imgf+"', '"+rand_id+"', 'width='+(img1.width)+',height='+(img1.height)+',top=0,left=0');"
 +"iwin.document.write('"+outf+"');"
 +"iwin.focus();";

img1=new Image();
img1.src=imgf;

if(img1.width!=0) eval(iopen);

else{
iwin = self.open('about:blank', 'f'+rand_id, 'width=100,height=100,top=0,left=0');
iwin.document.write("<html>"
+"<body>загрузка...<br>"
 +"<"+"script>"
  +"function imo(img1){"+iopen
  +"self.close();"
 +"}<"+"/script>"
 +"<img src='"+imgf+"' onload='imo(this);'>");
 }
}





