Get Base URL
From http://arifhossen.wordpress.com/2010/07/19/javascript-get-base-url/