function openImageSizedWindow(src){ var i = new Image(); i.onload = function() { var pop_win = window.open( "", "_blank", "width="+i.width+",height="+i.height+",scrollbars=no,resizable=yes" ); if ( pop_win ) { pop_win.window.document.open(); pop_win.window.document.write( '' +'