moving JS code on each page to external assets/js file.