//顯示成最大寬為maxWidth，最大高為maxHeight的圖
function ImageResize( image , maxWidth , maxHeight )
{
	var img = new Image();

	img.src = image.src;
	
	if( ( img.width > 0 ) && ( img.height > 0 ) )
	{
		if( img.width / img.height >= maxWidth / maxHeight )
		{
			if( img.width > maxWidth )
			{ 
				image.width = maxWidth;
				image.height = ( img.height * maxWidth ) / img.width;
			}
			else
			{
				image.width = img.width; 
				image.height = img.height;
			}
		}
		else
		{
			if( img.height > maxHeight )
			{ 
				image.height = maxHeight;
				image.width = ( img.width * maxHeight ) / img.height; 
			}
			else
			{
				image.width = img.width; 
				image.height = img.height;
			}
		}
	}
}
