Move common Javascript code into a separate file

Created by  Eelco Dolstra  on June 24, 2013
2P7VNAACFSXMH42JCXQZ7GDAAEIFDGDWJOK6XD6G36AGEYQSRO2AC
Change contents