add function.js

for time counter and draw heart