Javascript Additions

[js add] adding older js code to later be refactored