fully implemented Javscript. Only animation remains