/*---------------------------------------------------------------------------
	Pop-up window for larger photographs

	This function opens a new window whose size is determined by that of the
	target image.  The image is dynamically written to the new window with a
	hotspot that closes the new window when an individual clicks on the image
	contained within.  
	It has been tested in IE 5.5 + and NN 6.2 + 
----------------------------------------------------------------------------*/

function getPhoto(Img,W,H){ //receives the target image name, width, and size respectively
	var photoWin 	= null;
	
/*sets the default url for the target image.  To change the
	url, simply replace the "/images/" with the appropriate path (URL)
	Just be sure that the target image exists in the path (URL) specified.*/
			var URL 	= "http://b-29s-over-korea.com/" +Img; 

			var aW 		= screen.availWidth;
			var aH 		= screen.availHeight;
                  var winH          = aH-50;

	//set the width value for the pop-up window by adding 20 pixels to the target image's width 
			var wW 		= 40 + (parseInt(W));
	
	//set the height value for the pop-up window by adding 40 pixels to the target image's height 			
			var wH 		= 20 + (parseInt(H)); 			
	
	//sets the default top location of the pop-up window
			var winTop 	= 5;												
	//To center the window on the screen, comment out the above line, and uncomment the following line
			//var winTop	= (aH - wH)/2;
	
	//sets the beginning point of the pop-up window (distance from the left)
	//This is currently set to right align the pop-up window.
			//var winLeft 	= aW - (10 + parseInt(wW)); 																				
	//To center the pop-up window on the screen, comment out the above line, and uncomment the following line
			var winLeft = (aW - wW)/2;

if (wH > winH){
wH = winH;
}

/* Now, we assign the HTML that's to be dynamically written into our pop-up window to a variable
	 It shouldn't be necessary to change any of the code for this variable */
	 	
var strImage = "<html>\r";
strImage += "<head>\r";

//define a function that resizes the window based upon the target image width and height
strImage += "<SCR"+"IPT language='JavaScript'> \r";
strImage += "<!-- \r";

strImage += "function reSize(){ \r";
strImage += "if (window.width != "+wW+"){ \r"; 		//checks existing window width
strImage += " var wW = "+wW+";} \r"; 			//sets the window width to the appropriate value
//strImage += "if (window.height >= "+wH+"){ \r";	//checks existing window height
//strImage += " var wH = "+wH+";} \r";			//sets the window height to the appropraite value
strImage += "  window.resizeTo(wW,wH); \r";		//resizes window to the new window w & h values (if nec)
strImage += "  window.moveTo("+winLeft+","+winTop+"); \r";	//moves window to the approp. place on the screen

strImage += "} \r";
strImage += "//--> \r";
strImage += "</scr"+"ipt> \r";  //end our function
strImage += "</head> \r";

strImage += "<body bgcolor='#FFFFFF' topmargin='5' leftmargin='5' marginwidth='5' marginheight='5' onLoad='reSize();'> \r";
strImage += "<p align='center'><a href='javascript:self.close();'> \r";
strImage += "<img src='"+URL+"' border='0' width='"+W+"' height='"+H+"'> \r";
strImage += "</a></p> \r";
strImage += "</body></html> \r";


/* Now that we've finished assigning our new HTML to a variable, it's time to open the pop-up window */			
	photoWin = window.open('','photoWin','width='+wW+',height='+wH+',left='+winLeft+',top='+winTop+',scrollbars=yes,resizable=yes');
	photoWin.window.focus();
	
	//Write the Image to the New Window & we're done.
	photoWin.document.write(strImage);
	photoWin.document.close();
}
