Working javascript for shares