update scripts

Use a single getLocation function
Separate code for homepage and all other pages
Use UglifyJS for minification