First commit of autoscaler.js

Need to clean up and move variables into config etc but what the hey...