﻿function wmj_pop_pic(f) {
    var l = (screen.width - 200) / 2;
    var t = (screen.height - 100) / 2;
    wPic = window.open('', 'wPic', 'toolbar=no,left=' + l + ',top=' + t + ',width=200,height=100');
    wPic.document.write('<html><head><title>WMJ</title><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="margin:0"><table border="0" width="100%" height="100%"><tr><td style="text-align:center;font-family:verdana,arial,sans-serif;font-size:12px;font-weight:bold;color:#663366;">загрузка...</td></tr></table></body></html>');
    wPic.document.close();
    pic = new Image();
    pic.src = f;
    pic.onLoad = setTimeout(function() { wmj_show_pic(pic, f); }, 1000);
    return false;
}

function wmj_show_pic(pic, f) {
    var w = pic.width;
    var h = pic.height;
    pic = null;
    if ((w < 50) && (h < 50)) {
        w = 200;
        h = 100;
        var out = '<html><head><title>WMJ - ошибка</title><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="margin:0" onBlur="self.close();"><table border="0" width="100%" height="100%"><tr><td style="text-align:center;font-family:verdana,arial,sans-serif;font-size:12px;font-weight:bold;color:#cc0000;">Картинка не найдена.<br />Приносим свои извинения.</td></tr></table></body></html>';
    }
    else {
        var out = '<html><head><title>WMJ</title></head><body style="margin:5;background-color:#808080;" onBlur="self.close();"><img src=' + f + '></body></html>';
    }
    l = (screen.width - w) / 2;
    t = (screen.height - h) / 2;
    wPic.document.write(out);
    wPic.document.close();
    wPic.resizeTo(w + 21, h + 39);
    wPic.moveTo(l, t);
    wPic.focus();
}



function wmj_pop_pic_with_title(f, title) {
    var l = (screen.width - 200) / 2;
    var t = (screen.height - 100) / 2;
    wPic = window.open('', 'wPic', 'toolbar=no,left=' + l + ',top=' + t + ',width=200,height=100');
    wPic.document.write('<html><head><title>WMJ</title><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="margin:0"><table border="0" width="100%" height="100%"><tr><td style="text-align:center;font-family:verdana,arial,sans-serif;font-size:12px;font-weight:bold;color:#663366;">загрузка...</td></tr></table></body></html>');
    wPic.document.close();
    pic = new Image();
    pic.src = f;
    pic.onLoad = setTimeout(function() { wmj_show_pic_with_title(pic, f, title); }, 1000);
    return false;
}

function wmj_show_pic_with_title(pic, f, title) {
    var w = pic.width;
    var h = pic.height;
    pic = null;
    if ((w < 50) && (h < 50)) {
        w = 200;
        h = 100;
        var out = '<html><head><title>WMJ - ошибка</title><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="margin:0" onBlur="self.close();"><table border="0" width="100%" height="100%"><tr><td style="text-align:center;font-family:verdana,arial,sans-serif;font-size:12px;font-weight:bold;color:#cc0000;">Картинка не найдена.<br />Приносим свои извинения.</td></tr></table></body></html>';
    }
    else {
        var out = '<html><head><title>WMJ</title></head><body style="margin:5;background-color:#FFFFFF;" onBlur="self.close();"><img src=' + f + '><div>' + title + '</div></body></html>';
    }
    l = (screen.width - w) / 2;
    t = (screen.height - h) / 2;
    wPic.document.write(out);
    wPic.document.close();
    wPic.resizeTo(w+20, h+110);
    wPic.moveTo(l, t);
    wPic.focus();
}


