Alright, now for when a user clicks on the image, I have a script that does popImage() which does the full size picture. If I have a picture that is too large for someone's available screen size, how can I get the window to fit that available screen size and reduce the size of the image to fit the window?
Here is what I have currently for popImage()
Code:
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle)
{
if (isNN)
{
imgWin=window.open('about:blank','',optNN);
}
if (isIE)
{
imgWin=window.open('about:blank','',optIE);
}
with (imgWin.document)
{
writeln('<html><head><title>Loading...</title><style>body{margin:5px;}</style></head>');
writeln('<sc'+'ript>');
writeln('var isNN,isIE,width,height;');
writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');
writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');
writeln('if (isIE){');
writeln('window.resizeTo(100,100);');
writeln('width=300-(document.body.clientWidth-(document.images[0].width));');
writeln('height=100-(document.body.clientHeight-(document.images[0].height))+20;');
writeln('window.resizeTo(width,height);}');
writeln('if (isNN){');
writeln('window.innerWidth=document.images["George"].width+20;');
writeln('window.innerHeight=document.images["George"].height+20;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');
writeln('</sc'+'ript>');
if (!AutoClose)
writeln('</head><body bgcolor=FFFFFF scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else
writeln('</head><body bgcolor=FFFFFF scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<div align="center"><img name="George" src='+imageURL+' border=0></div><div align="center"><a href="javascript: window.close();" style="font-size:10; color:#575757; font-family: Verdana; text-decoration: underline;">close window</a></div></body></html>');
close();
}
}
Bookmarks