
// Открытие изображения в отдельном окне
var resId=0;
var imgWndw;
function imgOpen(imgLink,Title,level) {
  if (typeof(window.resizeBy)=='undefined') return true;
  imgWndw=window.open('',imgLink.target,'width=100,height=100,toolbar=no,menubar=no,location=no,status=no,resizable=yes,scrollbars=yes,left='+(screen.width>>>2)+ ',top='+(screen.height>>>2));
  self.focus();
  var imgTitle=(Title)?Title:imgLink.href;
  with (imgWndw.document){
    open();
    write('<html><head><title>'+imgTitle+'</title></head><body leftmargin="10" topmargin="10" rightmargin="10" bottommargin="10"><img src="'+imgLink.href+'" border="1" bordercolor="#000000" alt="'+imgTitle+'"></body></html>');
    close();
  }
  resId=setInterval('imgResize()',100);
  return false
}

function imgOpenFlash(imgLink,Title,level) {
  imgWndw=window.open('','','width=100,height=100,toolbar=no,menubar=no,location=no,status=no,resizable=yes,scrollbars=yes,left='+(screen.width>>>2)+ ',top='+(screen.height>>>2));
  self.focus();
  var imgTitle=(Title)?Title:imgLink;
  with (imgWndw.document){
    open();
    write('<html><head><title>'+imgTitle+'</title></head><body leftmargin="10" topmargin="10" rightmargin="10" bottommargin="10"><img src="/'+imgLink+'" border="1" bordercolor="#000000" alt="'+imgTitle+'"></body></html>');
    close();
  }
  resId=setInterval('imgResize()',100);
}

function imgResize() {
  var w=imgWndw.document.images[0].width+20;
  if (w>screen.availWidth) w=screen.availWidth;
  var h=imgWndw.document.images[0].height+20;
  if (h>screen.availHeight) h=screen.availHeight;
  if (w>50 && h>50) {
    var ww=(imgWndw.innerWidth)?imgWndw.innerWidth:((document.body)? imgWndw.document.body.clientWidth:null);
    var wh=(imgWndw.innerHeight)?imgWndw.innerHeight:((document.body)? imgWndw.document.body.clientHeight:null);
    if (ww && wh) { imgWndw.resizeBy(w-ww+20,h-wh); }
    imgWndw.focus();
    clearInterval(resId)
  }
}
