Update main.js

changed myOnloadFunction to have the initial variable calls outside of the function