Moving Javascript into js files