var photoWin = null;

function viewPhoto( imgSrc, imgTitle ) {

    if( photoWin ) {
        photoWin.close();
    }

    var w = 100
    var h = 100;
    var l = ( screen.width - w ) / 2;
    var t = ( screen.height - h ) / 2;

    photoWin = window.open( '', 'photoWin', 'width=100,height=100,left=' + l + ',top=' + t );

    var htm = '<html>' + 
        '<head>' + 
        '<title>' + imgTitle + '</title>' +
        '<meta http-equiv="imagetoolbar" content="false" />' +
        '</head>' + 
        '<body style="margin: auto; padding: auto; overflow: hidden;" onload="document.getElementById(\'theDiv\').style.visibility=\'visible\';window.resizeTo(document.images[ \'theImage\' ].width+10,document.images[ \'theImage\' ].height+28);window.moveTo((screen.width - document.images[ \'theImage\' ].width)/2,(screen.height - document.images[ \'theImage\' ].height)/2);">' +
        '<p style="font: 11px Verdana,sans-serif; position: absolute; top: 10px; left: 10px;">Loading...</p>' +
        '<div id="theDiv" style="visibility: hidden; position: absolute; top: 0; left: 0;"><img src="' + imgSrc + '" border="0" id="theImage" alt="' + imgTitle + '" /></div>' +
        '</body>' +
    '</html>';

    photoWin.document.write( htm );
    photoWin.document.close();

}
