function resizeImage(img, width, height)
{
	var newImage = new Image();
	newImage.src = img.src;
	
	thumbWidth 	= width;
	thumbHeight	= Math.round((thumbWidth/newImage.width)*newImage.height);

	if(thumbHeight > height)
	{
		thumbHeight	= height;
		thumbWidth 	= Math.round((thumbHeight/newImage.height)*newImage.width);
	}
	img.width 	= thumbWidth?thumbWidth:width;
	img.height	= thumbHeight?thumbHeight:height;
}
