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=no,scrollbars=no,resizable=yes');
    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+30),(document.images.photo.height+60)); 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('<center><span id="text"><br>Идет загрузка изображения...</span><a href="javascript:window.close();"><img id="photo" src="'+url+'" style="display:none" border="0"></a></center>');
    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=1');
    win.moveTo((screen.width-width)/2, (screen.height-height)/2);
}
 
function popup(strFileUrl, strUserWinName, iWinW, iWinH, strUserFeatures) {
        var strAllFeatures = strUserFeatures + getPopupSizeRelatedFeatures( iWinW, iWinH, strUserFeatures );
        strAllFeatures += getStdFeatures( strAllFeatures );
        var strWinName = ( strUserWinName )? strUserWinName : 'popupWin';
        var popupWin = window.open(strFileUrl, strWinName, strAllFeatures);
        if ( popupWin ) popupWin.focus();
}
 
function getPopupSizeRelatedFeatures( iWinW, iWinH, strUserFeatures ) {
        var strSizeRelatedFeatures = '';
        var iWinWidth = ( iWinW )? iWinW : 540;
        var iWinHeight = ( iWinH )? iWinH : 600;
        if ( screen ) {
                var iScrWidth = ( screen.width )? screen.width : 0;
                var iScrHeight = ( screen.height )? screen.height : 0;
                var bNeedScroll = false;
                if ( iScrWidth < iWinWidth + 50 ) { bNeedScroll = true; iWinWidth = iScrWidth - 50; }
                if ( iScrHeight < iWinHeight + 100 ) { bNeedScroll = true; iWinHeight = iScrHeight - 100; }
                if ( !(strUserFeatures && strUserFeatures.indexOf('scrollbars') >= 0 ) ) {
                        strSizeRelatedFeatures += ( bNeedScroll )? ',scrollbars=yes' : ',scrollbars=no';
                }
                var iPosX = Math.round( ( iScrWidth - iWinWidth ) / 2 );
                var iPosY = Math.round( ( ( iScrHeight - 70 ) - iWinHeight ) / 2);
                strSizeRelatedFeatures += ( document.all )? ',left=' + iPosX + ',top=' + iPosY : ',screenX=' + iPosX + ',screenY=' + iPosY;
        }
        strSizeRelatedFeatures += ',width=' + iWinWidth + ',height=' + iWinHeight;
 
        return strSizeRelatedFeatures;
}
 

