move javascript from index to scripts page