Size and Positioning

I’m currnetly doing a flash site
My problem is if a person enters a large enough size it can fill then intire screen. My problem is I need a math equation that will scale it down to an appropiate size.

the movie which is all the tiles together, can be no bigger than 600px hieght and no more than 800px across.

Any help is gladly appreciate