wrapped the main javascript in an jQuery ready event, to prevent load errors when browsing with the back button.