Proposional scale?

hello.
i made something very much more diffucult then it have to be, and i wonder how i would do it more easy,

I get tons of IMGs thru a php file and then load them with movieClipLoader.
To get them all to fit into a 100x100 px small thumbnailholder i need to scale them down,
i do this right now with this stupid code:
targetMC is the loaded Img,
contSize = 100
[AS]
if (targetMC._height > targetMC._width)
{
difference = targetMC._width / targetMC._height;
targetMC._height = contSize;
targetMC._width = contSize * difference;
}
else if (targetMC._height < targetMC._width)
{
difference = targetMC._height / targetMC._width;
targetMC._width = contSize;
targetMC._height = contSize * difference;
}
else if (targetMC._height == targetMC._width)
{
targetMC._width = contSize;
targetMC._height = contSize;
}
[/AS]

how should i do this using xscale or something ?
Thanks