Refactoring resizing of interactives in JS

Pulling the code out of common.js into its own file for refactoring and testing.