for(i = 0; i < document.images.length; i++) {
    img = document.images[i]
    
    if(img.width > 598) {
        img.width = 598
        img.style['cursor'] = 'pointer'
        img.setAttribute('alt', 'Click to enlarge')
        img.setAttribute('resizeable', 'yes')
    }
}

function OpenImageInNewWindow(image){
    if(image.getAttribute('resizeable') == 'yes') {
        newWindow=window.open(image.src, 'newWin', 'toolbar=no, width=540, height=360')
        newWindow.document.writeln('<html>')
        newWindow.document.writeln('  <head>')
        newWindow.document.writeln('    <script>')
        newWindow.document.writeln('      function resizeWindow(image) {')
        newWindow.document.writeln('        window.resizeBy(image.width-window.document.body.clientWidth,image.height-window.document.body.clientHeight)')
        newWindow.document.writeln('      }')
        newWindow.document.writeln('    <\/script>')
        newWindow.document.writeln('  <\/head>\n')
        newWindow.document.writeln('  <body bgcolor="white" style="margin: 0">')
        newWindow.document.writeln('    <img src="' + image.src + '" onload="resizeWindow(this)">')
        newWindow.document.writeln('  <\/body>')
        newWindow.document.writeln('<\/html>')
        newWindow.document.close()
   }
}
