adding js function