Fixed Javascript replacing strings only once.