Extracted javascript from Index view