Expand an image to fill a div always (so crop top or sides as needed). It's the JavaScript equivalent of the CSS3 code background-size: cover.
Src : http://stackoverflow.com/questions/5399568/full-bleed-image-resize-calculation?lq=1