﻿function openImageWindow(img, width, height, title) {
    var NewWindow;

    var left = (screen.width - width) / 2;
    var top = (screen.height - height) / 2;
    var titleWindow = (title != '' && title != undefined) ? title : "Фото";

    var sFeatures = "top=" + top + ", left=" + left + ", width=" + width + ", height=" + height + ", "
            + "toolbar=no, menubar=no, location=no, directories=no, resizable=no, scrollbars=no";
    NewWindow = open("", "myWin", sFeatures, true);
    NewWindow.document.open();
    NewWindow.document.writeln("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>" +
    "<html xmlns='http://www.w3.org/1999/xhtml'>" +
    "<head>" +
        "<title>" + titleWindow + "</title>" +
    "</head>" +
    "<body style=\"margin: 0; padding: 0;\">" +
    "<img style=\"display: block;\" src=\"" + img + "\" width=\"" + width + "\" height=\"" + height + "\" alt=\"\" />" +
    "</body>" +
    "</html>");
    NewWindow.document.close();
}
