Resizing & Scaling an Image

One of the members wrote a function that sizes an image onto a movieclip and it works great. But only if the images are the same size. I want to be able to import any size image and scale if necessary and resize the image into my movieclip. Can anyone help me?

_global.resizeImage= function()
{
//maximum image dimensions
//Note: The images have to be the same size
//so they can be scaled the same.
wMax = 292; //42
hMax = 359; //109

if(img_mc._width > wMax || img_mc._height > hMax) 
 {
	//which dimension is the most oversized
	wDiff = img_mc._width - wMax;
	hDiff = img_mc._height - hMax;
	//calculate ratio
	if(wDiff > hDiff) 
	 {
	   ratio = (wMax/img_mc._width) * 100;
	 } 
	else 
	 {
	   ratio = (hMax/img_mc._height) * 100;
	 }
 } 
else 
 {
   //if image doesn't need to be resized set ratio to 100
   ratio = 100;	
 }
img_mc._xscale = img_mc._yscale = ratio;	

};