add clock js file

made clock js code to a separate file