Create  javascript for gallery