Moved Javascript from main document into JS file.