```Date: Feb 16, 2012 3:49 PM
Author: Daryl
Subject: Ratio of square sizes

So I'm out of my league on this math problem. I'll try to explain as simply as possible. Any help would be awesome. This is a piece of Javascript I am writing but the math is my issue.I have a template that is built on a 4200 x 4200 square. That template draws squares based on coordinates contained within that template. {L,T,R,B} The template can be applied to any document size {activeDocument}. If that document size is not square, my ratios are off.Here are my formulas.wd = width of templatehd = height of templatemaxWidth = (activeDocument.width)/2;	//width of active document divided in halfmaxHeight = activeDocument.height;  //height of active documentratioRec = wd/hd; //aspect ratio of template  ratioView = maxWidth/maxHeight; //aspect ratio of documentratio = ratioView/ratioRec;ratioW = maxWidth/wd; ratioT = (maxHeight/hd); //Sizing variables, this is where the problem isleft 	= (left * ratioW);right	= (right  * ratioW) ;top 	= (top * ratioT);bottom =  (bottom  * ratioT) ;Thanks for any help you might have on this. If something is not clear or need more information, please let me know.Thanks
```