Moving javascript around