Moved javascript from html pages into seperate files