Added function for adding javascript to a page