put all js code inside the onReady event