function viewPic(url, title) {
    if (url == '') return false;
    width = 300;
    height = 100;
    window_top = (screen.height - height) / 2;
    window_left = (screen.width - width) / 2;
    win = window.open(url, 'image', 'width='+width+', height='+height+', top='+window_top+', left='+window_left+', toolbar=0, statusbar=0, location=0, scrollbars=no, resizable=0');
    win.document.open();
    win.document.write('<html><head><title>'+title+'</title>');
    win.document.write('<' + 'script language="Javascript"> ');
    win.document.write('function body_on_load() {window.document.getElementById("text").innerHTML = ""; document.getElementById("photo").style.display = "block"; window.resizeTo((document.images.photo.width+10),(document.images.photo.height+29)); window.moveTo((screen.width-document.images.photo.width)/2, (screen.height-document.images.photo.height)/2); window.focus(); }</'+'script>');
    win.document.write('</head><body leftmargin=0 topmargin=0 rightmargin=0 bottommargin=0 marginwidth=0 marginheight=0 onload="body_on_load()">');
    win.document.write('<span id="text"><br><center>Идет загрузка изображения...</center></span><a href="javascript:window.close();"><img id="photo" src="'+url+'" style="display:none" border="0"></a>');
    win.document.write('</body></html>');
    win.document.close();    
}
 
function viewURL(url, width, height, scroll) {
    if (url == '')   return false;
    if (width == null) width = 640;
    if (height == null) height = 480;
 
    if (scroll == null) scroll = 0;
    win = window.open(url, '', 'width='+width+', height='+height+', toolbar=0, statusbar=0, location=0, scrollbars='+scroll+', resizable=0');
    win.moveTo((screen.width-width)/2, (screen.height-height)/2);
}
 
function link(a, b) {
    if(a != null){
        document.Model.src = a;
    }
    if(b != null){
        var url = document.getElementById("1024"); 
        if(url != null)
        url.href = "javascript:viewPic('" + b +"','В формате 1024 x 768');";
    }
}
