function resizeImage(imageId)
{
	img = document.getElementById(imageId);
	var width = img.width;
	var height = img.height;
	var newx = 750; // set to whatever you want the images max width to be.
	var newy = 1000; // whatever you want the images maximum height to be.
		
	if ( width >= height )
	{
		//alert('landscape');
		// landscape
		var tmpy = height*newx/width;
		if ( tmpy <= newy )
		{
			newy = tmpy;
		}
		else
		{
			newx = width*newy/height;
		}
	}
	else
	{
		// portrait
		//alert('portrait');
		tmpx = width*newy/height;
		if ( tmpx <= newx )
		{
			newx = tmpx;
		}
		else
		{
			newy = height*newx/width;
		}
	}
	
	img.width = newx;
	img.height = newy;
}


