moving java-script from index to separate files