function ImgShw(src, width, height, alt) { var scroll = "no"; var top=0, left=0; if(width > screen.width-10 || height > screen.height-28) scroll = "yes"; if(height < screen.height-28) top = Math.floor((screen.height - height)/2-14); if(width < screen.width-10) left = Math.floor((screen.width - width)/2-5); width = Math.min(width, screen.width-10); height = Math.min(height, screen.height-28); var wnd = window.open("","","scrollbars="+scroll+",resizable=yes,width="+width+",height="+height+",left="+left+",top="+top); var doc = wnd.document; var body = doc.getElementsByTagName('body')[0]; body.style.margin=0; body.style.marginWidth=0; body.style.marginHeight=0; var img = doc.createElement('img'); img.setAttribute('src', src); img.width = width; img.height = height; img.alt = alt; img.style.cursor = 'pointer'; img.onclick = function() { wnd.close() }; body.appendChild(img); return false; }