// JavaScript Document
// Called from pages such as "ride.php" and "event_show.php" and the various event record pages.
//
// Display Large Image in popup window sized to suit the image.
// Note: the Javascript images are pre-configured with src file above.
function popup_image2(java_image)
{
	var temp_width = java_image.width;
	var temp_height = java_image.height;
	
	// failsafe
	if (temp_width < 10)
	{
		temp_width = 801;
	}
	if (temp_height < 10)
	{
		temp_height = 601;
	}
	
	var temp_win_width = temp_width + 20;
	var temp_win_height = temp_height + 20;
	
	var left_offset = parseInt((screen.availWidth/2) - (temp_win_width/2));
	var top_offset = parseInt((screen.availHeight/2) - (temp_win_height/2));

	var jkoptions = 'target=miniwin,status=no,titlebar=no,toolbar=no,menubar=no,directories=no,location=no,width='+temp_win_width+',height='+temp_win_height+',screenX='+left_offset+',screenY='+top_offset+',left='+left_offset+',top='+top_offset;
	
	//alert("screen.availWidth="+screen.availWidth+", screen.availHeight="+screen.availHeight+", jkoptions="+jkoptions);
	
	// This below is safer esp. for dual screen setups but non-centered way to do it:
	//jkpopwin = window.open('about:blank', 'win2', 'target=miniwin,status=no,titlebar=no,toolbar=no,menubar=no,directories=no,location=no,width='+temp_win_width+',height='+temp_win_height);
	
	// this way is more centered for single screens but less good for dual screens:
	jkpopwin = window.open('about:blank', 'win2', jkoptions);
	jkpopwin.document.open();
	jkpopwin.document.write('<html><head><title>LoveOfCars.com.au</title></head><body style="background-color:#000000; padding:10px; margin:0;"><img src="'+java_image.src+'"></body></html>');
	jkpopwin.document.close();
	jkpopwin.focus();
}
