Moved favouriting javascript into a js file.