function open_win ( addr, width, height, title ) {
    r = window.open( addr, title, "width="+width+", height="+height+", location=0, menubar=0, resizable=0, scrollbars=1, status=0, titlebar=0, toolbar=0, screenX=100, left=100, screenY=30, top=60 ");
}

var picDesc=new Array();
function openPic(image, width, height) {
    if( picDesc[0] ) {
        picDesc[0].close();
    }
    picDesc[0] = window.open( '', 'win', 'location=0, toolbar=0, menubar=0, scrollbars=0, resizable=1, height='+height+', width='+width+', status=0' );
    picDesc[0].document.write( '<html><head><title>Изображение</title></head>' );
    picDesc[0].document.write( '<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">' );
    if(image.indexOf('http://')<0)
        image='http://'+location.host+'/'+image;
    picDesc[1]=new Image();
    picDesc[1].src=image;
    picDesc[0].document.write( '<a href="javascript: window.close()" title="Закрыть окно"><img src="'+image+'" _width="'+width+'" _height="'+height+'" border="0" /></a>' );
    picDesc[0].document.write( '</body></html>' );
    picDesc[0].document.close();
    picDesc[2]=setInterval("if(picDesc[1] && picDesc[0] && picDesc[1].width!=0) {picDesc[0].resizeTo(picDesc[1].width+6,picDesc[1].height+50);clearInterval(picDesc[2]);}",20);
}

