
//   function loadLargeView by Richard A. Hyman
//   copyright� R.A.Hyman, all rights reserved.
//   for use, contact rick @t rhyman.net
function loadLargeView(largeURL, theWinTitle, imageWidth, imageHeight, windowWidth, windowHeight)
{
var imageRatio= imageWidth/imageHeight;
var scriptStr = '\r window.onresize=resizeMyImage;';

var loadedWin = window.open('', '', 'location=0, height='+windowHeight+', width='+windowWidth+', scrollbars=0, resizable=1');

loadedWin.document.write('<html><head><title>' +theWinTitle+ '</title>');

loadedWin.document.write('\r <script language=\"javascript1.2\">');
loadedWin.document.write('\r var newWinWidth; var newWinHeight;');
loadedWin.document.write('\r var imageRatio=' + imageRatio+ ';');

loadedWin.document.write('\r function resizeMyImage() {');

loadedWin.document.write('\r  getWindowSize();');
loadedWin.document.write('\r var windowRatio= newWinWidth/newWinHeight;');

loadedWin.document.write('\r if(windowRatio > imageRatio) {document.main_image.height = newWinHeight; document.main_image.width = newWinHeight * imageRatio;} else {document.main_image.width = newWinWidth; document.main_image.height = newWinWidth / imageRatio}');
loadedWin.document.write('\r }');
//   end function resizeMyImage

//   function getWindowSize called from within resizemyImage
//   global vars newWinWidth and newWinHeight used within
loadedWin.document.write('\r function getWindowSize() {');
loadedWin.document.write('\r newWinWidth=200; newWinHeight=300;');
loadedWin.document.write('\r if( typeof( window.innerWidth ) == \'number\' ) {');
loadedWin.document.write('\r     //Non-IE');
loadedWin.document.write('\r   newWinWidth = window.innerWidth; newWinHeight = window.innerHeight;');
loadedWin.document.write('\r    } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {');
loadedWin.document.write('\r     //IE 6+ in *standards compliant mode*');
loadedWin.document.write('\r    newWinWidth = document.documentElement.clientWidth;');
loadedWin.document.write('\r    newWinHeight = document.documentElement.clientHeight;');
loadedWin.document.write('\r     } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {');
loadedWin.document.write('\r     //IE 4 compatible');
loadedWin.document.write('\r    newWinWidth = document.body.clientWidth;');
loadedWin.document.write('\r    newWinHeight = document.body.clientHeight;');
loadedWin.document.write('\r     }');
loadedWin.document.write('\r }');
//   end function getWindowSize

loadedWin.document.write(scriptStr);

loadedWin.document.write('\r </script></head><body topmargin=0 leftmargin=0 marginheight=0 marginwidth=0>');
loadedWin.document.write('<img src='+largeURL+' name=\"main_image\">');
loadedWin.document.write('</body> </html>');

var loadedWinRatio = windowWidth/windowHeight;
if(loadedWinRatio > imageRatio){
loadedWin.document.main_image.height= windowHeight;
loadedWin.document.main_image.width= windowHeight * imageRatio;
} else {
loadedWin.document.main_image.width= windowWidth;
loadedWin.document.main_image.height= windowWidth / imageRatio;
}
}      //  end of loadLargeView
