


// -----
function openImage(imgName, imgTitle, wt, ht, top, left) {
  wscroll = "no";

  if (imgTitle == "::") {
    ht_addon = 30;
  }
  else {  // надо расчитывать от длины imgTitle и wt
    ht_addon = 30;
  }

  wwt = wt + 40;
  wht = ht + ht_addon;

  if (wht > screen.height - 60)  {
    wht = screen.height - 60;
    wscroll = "yes"
  }

  if (wwt > screen.width) {
    wwt=screen.width;
    wscroll = "yes"
  }

//  if (!top) top = (screen.height) ? Math.floor((screen.height - ht) / 2) - 30 : 0;
//  if (!left) left = (screen.width) ? Math.floor((screen.width - wt) / 2) - 30 : 0;

  if (!top) top = Math.floor((screen.height - wht) / 2) - 40
  if (!left) left = Math.floor((screen.width - wwt) / 2)
  if (top < 0) top = 0;
  if (left < 0) left = 0;

  image=window.open("", "fullImage_" + wt, "width=" + wwt + ",height=" + wht + ",top=" + top + ",left=" + left + ",scrollbars=" + wscroll + ",toolbar=no,location=no,status=no,menubar=no,resizable=yes");
  image.focus();


  image.document.open();
  image.document.write("<html>\n<head>\n<title>" + imgTitle + "</title>\n");
  image.document.write("<meta name=\"robots\" content=\"noindex,nofollow\">\n");
  image.document.write("<body bgcolor=\"white\">\n\n");
  image.document.write("<center><a href=\"javascript: window.close();\"><img src=\"" + imgName + "\" width=" + wt + " height=" + ht + " border=0 alt=\"щелкните по изображению, чтобы закрыть окно\"></a></center>\n\n");
  image.document.write("\n</body></html>");
  image.document.close();
}



