Size and Positioning

Hello
I’m currnetly doing a flash site http://65.175.73.93/index99.htm
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