function getimg(img_id)
{
	var img=img_id;
	var start=img.indexOf("file=");
	if (start==0)
	{
	  var t=window.open('img_id', 
  '_blank',
  'toolbar=no,width=10,height=10,left=0,top=0, status=no,scrollbars=yes,resize=no');
  var s='<body onload="ol()" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><script>function ol(){ '+
  ' var corrx=0; var corry=0; if (window.screen.height-50<=document.images[0].height+30){corry=document.images[0].height+30-window.screen.height+50;} if (window.screen.width<=document.images[0].width+28) {corrx=document.images[0].width+28-window.screen.width;}'+
  'window.resizeTo(document.images[0].width+28-corrx,'+
  'document.images[0].height+30-corry);} '+
  '<'+'/script><img src="'+img_id+'" onload="ol()" onclick="window.close();" ></body>';
  t.document.writeln(s);
	}else{
		img_id=img.substr(start+5, img.length);
	  var t=window.open('img_id', 
  '_blank',
  'toolbar=no,width=10,height=10,left=0,top=0, status=no,scrollbars=yes,resize=no');
  var s='<body onload="ol()" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><script>function ol(){ '+
  ' var corrx=0; var corry=0; if (window.screen.height-50<=document.images[0].height+30){corry=document.images[0].height+30-window.screen.height+50;} if (window.screen.width<=document.images[0].width+28) {corrx=document.images[0].width+28-window.screen.width;}'+
  'window.resizeTo(document.images[0].width+28-corrx,'+
  'document.images[0].height+30-corry);} '+
  '<'+'/script><img src="'+img_id+'" onload="ol()" onclick="window.close();" ></body>';
  t.document.writeln(s);
	}
}

function getimg2(pid, mode, f)
{
  var t=window.open(  '/preview.php?id='+pid+'&mode='+mode+'&f='+f, 
  '_blank',
  'toolbar=no,width=600,height=400,left=0,top=0, status=no,scrollbars=yes,resize=no');
}


