
function mimgopen(imgf,tit){

rand_id='image'+(Math.round(Math.random()*1000));

imgf='/pic.php?picn='+imgf;
/*
  $s=imagecreatefromjpeg("$picn"gtr);
  $sx=imageSX($s);
  $sy=imageSY($s);

*/
wid=800;
hei=600;
outf="<html>"
 +"<head>"
 +"<style>body{margin:0px}</style>"
 +"</head>"
 +"<body leftmargin=0 topmargin=0>"
 +"<a href=\"\" OnClick=\"document.opener=self; window.close(); return false;\">"
 +"<img src=\""+imgf+"\" border=\"0\"></a>";

iopen="iwin=self.open('"+imgf+"', '"+rand_id+"', 'width='+wid+',height='+hei+',top=0,left=0');"
 +"iwin.document.write('"+outf+"');"
 +"iwin.focus();";

eval(iopen);
return;

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);'>");
 }
}

