move JS out of PHP file and into JS file