added 99% of the javascript related functions