Moved javascript to the js file